You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by GitBox <gi...@apache.org> on 2022/02/11 02:02:17 UTC

[GitHub] [cassandra] frankgh commented on a change in pull request #1376: CASSANDRA-17226: Consistency Level Considered Connectivity Checker

frankgh commented on a change in pull request #1376:
URL: https://github.com/apache/cassandra/pull/1376#discussion_r804310155



##########
File path: src/java/org/apache/cassandra/net/ConsistencyLevelStartupConnectivityChecker.java
##########
@@ -0,0 +1,442 @@
+/*
+ * 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.net;
+
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Function;
+import java.util.function.ToIntFunction;
+import java.util.stream.Stream;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.ArrayListMultimap;
+import com.google.common.collect.Multimap;
+
+import org.apache.cassandra.config.DatabaseDescriptor;
+import org.apache.cassandra.db.ConsistencyLevel;
+import org.apache.cassandra.dht.Token;
+import org.apache.cassandra.locator.InetAddressAndPort;
+import org.apache.cassandra.locator.NetworkTopologyStrategy;
+import org.apache.cassandra.schema.Schema;
+import org.apache.cassandra.service.StorageService;
+import org.apache.cassandra.utils.concurrent.CountDownLatch;
+
+import static java.util.stream.Collectors.groupingBy;
+import static org.apache.cassandra.utils.concurrent.CountDownLatch.newCountDownLatch;
+
+
+/**
+ * A {@link StartupConnectivityChecker} implementation that based on the configured {@link ConsistencyLevel} to
+ * determine how many peers in the local datacenter or all datacenters to wait for before it is ready to advertise to clients.
+ * The lowest non-zero replication factor among all user keyspaces is used to determine the quorum.
+ *
+ * <p>The checker breaks the check into 2 phases.
+ * 1. In phase one, it checks if the primary set of peers has connected.
+ * 2. In phase two, it sends additional ping messages to the rest of the peers and check if the connected peers can satisfy
+ *    the specified consistency level at the end.
+ *
+ * <p>Supported values for {@code blockForPeersConsistencyLevel} are:
+ * <ul>
+ *     <li>ALL
+ *     <li>QUORUM
+ *     <li>LOCAL_QUORUM
+ *     <li>EACH_QUORUM
+ * </ul>
+ *
+ * <p>The checker only supports the {@link NetworkTopologyStrategy}. The checker is not suitable when using vnodes.
+ */
+public class ConsistencyLevelStartupConnectivityChecker
+extends AbstractStartupConnectivityChecker
+{

Review comment:
       Thanks for your review @clohfink. The drawback with this approach is that it does not establish small/large connections for the checks. Without those checks, we can only prevent unavailables and not timeouts.




-- 
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: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org