This is an automated email from the ASF dual-hosted git repository. adelapena pushed a commit to branch cassandra-3.0 in repository https://gitbox.apache.org/repos/asf/cassandra.git
commit 08be5e0c54c84e2828a91ae060c88fb2ebc9354f Merge: f35ab19 d3e48e4 Author: Andrés de la Peña <a.penya.gar...@gmail.com> AuthorDate: Mon Feb 1 17:23:37 2021 +0000 Merge branch 'cassandra-2.2' into cassandra-3.0 # Conflicts: # CHANGES.txt # src/java/org/apache/cassandra/locator/TokenMetadata.java CHANGES.txt | 2 ++ .../apache/cassandra/locator/TokenMetadata.java | 40 ++++++++++++++++++---- .../cassandra/locator/TokenMetadataTest.java | 24 +++++++++++++ 3 files changed, 59 insertions(+), 7 deletions(-) diff --cc CHANGES.txt index 37ddf28,36a244a..da8ceaa --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,24 -1,5 +1,26 @@@ -2.2.20 +3.0.25: ++Merged from 2.2: + * Make TokenMetadata's ring version increments atomic (CASSANDRA-16286) + + +3.0.24: + * Prevent unbounded number of pending flushing tasks; Add PendingFlushTasks metric (CASSANDRA-16261) + * Improve empty hint file handling during startup (CASSANDRA-16162) + * Allow empty string in collections with COPY FROM in cqlsh (CASSANDRA-16372) + * Fix skipping on pre-3.0 created compact storage sstables due to missing primary key liveness (CASSANDRA-16226) + * Fix DecimalDeserializer#toString OOM (CASSANDRA-14925) + * Extend the exclusion of replica filtering protection to other indices instead of just SASI (CASSANDRA-16311) + * Synchronize transaction logs for JBOD (CASSANDRA-16225) + * Fix the counting of cells per partition (CASSANDRA-16259) + * Fix serial read/non-applying CAS linearizability (CASSANDRA-12126) + * Avoid potential NPE in JVMStabilityInspector (CASSANDRA-16294) + * Improved check of num_tokens against the length of initial_token (CASSANDRA-14477) + * Fix a race condition on ColumnFamilyStore and TableMetrics (CASSANDRA-16228) + * Remove the SEPExecutor blocking behavior (CASSANDRA-16186) + * Wait for schema agreement when bootstrapping (CASSANDRA-15158) + * Fix invalid cell value skipping when reading from disk (CASSANDRA-16223) + * Prevent invoking enable/disable gossip when not in NORMAL (CASSANDRA-16146) +Merged from 2.2: * Remove OpenJDK log warning (CASSANDRA-15563) * Fix the histogram merge of the table metrics (CASSANDRA-16259) diff --cc src/java/org/apache/cassandra/locator/TokenMetadata.java index 3978eeb,44eb925..da5f5e3 --- a/src/java/org/apache/cassandra/locator/TokenMetadata.java +++ b/src/java/org/apache/cassandra/locator/TokenMetadata.java @@@ -26,7 -26,9 +26,9 @@@ import java.util.concurrent.atomic.Atom import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; + import javax.annotation.concurrent.GuardedBy; + -import com.google.common.base.Optional; +import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.*; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; @@@ -495,9 -465,8 +498,9 @@@ public class TokenMetadat try { logger.info("Updating topology for {}", endpoint); - topology.updateEndpoint(endpoint); + topology = topology.unbuild().updateEndpoint(endpoint).build(); - invalidateCachedRings(); + invalidateCachedRingsUnsafe(); + return topology; } finally { @@@ -515,9 -484,8 +518,9 @@@ try { logger.info("Updating topology for all endpoints that have changed"); - topology.updateEndpoints(); + topology = topology.unbuild().updateEndpoints().build(); - invalidateCachedRings(); + invalidateCachedRingsUnsafe(); + return topology; } finally { @@@ -1133,8 -1090,8 +1136,8 @@@ pendingRanges.clear(); movingEndpoints.clear(); sortedTokens.clear(); - topology.clear(); + topology = Topology.empty(); - invalidateCachedRings(); + invalidateCachedRingsUnsafe(); } finally { diff --cc test/unit/org/apache/cassandra/locator/TokenMetadataTest.java index dab7082,6cd5180..0ec8eeb --- a/test/unit/org/apache/cassandra/locator/TokenMetadataTest.java +++ b/test/unit/org/apache/cassandra/locator/TokenMetadataTest.java @@@ -21,8 -22,10 +21,11 @@@ import java.net.InetAddress import java.net.UnknownHostException; import java.util.ArrayList; import java.util.Map; + import java.util.concurrent.ExecutorService; + import java.util.concurrent.Executors; + import java.util.concurrent.TimeUnit; +import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.Iterators; import com.google.common.collect.Multimap; @@@ -68,6 -70,33 +71,27 @@@ public class TokenMetadataTes assertEquals("Mismatch at index " + i + ": " + actual, token(expected[i]), actual.get(i)); } + /** + * This test is very likely (but not guaranteed) to fail if ring invalidations are ever allowed to interleave. + */ + @Test + public void testConcurrentInvalidation() throws InterruptedException + { + long startVersion = tmd.getRingVersion(); + + ExecutorService pool = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() + 1); + + int invalidations = 1024; + + for (int i = 0; i < invalidations; i++) - pool.execute(new Runnable() - { - public void run() - { - tmd.invalidateCachedRings(); - } - }); ++ pool.execute(() -> tmd.invalidateCachedRings()); + + pool.shutdown(); + + assertTrue(pool.awaitTermination(30, TimeUnit.SECONDS)); + assertEquals(invalidations + startVersion, tmd.getRingVersion()); + } + @Test public void testRingIterator() { --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org