maedhroz commented on code in PR #3305:
URL: https://github.com/apache/cassandra/pull/3305#discussion_r1611873055
##########
src/java/org/apache/cassandra/db/virtual/AccordVirtualTables.java:
##########
@@ -73,6 +90,88 @@ public DataSet data()
}
}
+ public static final class CommandStoreCache extends AbstractVirtualTable
+ {
+ private CommandStoreCache(String keyspace)
+ {
+ super(parse(keyspace,
+ "Accord Command Store Cache Metrics",
+ "CREATE TABLE accord_command_store_cache(\n" +
+ " id int,\n" +
+ " queries bigint,\n" +
+ " hits bigint,\n" +
+ " misses bigint,\n" +
+ " PRIMARY KEY (id)" +
+ ')'));
+ }
+
+ @Override
+ public DataSet data()
+ {
+ AccordService accord = (AccordService) AccordService.instance();
+ SimpleDataSet result = new SimpleDataSet(metadata());
+
+ Map<Integer, AccordStateCache.ImmutableStats> statsByStore =
+ accord.node().commandStores().map(PreLoadContext.empty(),
+ store ->
((AccordCommandStore) store.commandStore()).cache().stats());
+
+ for (Map.Entry<Integer, AccordStateCache.ImmutableStats> stats :
statsByStore.entrySet())
+ {
+ result.row(stats.getKey());
+ result.column("queries", stats.getValue().queries);
+ result.column("hits", stats.getValue().hits);
+ result.column("misses", stats.getValue().misses);
+ }
+
+ return result;
+ }
+ }
+
+ public static final class MigrationStates extends AbstractVirtualTable
+ {
+ private MigrationStates(String keyspace)
+ {
+ super(parse(keyspace,
+ "Accord Migration State",
+ "CREATE TABLE accord_migration_state(\n" +
+ " keyspace_name text,\n" +
+ " table_name text,\n" +
+ " table_id uuid,\n" +
+ " target_protocol text,\n" +
+ " migrated_ranges text,\n" +
+ " migrating_ranges_by_epoch text,\n" +
+ " PRIMARY KEY (keyspace_name, table_name)" +
+ ')'));
+ }
+
+ @Override
+ public DataSet data()
+ {
+ SimpleDataSet result = new SimpleDataSet(metadata());
+
+ ClusterMetadata cm = ClusterMetadata.current();
+ ConsensusMigrationState snapshot = cm.consensusMigrationState;
+
+ for (TableMigrationState state : snapshot.tableStates())
+ {
+ result.row(state.keyspaceName, state.tableName);
+ result.column("table_id", state.tableId.asUUID());
+ result.column("target_protocol",
state.targetProtocol.toString());
+
+ List<String> primitiveMigratedRanges =
state.migratedRanges.stream().map(Objects::toString).collect(toImmutableList());
+ result.column("migrated_ranges",
PojoToString.pojoToString(primitiveMigratedRanges, "MINIFIED-JSON"));
Review Comment:
Yeah, this and the comment for `migrating_ranges_by_epoch` make sense. Let's
try frozen collections instead...
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]