Skip to content

Commit b4d397c

Browse files
committed
Fix table and UDT parsing on whole schema refresh (JAVA-782).
1 parent c3ea6cd commit b4d397c

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

driver-core/src/main/java/com/datastax/driver/core/ControlConnection.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -336,16 +336,17 @@ else if (targetType == TYPE)
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 @@ else if (targetType == TYPE)
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

0 commit comments

Comments
 (0)