ifesdjeen commented on code in PR #4460:
URL: https://github.com/apache/cassandra/pull/4460#discussion_r2486668869
##########
src/java/org/apache/cassandra/db/virtual/AccordDebugKeyspace.java:
##########
@@ -1770,6 +1775,66 @@ private void cleanup(TxnId txnId, int commandStoreId,
Cleanup cleanup)
}
}
+ /**
+ * Write-only virtual table for updating Accord node states
+ */
+ public static final class NodeOpsTable extends
AbstractMutableLazyVirtualTable
+ {
+ // TODO (expected): test each of these operations
+ enum NodeOp
+ {
+ MARK_STALE("Mark the node as offline for an indeterminate period.
Peers will be allowed to garbage collect without involving the marked node, and
when it comes online it will need to rejoin the transaction log."),
+ UNMARK_STALE("Peers will no longer be allowed to garbage collect
without involving the node."),
+ MARK_HARD_REMOVED("EMERGENCY USE ONLY: Mark the node as
PERMANENTLY offline. It must be guaranteed not to respond at any future date.
If a quorum is marked HARD_REMOVED, the remaining replicas in a shard may
collectively make progress, though consistency violations are possible."),
+ ;
+
+ final String description;
+
+ NodeOp(String description)
+ {
+ this.description = description;
+ }
+ }
+ private NodeOpsTable()
+ {
+ super(parse(VIRTUAL_ACCORD_DEBUG, NODE_OPS,
+ "Update Accord Node State",
+ "CREATE TABLE %s (\n" +
+ " node_id int,\n" +
+ " op text," +
+ " PRIMARY KEY (node_id)" +
+ ')', Int32Type.instance), FAIL, UNSORTED);
+ }
+
+ @Override
+ protected void collect(PartitionsCollector collector)
+ {
+ throw new UnsupportedOperationException(NODE_OPS + " is a
write-only table");
+ }
+
+ @Override
+ protected void applyRowUpdate(Object[] partitionKeys, Object[]
clusteringKeys, ColumnMetadata[] columns, Object[] values)
+ {
+ NodeId nodeId = new NodeId((Integer) partitionKeys[0]);
+ Set<NodeId> nodeIds = Collections.singleton(nodeId);
+ NodeOp op = tryParse(values[0], true, NodeOp.class,
NodeOp::valueOf);
+
+ switch (op)
+ {
+ default: throw new UnhandledEnum(op);
+ case MARK_STALE:
+ AccordOperations.instance.accordMarkStale(nodeIds);
Review Comment:
Ah, true, it does:
```
if (!prev.directory.peerIds().contains(id))
```
thanks!
--
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]