cassandra-pr mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <>
Subject [GitHub] [cassandra] dcapwell commented on a change in pull request #575: CASSANDRA-15776 port test_refresh_size_estimates_clears_invalid_entries to jvm dtest and fixed bug where size_estimates isn't used for clearing tables
Date Thu, 07 May 2020 17:26:14 GMT

dcapwell commented on a change in pull request #575:

File path: src/java/org/apache/cassandra/db/
@@ -1344,12 +1344,17 @@ public static void clearEstimates(String keyspace)
     public static synchronized SetMultimap<String, String> getTablesWithSizeEstimates()
         SetMultimap<String, String> keyspaceTableMap = HashMultimap.create();
-        String cql = String.format("SELECT keyspace_name, table_name FROM %s", TableEstimates.toString(),
-        UntypedResultSet rs = executeInternal(cql);
-        for (UntypedResultSet.Row row : rs)
+        // Its possible that size_estimates knows about a different set of keyspace/tables
than table_estimates (mostly
+        // caused by external systems modifying the tables, such as dtest) so query both
+        for (String cql : Arrays.asList(
+            "SELECT keyspace_name, table_name FROM " + TableEstimates.toString(),
+            "SELECT keyspace_name, table_name FROM " + LegacySizeEstimates.toString()))

Review comment:
       @nastra not sure I agree with the comment that toString is less obvious, is there a
reason you say that?  In this case we don't care about quoting since it is known, but the
`TableMetadata.toString` is a safer way to do this in general, so should be the new norm (in
my opinion) rather than the common `format("%s.%s", ks_name, name)` (which is unsafe in general).

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message