Elffuss BraidHub

kikocis/java-driver public

Fix table and UDT parsing on whole schema refresh (JAVA-782).
Changesetd9afbf74ecb325c0b3386640d3ba7986727bbb3cf850c4ba5a59f820ca40a211
Authorolim7t <omichallat+github@gmail.com> · 2015-05-21 17:43 +02:00
Committerolim7t <omichallat+github@gmail.com> · 2015-05-21 17:45 +02:00
Parentse8f426346b04

Browse the files at this changeset

1 file changed

modified driver-core/src/main/java/com/datastax/driver/core/ControlConnection.java +6 −5
@@ -336,16 +336,17 @@
336336 whereClause += " AND type_name = '" + targetName + '\'';
337337 }
338338
339- DefaultResultSetFuture ksFuture = (targetType == null || targetType == KEYSPACE)
339+ boolean isSchemaOrKeyspace = (targetType == null || targetType == KEYSPACE);
340+ DefaultResultSetFuture ksFuture = isSchemaOrKeyspace
340341 ? new DefaultResultSetFuture(null, cluster.protocolVersion(), new Requests.Query(SELECT_KEYSPACES + whereClause))
341342 : null;
342- DefaultResultSetFuture udtFuture = (targetType == KEYSPACE && supportsUdts(cassandraVersion) || targetType == TYPE)
343+ DefaultResultSetFuture udtFuture = (isSchemaOrKeyspace && supportsUdts(cassandraVersion) || targetType == TYPE)
343344 ? new DefaultResultSetFuture(null, cluster.protocolVersion(), new Requests.Query(SELECT_USERTYPES + whereClause))
344345 : null;
345- DefaultResultSetFuture cfFuture = (targetType == KEYSPACE || targetType == TABLE)
346+ DefaultResultSetFuture cfFuture = (isSchemaOrKeyspace || targetType == TABLE)
346347 ? new DefaultResultSetFuture(null, cluster.protocolVersion(), new Requests.Query(SELECT_COLUMN_FAMILIES + whereClause))
347348 : null;
348- DefaultResultSetFuture colsFuture = (targetType == KEYSPACE || targetType == TABLE)
349+ DefaultResultSetFuture colsFuture = (isSchemaOrKeyspace || targetType == TABLE)
349350 ? new DefaultResultSetFuture(null, cluster.protocolVersion(), new Requests.Query(SELECT_COLUMNS + whereClause))
350351 : null;
351352
@@ -374,7 +375,7 @@
374375
375376 // If we rebuild all from scratch or have an updated keyspace, rebuild the token map since some replication on some keyspace
376377 // may have changed
377- if (targetType == null || targetType == KEYSPACE)
378+ if (isSchemaOrKeyspace)
378379 refreshNodeListAndTokenMap(connection, cluster, false, false);
379380 }
380381