This is an automated email from the ASF dual-hosted git repository.

blerer pushed a commit to branch cep-21-tcm-review
in repository https://gitbox.apache.org/repos/asf/cassandra.git

commit 821916e60448561c0266e89900b12159e63fd267
Author: Benjamin Lerer <[email protected]>
AuthorDate: Tue Oct 24 15:46:39 2023 +0200

    add javadoc
---
 .../cassandra/schema/DistributedMetadataLogKeyspace.java    |  1 -
 src/java/org/apache/cassandra/tcm/Commit.java               | 13 +++++++++++++
 src/java/org/apache/cassandra/tcm/Startup.java              |  6 ++++--
 src/java/org/apache/cassandra/tcm/log/Entry.java            |  9 +++++++++
 4 files changed, 26 insertions(+), 3 deletions(-)

diff --git 
a/src/java/org/apache/cassandra/schema/DistributedMetadataLogKeyspace.java 
b/src/java/org/apache/cassandra/schema/DistributedMetadataLogKeyspace.java
index 74b0e4bb73..de57f563b8 100644
--- a/src/java/org/apache/cassandra/schema/DistributedMetadataLogKeyspace.java
+++ b/src/java/org/apache/cassandra/schema/DistributedMetadataLogKeyspace.java
@@ -22,7 +22,6 @@ import java.io.IOException;
 import java.nio.ByteBuffer;
 
 import com.google.common.annotations.VisibleForTesting;
-import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSortedSet;
 import org.slf4j.Logger;
diff --git a/src/java/org/apache/cassandra/tcm/Commit.java 
b/src/java/org/apache/cassandra/tcm/Commit.java
index 76e2cb3390..2e7fbda8d1 100644
--- a/src/java/org/apache/cassandra/tcm/Commit.java
+++ b/src/java/org/apache/cassandra/tcm/Commit.java
@@ -45,6 +45,10 @@ import org.apache.cassandra.utils.vint.VIntCoding;
 
 import static org.apache.cassandra.tcm.ClusterMetadataService.State.*;
 
+/**
+ * Commit request send by a {@code RemoteProcessor} from a non-CMS node.
+ *
+ */
 public class Commit
 {
     private static final Logger logger = LoggerFactory.getLogger(Commit.class);
@@ -300,6 +304,10 @@ public class Commit
         return new Handler(processor, replicator, messagingService, () -> 
LOCAL);
     }
 
+    /**
+     * Handler in charge of performing the commit to the distributed log. If 
the node is not a CMS member the query
+     * will be rejected with a {@code NotCMSException}.
+     */
     static class Handler implements IVerbHandler<Commit>
     {
         private final Processor processor;
@@ -342,6 +350,11 @@ public class Commit
             }
         }
 
+        /**
+         * Checks that the node is part of the CMS.
+         * @throws NotCMSException if the node is not member of the CMS.
+         * @throws IllegalStateException if the state is an unexpected one.
+         */
         private void checkCMSState()
         {
             switch (cmsStateSupplier.get())
diff --git a/src/java/org/apache/cassandra/tcm/Startup.java 
b/src/java/org/apache/cassandra/tcm/Startup.java
index b341eafd05..cd2bac48bb 100644
--- a/src/java/org/apache/cassandra/tcm/Startup.java
+++ b/src/java/org/apache/cassandra/tcm/Startup.java
@@ -85,6 +85,8 @@ public class Startup
                 initMessaging.run();
                 break;
             case VOTE:
+                // Usual case. The node will initialize itself as a non-CMS 
node and will attempt to discover an existing CMS service or,
+                // failing that, will participate in a vote to establish a new 
one with other discovered participants.
                 logger.info("Initializing for discovery");
                 initializeAsNonCmsNode(wrapProcessor);
                 initializeForDiscovery(initMessaging);
@@ -300,7 +302,7 @@ public class Startup
         /**
          * Whether this node becomes a member of CMS or not is determined by 
the election procedure (see {@link Election}).
          * This startup mode is selected when the node was not started before, 
and it does not satisfy the conditions
-         * for {@link #FIRST_CMS}.
+         * for {@link #FIRST_CMS}. {@code VOTE} is usually the default startup 
mode.
          */
         VOTE,
 
@@ -314,7 +316,7 @@ public class Startup
 
         /**
          * The node will use the existing {@code ClusterMetadata} provided 
through a file - it happens when
-         * {@link 
CassandraRelevantProperties.TCM_UNSAFE_BOOT_WITH_CLUSTERMETADATA} is set.
+         * {@link 
CassandraRelevantProperties#TCM_UNSAFE_BOOT_WITH_CLUSTERMETADATA} is set.
          */
         BOOT_WITH_CLUSTERMETADATA;
 
diff --git a/src/java/org/apache/cassandra/tcm/log/Entry.java 
b/src/java/org/apache/cassandra/tcm/log/Entry.java
index 588480132a..a5186a6dbe 100644
--- a/src/java/org/apache/cassandra/tcm/log/Entry.java
+++ b/src/java/org/apache/cassandra/tcm/log/Entry.java
@@ -178,9 +178,17 @@ public class Entry implements Comparable<Entry>
         }
     }
 
+    /**
+     * {@code Entry.ID} supplier that generate IDs from the node address 
(encoded on the 4 most significant bytes) and
+     * from a counter initialized from the clock current time in millis and 
incremented on request (encoded on the 4 least significant bytes).
+     */
     public static class DefaultEntryIdGen implements Supplier<Id>
     {
         private final AtomicLong counter = new 
AtomicLong(Clock.Global.currentTimeMillis() & 0x00000000ffffffffL);
+
+        /**
+         * The address component of the generated IDs.
+         */
         private final long addrComponent;
 
         public DefaultEntryIdGen()
@@ -198,6 +206,7 @@ public class Entry implements Comparable<Entry>
             this.addrComponent = addrComponent << Integer.SIZE;
         }
 
+        @Override
         public Id get()
         {
             return new Id(addrComponent | counter.getAndIncrement());


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to