belliottsmith commented on code in PR #4460:
URL: https://github.com/apache/cassandra/pull/4460#discussion_r2486259248
##########
src/java/org/apache/cassandra/db/virtual/AccordDebugKeyspace.java:
##########
@@ -663,6 +676,97 @@ private static void addRow(PartitionsCollector collector,
int executorId, String
}
}
+ public static final class ListenersDepsTable extends
AbstractLazyVirtualTable
+ {
+ private ListenersDepsTable()
+ {
+ super(parse(VIRTUAL_ACCORD_DEBUG, LISTENERS_DEPS,
+ "Accord Txn Dependency Listeners",
+ "CREATE TABLE %s (\n" +
+ " command_store_id int,\n" +
+ " waiting_on 'TxnIdUtf8Type',\n" +
+ " waiting_until text,\n" +
+ " waiter 'TxnIdUtf8Type',\n" +
+ " PRIMARY KEY (command_store_id, waiting_on,
waiting_until, waiter)" +
+ ')', Int32Type.instance), FAIL, UNSORTED, ASC);
+ }
+
+ @Override
+ public void collect(PartitionsCollector collector)
+ {
+ AccordCommandStores stores = (AccordCommandStores)
AccordService.unsafeInstance().node().commandStores();
+ Object[] pk = collector.singlePartitionKey();
+ if (pk != null)
+ {
+ CommandStore commandStore = stores.forId((Integer)pk[0]);
+ if (commandStore != null)
+ addPartition(commandStore, collector);
+ return;
+ }
+ stores.forAllUnsafe(commandStore -> addPartition(commandStore,
collector));
+ }
+
+ private void addPartition(CommandStore commandStore,
PartitionsCollector collector)
+ {
+ collector.partition(commandStore.id())
+ .collect(rows -> {
+ // TODO (desired): support maybe execute immediately
with safeStore
+
AccordService.getBlocking(commandStore.chain((PreLoadContext.Empty)
metadata::toString, safeStore -> { addRows(safeStore, rows); }));
+ });
+ }
+
+ private void addRows(SafeCommandStore safeStore, RowsCollector rows)
+ {
+ LocalListeners listeners =
safeStore.commandStore().unsafeGetListeners();
+ for (LocalListeners.TxnListener listener :
listeners.txnListeners())
+ rows.add(listener.waitingOn.toString(),
listener.awaitingStatus.name(), listener.waiter.toString())
+ .eagerCollect(ignore -> {});
+ }
+ }
+
+ public static final class ListenersLocalTable extends
AbstractLazyVirtualTable
+ {
+ private ListenersLocalTable()
+ {
+ super(parse(VIRTUAL_ACCORD_DEBUG, LISTENERS_LOCAL,
+ "Accord Local Listeners",
+ "CREATE TABLE %s (\n" +
+ " command_store_id int,\n" +
+ " waiting_on 'TxnIdUtf8Type',\n" +
+ " waiter text,\n" +
+ " PRIMARY KEY (command_store_id, waiting_on, waiter)"
+
Review Comment:
Otherwise I would need to make waiter a set<text> I think?
--
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]