cql-proxy icon indicating copy to clipboard operation
cql-proxy copied to clipboard

Update go-cassandra-native-protocol dependency

Open StevenLacerda opened this issue 1 year ago • 4 comments

IHAC that ran into an issue with what looks like a dependency issue in go-cassandra-native-protocol:

# github.com/datastax/cql-proxy/parser
/go/pkg/mod/github.com/datastax/[email protected]/parser/metadata.go:28:71: undefined: datatype.NewSetType
/go/pkg/mod/github.com/datastax/[email protected]/parser/metadata.go:46:71: undefined: datatype.NewSetType
/go/pkg/mod/github.com/datastax/[email protected]/parser/metadata.go:61:71: undefined: datatype.NewSetType
/go/pkg/mod/github.com/datastax/[email protected]/parser/metadata.go:73:71: undefined: datatype.NewSetType
/go/pkg/mod/github.com/datastax/[email protected]/parser/metadata.go:99:96: undefined: datatype.NewMapType
/go/pkg/mod/github.com/datastax/[email protected]/parser/metadata.go:130:87: undefined: datatype.NewListType
/go/pkg/mod/github.com/datastax/[email protected]/parser/metadata.go:131:87: undefined: datatype.NewListType

@absurdfarce FYI

StevenLacerda avatar Apr 26 '23 15:04 StevenLacerda

Re-posting comments from analysis of the above from elsewhere.

Looks like the problem here is that the dependency on go-cassandra-native-protocol is pretty old now. Specifically it's from before this commit which changes around a few function names.

If an application is using gocql-astra they'll bring in cql-proxy (for SCB handling) which in turn will bring in this older version of go-cassandra-native-protocol. If the application in question is already using a more recent version of go-cassandra-native-protocol from somewhere else you could quite possibly wind up with the build errors referenced above.

Safest bet is probably to update cql-proxy to use the latest go-cassandra-native-protocol.

Longer-term we can also look at decoupling cql-proxy from gocql-astra along the lines of what's discussed here.

absurdfarce avatar Apr 26 '23 15:04 absurdfarce

Note that there's a similar issue for astra-client-go. cql-proxy currently brings in 2.2.9 of this lib while most recent is 2.2.48.

absurdfarce avatar Apr 26 '23 21:04 absurdfarce

If one is in this predicament, how can they adjust the code to work correctly? I'm writing example code for the astra UI and I'm running into this. Can I just pull in a newer version of go-cassandra-latest-protocol? Should I back gocql-astra up to an earlier version? I'd like to get this solved today even if it's a hacky patchy answer.

Thanks

synedra avatar Jun 02 '23 16:06 synedra

@synedra For the case which brought on this ticket the solution was to remove the explicit dependency on go-cassandra-native-protocol and use the version that comes in via cql-proxy by way of gocql-astra. It's definitely both hacky and patchy but it should get you unstuck.

You'll likely have some code changes if you were using the most recent go-cassandra-native-protocol due to some changes to the API in versions between what cql-proxy brings along and whatever's on HEAD... but any such changes should be fairly minor.

cc @joao-r-reis

absurdfarce avatar Jun 02 '23 22:06 absurdfarce