@@ -97,18 +97,8 @@ func (*mockConnection) executeQuery(ctx context.Context, qry *Query) *Iter { ret
9797var systemLocalResultMetadata = resultMetadata {
9898 flags : 0 ,
9999 pagingState : []byte {},
100- actualColCount : 18 ,
100+ actualColCount : 11 ,
101101 columns : []ColumnInfo {{
102- Keyspace : "system" ,
103- Table : "local" ,
104- Name : "key" ,
105- TypeInfo : NativeType {proto : protoVersion4 , typ : TypeVarchar },
106- }, {
107- Keyspace : "system" ,
108- Table : "local" ,
109- Name : "bootstrapped" ,
110- TypeInfo : NativeType {proto : protoVersion4 , typ : TypeVarchar },
111- }, {
112102 Keyspace : "system" ,
113103 Table : "local" ,
114104 Name : "broadcast_address" ,
@@ -118,21 +108,11 @@ var systemLocalResultMetadata = resultMetadata{
118108 Table : "local" ,
119109 Name : "cluster_name" ,
120110 TypeInfo : NativeType {proto : protoVersion4 , typ : TypeVarchar },
121- }, {
122- Keyspace : "system" ,
123- Table : "local" ,
124- Name : "cql_version" ,
125- TypeInfo : NativeType {proto : protoVersion4 , typ : TypeVarchar },
126111 }, {
127112 Keyspace : "system" ,
128113 Table : "local" ,
129114 Name : "data_center" ,
130115 TypeInfo : NativeType {proto : protoVersion4 , typ : TypeVarchar },
131- }, {
132- Keyspace : "system" ,
133- Table : "local" ,
134- Name : "gossip_generation" ,
135- TypeInfo : NativeType {proto : protoVersion4 , typ : TypeInt },
136116 }, {
137117 Keyspace : "system" ,
138118 Table : "local" ,
@@ -143,11 +123,6 @@ var systemLocalResultMetadata = resultMetadata{
143123 Table : "local" ,
144124 Name : "listen_address" ,
145125 TypeInfo : NativeType {proto : protoVersion4 , typ : TypeInet },
146- }, {
147- Keyspace : "system" ,
148- Table : "local" ,
149- Name : "native_protocol_version" ,
150- TypeInfo : NativeType {proto : protoVersion4 , typ : TypeVarchar },
151126 }, {
152127 Keyspace : "system" ,
153128 Table : "local" ,
@@ -173,11 +148,6 @@ var systemLocalResultMetadata = resultMetadata{
173148 Table : "local" ,
174149 Name : "schema_version" ,
175150 TypeInfo : NativeType {proto : protoVersion4 , typ : TypeUUID },
176- }, {
177- Keyspace : "system" ,
178- Table : "local" ,
179- Name : "supported_features" ,
180- TypeInfo : NativeType {proto : protoVersion4 , typ : TypeVarchar },
181151 }, {
182152 Keyspace : "system" ,
183153 Table : "local" ,
@@ -186,71 +156,56 @@ var systemLocalResultMetadata = resultMetadata{
186156 NativeType : NativeType {proto : protoVersion4 , typ : TypeSet },
187157 Elem : NativeType {proto : protoVersion4 , typ : TypeVarchar },
188158 },
189- }, {
190- Keyspace : "system" ,
191- Table : "local" ,
192- Name : "truncated_at" ,
193- TypeInfo : CollectionType {
194- NativeType : NativeType {proto : protoVersion4 , typ : TypeMap },
195-
196- Key : NativeType {proto : protoVersion4 , typ : TypeUUID },
197- Elem : NativeType {proto : protoVersion4 , typ : TypeBlob },
198- },
199159 }},
200160}
201161
202162var systemPeersResultMetadata = resultMetadata {
203163 flags : 0 ,
204164 pagingState : []byte {},
205- actualColCount : 10 ,
165+ actualColCount : 9 ,
206166 columns : []ColumnInfo {{
207167 Keyspace : "system" ,
208- Table : "local " ,
168+ Table : "peers " ,
209169 Name : "peer" ,
210170 TypeInfo : NativeType {proto : protoVersion4 , typ : TypeInet },
211171 }, {
212172 Keyspace : "system" ,
213- Table : "local " ,
173+ Table : "peers " ,
214174 Name : "data_center" ,
215175 TypeInfo : NativeType {proto : protoVersion4 , typ : TypeVarchar },
216176 }, {
217177 Keyspace : "system" ,
218- Table : "local " ,
178+ Table : "peers " ,
219179 Name : "host_id" ,
220180 TypeInfo : NativeType {proto : protoVersion4 , typ : TypeUUID },
221181 }, {
222182 Keyspace : "system" ,
223- Table : "local " ,
183+ Table : "peers " ,
224184 Name : "preferred_ip" ,
225185 TypeInfo : NativeType {proto : protoVersion4 , typ : TypeInet },
226186 }, {
227187 Keyspace : "system" ,
228- Table : "local " ,
188+ Table : "peers " ,
229189 Name : "rack" ,
230190 TypeInfo : NativeType {proto : protoVersion4 , typ : TypeVarchar },
231191 }, {
232192 Keyspace : "system" ,
233- Table : "local " ,
193+ Table : "peers " ,
234194 Name : "release_version" ,
235195 TypeInfo : NativeType {proto : protoVersion4 , typ : TypeVarchar },
236196 }, {
237197 Keyspace : "system" ,
238- Table : "local " ,
198+ Table : "peers " ,
239199 Name : "rpc_address" ,
240200 TypeInfo : NativeType {proto : protoVersion4 , typ : TypeInet },
241201 }, {
242202 Keyspace : "system" ,
243- Table : "local " ,
203+ Table : "peers " ,
244204 Name : "schema_version" ,
245205 TypeInfo : NativeType {proto : protoVersion4 , typ : TypeUUID },
246206 }, {
247207 Keyspace : "system" ,
248- Table : "local" ,
249- Name : "supported_features" ,
250- TypeInfo : NativeType {proto : protoVersion4 , typ : TypeVarchar },
251- }, {
252- Keyspace : "system" ,
253- Table : "local" ,
208+ Table : "peers" ,
254209 Name : "tokens" ,
255210 TypeInfo : CollectionType {
256211 NativeType : NativeType {proto : protoVersion4 , typ : TypeSet },
@@ -260,18 +215,22 @@ var systemPeersResultMetadata = resultMetadata{
260215}
261216
262217func (* mockConnection ) querySystem (ctx context.Context , query string , values ... interface {}) * Iter {
263- localData := []interface {}{"local" , "COMPLETED" , net .IPv4 (192 , 168 , 100 , 12 ), "" , "3.3.1" , "datacenter1" , 1733834239 , ParseUUIDMust ("045859a7-6b9f-4efd-a5e7-acd64a295e13" ), net .IPv4 (192 , 168 , 100 , 12 ), "4" , "org.apache.cassandra.dht.Murmur3Partitioner" , "rack1" , "3.0.8" , net .IPv4 (192 , 168 , 100 , 12 ), ParseUUIDMust ("daf4df2c-b708-11ef-5c25-3004361afd71" ), "" , []string {}, map [UUID ]byte {}}
264- peerData1 := []interface {}{net .IPv4 (192 , 168 , 100 , 13 ), "datacenter1" , ParseUUIDMust ("b953309f-6e68-41f2-baf5-0e60da317a9c" ), net.IP {}, "rack1" , "3.0.8" , net .IPv4 (192 , 168 , 100 , 13 ), ParseUUIDMust ("b6ed5bde-b318-11ef-8f58-aeba19e31273" ), "" , []string {"-1032311531684407545" , "-1112089412567859825" }}
265- peerData2 := []interface {}{net .IPv4 (192 , 168 , 100 , 14 ), "datacenter1" , ParseUUIDMust ("8269e111-ea38-44bd-a73f-9d3d12cfaf78" ), net.IP {}, "rack1" , "3.0.8" , net .IPv4 (192 , 168 , 100 , 14 ), ParseUUIDMust ("b6ed5bde-b318-11ef-8f58-aeba19e31273" ), "" , []string {}}
266-
267- if query == "SELECT * FROM system.local WHERE key='local'" {
218+ // Column order matches the explicit SELECT in qrySystemLocal:
219+ // broadcast_address, cluster_name, data_center, host_id, listen_address, partitioner, rack, release_version, rpc_address, schema_version, tokens
220+ localData := []interface {}{net .IPv4 (192 , 168 , 100 , 12 ), "" , "datacenter1" , ParseUUIDMust ("045859a7-6b9f-4efd-a5e7-acd64a295e13" ), net .IPv4 (192 , 168 , 100 , 12 ), "org.apache.cassandra.dht.Murmur3Partitioner" , "rack1" , "3.0.8" , net .IPv4 (192 , 168 , 100 , 12 ), ParseUUIDMust ("daf4df2c-b708-11ef-5c25-3004361afd71" ), []string {}}
221+ // Column order matches the explicit SELECT in qrySystemPeersCassandra:
222+ // peer, data_center, host_id, preferred_ip, rack, release_version, rpc_address, schema_version, tokens
223+ peerData1 := []interface {}{net .IPv4 (192 , 168 , 100 , 13 ), "datacenter1" , ParseUUIDMust ("b953309f-6e68-41f2-baf5-0e60da317a9c" ), net.IP {}, "rack1" , "3.0.8" , net .IPv4 (192 , 168 , 100 , 13 ), ParseUUIDMust ("b6ed5bde-b318-11ef-8f58-aeba19e31273" ), []string {"-1032311531684407545" , "-1112089412567859825" }}
224+ peerData2 := []interface {}{net .IPv4 (192 , 168 , 100 , 14 ), "datacenter1" , ParseUUIDMust ("8269e111-ea38-44bd-a73f-9d3d12cfaf78" ), net.IP {}, "rack1" , "3.0.8" , net .IPv4 (192 , 168 , 100 , 14 ), ParseUUIDMust ("b6ed5bde-b318-11ef-8f58-aeba19e31273" ), []string {}}
225+
226+ if query == qrySystemLocal {
268227 return & Iter {
269228 meta : systemLocalResultMetadata ,
270229 framer : & mock.MockFramer {Data : marshalMetadataMust (systemLocalResultMetadata , localData )},
271230 numRows : 1 ,
272231 next : nil ,
273232 }
274- } else if query == "SELECT * FROM system.peers" {
233+ } else if query == qrySystemPeersCassandra {
275234 return & Iter {
276235 meta : systemPeersResultMetadata ,
277236 framer : & mock.MockFramer {Data : append (marshalMetadataMust (systemPeersResultMetadata , peerData1 ), marshalMetadataMust (systemPeersResultMetadata , peerData2 )... )},
@@ -284,6 +243,7 @@ func (*mockConnection) querySystem(ctx context.Context, query string, values ...
284243
285244func (* mockConnection ) getIsSchemaV2 () bool { return false }
286245func (* mockConnection ) setSchemaV2 (s bool ) {}
246+ func (* mockConnection ) isScyllaConn () bool { return false }
287247func (* mockConnection ) getScyllaSupported () ScyllaConnectionFeatures {
288248 return ScyllaConnectionFeatures {}
289249}
0 commit comments