This is an automated email from the ASF dual-hosted git repository.
jlewandowski pushed a commit to branch cep-21-tcm-review
in repository https://gitbox.apache.org/repos/asf/cassandra.git
The following commit(s) were added to refs/heads/cep-21-tcm-review by this push:
new 064f07b13d JAVADOC: Startup and Discovery
064f07b13d is described below
commit 064f07b13df7a9fd8b0a4b24a8d53fa290bbf2bf
Author: Jacek Lewandowski <[email protected]>
AuthorDate: Wed Oct 18 19:48:44 2023 +0200
JAVADOC: Startup and Discovery
---
src/java/org/apache/cassandra/tcm/Discovery.java | 8 ++++++
src/java/org/apache/cassandra/tcm/Startup.java | 34 +++++++++++++++++++++---
2 files changed, 38 insertions(+), 4 deletions(-)
diff --git a/src/java/org/apache/cassandra/tcm/Discovery.java
b/src/java/org/apache/cassandra/tcm/Discovery.java
index 5b94e328ae..992855de3c 100644
--- a/src/java/org/apache/cassandra/tcm/Discovery.java
+++ b/src/java/org/apache/cassandra/tcm/Discovery.java
@@ -67,6 +67,14 @@ public class Discovery
return discover(5);
}
+ /**
+ * The discovery process starts with the configured seeds - a message is
sent to them asking for the list of the
+ * known CMS members. If a seed node knows about CMS members, it responds
with a collection of only those nodes.
+ * Otherwise, the seed node responds with a collection of all known peers.
They are accumulated as new target
+ * nodes to query for CMS members in the next round. The process completes
when either:
+ * - a response containing the CMS members is received
+ * - a deadline or a specified maximum number of rounds is reached
+ */
public DiscoveredNodes discover(int rounds)
{
boolean res = state.compareAndSet(State.NOT_STARTED,
State.IN_PROGRESS);
diff --git a/src/java/org/apache/cassandra/tcm/Startup.java
b/src/java/org/apache/cassandra/tcm/Startup.java
index f52a21f9fd..b341eafd05 100644
--- a/src/java/org/apache/cassandra/tcm/Startup.java
+++ b/src/java/org/apache/cassandra/tcm/Startup.java
@@ -147,6 +147,17 @@ public class Startup
}
}
+ /**
+ * Discovers or elects CMS nodes and proceeds with the initialization.
+ * <p>
+ * First, the node tries to discover CMS members in the cluster (see
{@link Discovery#discover(int)}). If no CMS
+ * members could be found, the node either tries to elect itself as a CMS
member or waits for another node to
+ * do so (self-election is attempted in case the node's broadcast
address/port is the lowest among the discovered
+ * peers).
+ * <p>
+ * Then, the method keeps trying to fetch the log from any of the
discovered nodes until the log is fetched and
+ * some transformations are applied, which is indicated by increasing the
current epoch.
+ */
public static void initializeForDiscovery(Runnable initMessaging)
{
initMessaging.run();
@@ -275,20 +286,35 @@ public class Startup
enum StartupMode
{
/**
- * The node will initialize as a non-CMS node.
+ * The node will initialize as a non-CMS node. The startup mode is
selected when the node was started before
+ * and has witnessed some CMS transformations.
*/
NORMAL,
+
/**
- * The node will transition from the gossip protocol to CMS.
+ * The node will transition from the gossip protocol to CMS. The
startup mode is selected when the node was
+ * started before, but it has not witnessed any transformation yet.
*/
UPGRADE,
+
+ /**
+ * 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}.
+ */
VOTE,
+
/**
- * The node will start as the first node from the CMS
+ * The node will start as the first node from the CMS. The startup
mode is selected when the node was
+ * not started before, the only seed refers to this node, and the
listen address of this node is loopback.
+ * This startup mode is used for local development and CCM based
clusters where the only seed configured for
+ * the first node is self loopback address.
*/
FIRST_CMS,
+
/**
- * The node will use the existing {@code ClusterMetadata} provided
through a file
+ * The node will use the existing {@code ClusterMetadata} provided
through a file - it happens when
+ * {@link
CassandraRelevantProperties.TCM_UNSAFE_BOOT_WITH_CLUSTERMETADATA} is set.
*/
BOOT_WITH_CLUSTERMETADATA;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]