dcapwell commented on code in PR #3877:
URL: https://github.com/apache/cassandra/pull/3877#discussion_r1945305595
##########
src/java/org/apache/cassandra/db/virtual/AccordVirtualTables.java:
##########
@@ -21,28 +21,94 @@
import java.util.Collections;
import java.util.List;
+import accord.api.ConfigurationService;
+import accord.topology.TopologyManager;
+import accord.utils.async.AsyncResult;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.cql3.statements.schema.CreateTableStatement;
+import org.apache.cassandra.db.marshal.LongType;
+import org.apache.cassandra.dht.LocalPartitioner;
import org.apache.cassandra.schema.TableMetadata;
+import org.apache.cassandra.service.accord.AccordService;
public class AccordVirtualTables
{
- private AccordVirtualTables() {}
+ private AccordVirtualTables()
+ {
+ }
public static Collection<VirtualTable> getAll(String keyspace)
{
if (!DatabaseDescriptor.getAccordTransactionsEnabled())
return Collections.emptyList();
- return List.of(
+ return List.of(new EpochTable(keyspace)
);
}
- private static TableMetadata parse(String keyspace, String comment, String
query)
+ private static TableMetadata.Builder parse(String keyspace, String query)
{
return CreateTableStatement.parse(query, keyspace)
- .comment(comment)
- .kind(TableMetadata.Kind.VIRTUAL)
- .build();
+ .kind(TableMetadata.Kind.VIRTUAL);
+ }
+
+ public static class EpochTable extends AbstractVirtualTable
+ {
+ public EpochTable(String keyspace)
+ {
+ super(parse(keyspace, "CREATE TABLE accord_epoch (\n" +
+ " epoch bigint PRIMARY KEY,\n" +
+ " ready_metadata text,\n" +
+ " ready_coordinate text,\n" +
+ " ready_data text,\n" +
+ " ready_reads text,\n" +
+ " ready boolean,\n" +
+ ")")
+ .partitioner(new LocalPartitioner(LongType.instance))
+ .comment("Exposes the epoch state for recieved epochs in
Accord")
+ .build());
+ }
+
+ @Override
+ public DataSet data()
+ {
+ // This table focuses on epochs that have already been received
and does not include inflight epochs nor does it include acknowledge status.
+ AccordService service = (AccordService) AccordService.instance();
Review Comment:
this is safe as the table doesn't exist when accord is disabled
--
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]