dcapwell commented on code in PR #3662:
URL: https://github.com/apache/cassandra/pull/3662#discussion_r1837060671


##########
src/java/org/apache/cassandra/db/virtual/AccordDebugKeyspace.java:
##########
@@ -0,0 +1,671 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cassandra.db.virtual;
+
+import java.nio.ByteBuffer;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.collect.Sets;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import accord.api.RoutingKey;
+import accord.impl.DurabilityScheduling;
+import accord.impl.progresslog.DefaultProgressLog;
+import accord.impl.progresslog.TxnStateKind;
+import accord.local.CommandStores;
+import accord.local.DurableBefore;
+import accord.local.MaxConflicts;
+import accord.local.Node;
+import accord.local.RedundantBefore;
+import accord.local.RejectBefore;
+import accord.primitives.Routable;
+import accord.primitives.Status;
+import accord.primitives.Timestamp;
+import accord.primitives.Txn;
+import accord.primitives.TxnId;
+import accord.utils.Invariants;
+import accord.utils.async.AsyncChain;
+import org.apache.cassandra.cql3.statements.schema.CreateTableStatement;
+import org.apache.cassandra.db.ColumnFamilyStore;
+import org.apache.cassandra.db.DecoratedKey;
+import org.apache.cassandra.db.Keyspace;
+import org.apache.cassandra.db.marshal.ByteBufferAccessor;
+import org.apache.cassandra.db.marshal.Int32Type;
+import org.apache.cassandra.db.marshal.LongType;
+import org.apache.cassandra.db.marshal.TupleType;
+import org.apache.cassandra.db.marshal.UTF8Type;
+import org.apache.cassandra.db.marshal.UUIDType;
+import org.apache.cassandra.dht.Range;
+import org.apache.cassandra.dht.Token;
+import org.apache.cassandra.exceptions.InvalidRequestException;
+import org.apache.cassandra.schema.Schema;
+import org.apache.cassandra.schema.TableId;
+import org.apache.cassandra.schema.TableMetadata;
+import org.apache.cassandra.service.accord.AccordCommandStore;
+import org.apache.cassandra.service.accord.AccordKeyspace;
+import org.apache.cassandra.service.accord.AccordService;
+import org.apache.cassandra.service.accord.AccordStateCache;
+import org.apache.cassandra.service.accord.CommandStoreTxnBlockedGraph;
+import org.apache.cassandra.service.accord.api.AccordRoutingKey;
+import org.apache.cassandra.service.accord.api.AccordRoutingKey.TokenKey;
+import 
org.apache.cassandra.service.consensus.migration.ConsensusMigrationState;
+import org.apache.cassandra.service.consensus.migration.TableMigrationState;
+import org.apache.cassandra.tcm.ClusterMetadata;
+import org.apache.cassandra.utils.ByteBufferUtil;
+import org.apache.cassandra.utils.Pair;
+
+import static java.lang.String.format;
+import static java.util.Comparator.comparing;
+import static com.google.common.collect.ImmutableList.toImmutableList;
+import static accord.utils.async.AsyncChains.getBlockingAndRethrow;
+import static org.apache.cassandra.schema.SchemaConstants.VIRTUAL_ACCORD_DEBUG;
+import static org.apache.cassandra.utils.ByteBufferUtil.bytes;
+import static org.apache.cassandra.utils.MonotonicClock.Global.approxTime;
+
+public class AccordDebugKeyspace extends VirtualKeyspace
+{
+    // {epoch, hlc, flags, node}
+    private static final TupleType TIMESTAMP_TYPE =
+        new TupleType(List.of(LongType.instance, LongType.instance, 
Int32Type.instance, Int32Type.instance));
+    private static final String TIMESTAMP_TYPE_STRING = 
TIMESTAMP_TYPE.asCQL3Type().toString();
+
+    // {epoch, hlc, kind, domain, node}
+    private static final TupleType TXN_ID_TYPE =
+        new TupleType(List.of(LongType.instance, LongType.instance, 
UTF8Type.instance, UTF8Type.instance, Int32Type.instance));
+    private static final String TXN_ID_TYPE_STRING = 
TXN_ID_TYPE.asCQL3Type().toString();
+
+    // {table_id, token} or {table_id, +Inf/-Inf}
+    private static final TupleType ROUTING_KEY_TYPE = new 
TupleType(List.of(UUIDType.instance, UTF8Type.instance));
+    private static final String ROUTING_KEY_TYPE_STRING = 
ROUTING_KEY_TYPE.asCQL3Type().toString();
+
+    public static final AccordDebugKeyspace instance = new 
AccordDebugKeyspace();
+
+    private AccordDebugKeyspace()
+    {
+        super(VIRTUAL_ACCORD_DEBUG, List.of(

Review Comment:
   > How was it of value?
   
   It had the same value as the other nodetool commands we use to see what 
queries are actively running.  When I see user latencies start to regress or 
fall off a wall I have been using it to see what is going on and what is 
in-flight.
   
   > We could perhaps enrich the progress log home state to include information 
about active coordinations, including more useful information such as the phase 
we have reached. This would provide a more consistent means of monitoring this.
   
   I think we need a table that tells operators what is going on, and isn't 
expected to break in any random release... I agree this table has the 10s 
weakness you point out, but we need something.  If the progress log tables are 
expected to break w/e then we don't have the visibility we need.



-- 
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]

Reply via email to