Client unable to select from function when compression is enabled.
jnewmano opened this issue · 5 comments
jnewmano commented
Adding the following test to client/client_test.go results in an error. Selecting any computed function fails.
func (s *clientTestSuite) TestConn_Compress() {
addr := fmt.Sprintf("%s:%s", *test_util.MysqlHost, s.port)
conn, err := Connect(addr, *testUser, *testPassword, "", func(conn *Conn) {
conn.SetCapability(mysql.CLIENT_COMPRESS)
})
require.NoError(s.T(), err)
_, err = conn.Execute("SELECT VERSION()")
require.NoError(s.T(), err)
}
$ go test -v ./client --user root --pass <redacted> --run TestClientSuite/TestConn_Compress
=== RUN TestClientSuite
=== RUN TestClientSuite/TestConn_Compress
client_test.go:260:
Error Trace: /Users/jason/go/src/github.com/jnewmano/go-mysql/client/client_test.go:260
Error: Received unexpected error:
invalid compressed sequence 2 != 1
github.com/go-mysql-org/go-mysql/packet.(*Conn).newCompressedPacketReader
/Users/jason/go/src/github.com/jnewmano/go-mysql/packet/conn.go:152
github.com/go-mysql-org/go-mysql/packet.(*Conn).ReadPacketReuseMem
/Users/jason/go/src/github.com/jnewmano/go-mysql/packet/conn.go:111
github.com/go-mysql-org/go-mysql/client.(*Conn).readResultColumns
/Users/jason/go/src/github.com/jnewmano/go-mysql/client/resp.go:345
github.com/go-mysql-org/go-mysql/client.(*Conn).readResultset
/Users/jason/go/src/github.com/jnewmano/go-mysql/client/resp.go:291
github.com/go-mysql-org/go-mysql/client.(*Conn).readResult
/Users/jason/go/src/github.com/jnewmano/go-mysql/client/resp.go:236
github.com/go-mysql-org/go-mysql/client.(*Conn).exec
/Users/jason/go/src/github.com/jnewmano/go-mysql/client/conn.go:468
github.com/go-mysql-org/go-mysql/client.(*Conn).Execute
/Users/jason/go/src/github.com/jnewmano/go-mysql/client/conn.go:252
github.com/go-mysql-org/go-mysql/client.(*clientTestSuite).TestConn_Compress
/Users/jason/go/src/github.com/jnewmano/go-mysql/client/client_test.go:259
reflect.Value.call
/opt/homebrew/Cellar/go/1.22.1/libexec/src/reflect/value.go:596
reflect.Value.Call
/opt/homebrew/Cellar/go/1.22.1/libexec/src/reflect/value.go:380
github.com/stretchr/testify/suite.Run.func1
/Users/jason/go/pkg/mod/github.com/stretchr/testify@v1.8.4/suite/suite.go:197
testing.tRunner
/opt/homebrew/Cellar/go/1.22.1/libexec/src/testing/testing.go:1689
runtime.goexit
/opt/homebrew/Cellar/go/1.22.1/libexec/src/runtime/asm_arm64.s:1222
Test: TestClientSuite/TestConn_Compress
--- FAIL: TestClientSuite (0.04s)
--- FAIL: TestClientSuite/TestConn_Compress (0.01s)
FAIL
FAIL github.com/go-mysql-org/go-mysql/client 0.176s
FAIL
Client compression with computed function select worked in PR #862 at commit 22dbb42, something in a later commit resulted in an error in these types of queries.
dvilaverde commented
Thanks @jnewmano will take a look.
dvilaverde commented
lance6716 commented
Sorry for my code suggestion in the previous PR
dvilaverde commented
Sorry for my code suggestion in the previous PR
It's quite alright it happens. I didn't realize that boolean had such an important role until this issue was reported. I added a comment thought to make it clear for the next person.
dvilaverde commented
Please close this issue, this issue has been fixed. Thanks!