From 8f692c04c0b9cf02550f3f01295f923678a46450 Mon Sep 17 00:00:00 2001 From: Eric Evans Date: Wed, 31 Aug 2011 20:20:36 +0000 Subject: [PATCH 01/17] update changelogs for 0.7.9 re-roll git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-0.7@1163795 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 5 +---- debian/changelog | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index c0d229e346..2b2ac22c88 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,7 +1,3 @@ -0.7.10 - * fix UnavailableException with writes at CL.EACH_QUORM (CASSANDRA-3084) - - 0.7.9 * don't include tmp files as sstable when create cfs (CASSANDRA-2929) * log Java classpath on startup (CASSANDRA-2895) @@ -14,6 +10,7 @@ * remove gossip state when a new IP takes over a token (CASSANDRA-3071) * work around native memory leak in com.sun.management.GarbageCollectorMXBean (CASSANDRA-2868, 3076) + * fix UnavailableException with writes at CL.EACH_QUORM (CASSANDRA-3084) 0.7.8 diff --git a/debian/changelog b/debian/changelog index a81056eab9..ed7aecb050 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,7 +2,7 @@ cassandra (0.7.9) unstable; urgency=low * New stable point release - -- Eric Evans Tue, 23 Aug 2011 14:53:39 -0500 + -- Eric Evans Wed, 31 Aug 2011 15:17:38 -0500 cassandra (0.7.8) unstable; urgency=low From a3324721ec66f62c32c4d3a9c209a9a0001c466b Mon Sep 17 00:00:00 2001 From: Jonathan Ellis Date: Tue, 13 Sep 2011 04:27:05 +0000 Subject: [PATCH 02/17] Remove special-cased maximum on sstables-to-compact for leveled strategy patch by jbellis; reviewed by bcoverston for CASSANDRA-3182 git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-1.0.0@1170030 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 2 +- .../org/apache/cassandra/db/compaction/LeveledManifest.java | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 2de2a757e2..6b89bc031f 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -44,7 +44,7 @@ Thrift<->Avro conversion methods (CASSANDRA-3032) * Add timeouts to client request schedulers (CASSANDRA-3079, 3096) * Cli to use hashes rather than array of hashes for strategy options (CASSANDRA-3081) - * LeveledCompactionStrategy (CASSANDRA-1608, 3085, 3110, 3087, 3145, 3154) + * LeveledCompactionStrategy (CASSANDRA-1608, 3085, 3110, 3087, 3145, 3154, 3182) * Improvements of the CLI `describe` command (CASSANDRA-2630) * reduce window where dropped CF sstables may not be deleted (CASSANDRA-2942) * Expose gossip/FD info to JMX (CASSANDRA-2806) diff --git a/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java b/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java index 20e7c01049..e2073b15ee 100644 --- a/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java +++ b/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java @@ -30,7 +30,6 @@ public class LeveledManifest private final List[] generations; private final DecoratedKey[] lastCompactedKeys; private final int maxSSTableSizeInMB; - private static int MAX_COMPACTING_L0 = 32; private LeveledManifest(ColumnFamilyStore cfs, int maxSSTableSizeInMB) { @@ -250,8 +249,6 @@ public class LeveledManifest { // pick a random sstable from L0, and any that overlap with it List L0 = overlapping(remaining.iterator().next(), remaining); - //but not too many, as we could run out of memory - L0 = L0.size() > MAX_COMPACTING_L0 ? L0.subList(0, MAX_COMPACTING_L0) : L0; // add the overlapping ones from L1 for (SSTableReader sstable : L0) { From 98ef2a06eb7e2085a4dcede16ff228a02231698a Mon Sep 17 00:00:00 2001 From: Sylvain Lebresne Date: Tue, 13 Sep 2011 12:30:58 +0000 Subject: [PATCH 03/17] Update generated POM's for Snappy and Lzf dependencies patch by stephenc; reviewed by slebresne for CASSANDRA-3184 git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-1.0.0@1170140 13f79535-47bb-0310-9956-ffa450edef68 --- build.xml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/build.xml b/build.xml index 1e0aab27fa..db3ccf96fa 100644 --- a/build.xml +++ b/build.xml @@ -25,8 +25,8 @@ - - + + @@ -348,6 +348,8 @@ url=${svn.entry.url}?pathrev=${svn.entry.commit.revision} + + @@ -457,6 +459,8 @@ url=${svn.entry.url}?pathrev=${svn.entry.commit.revision} artifactId="cassandra-parent" version="${version}"/> + + From abd78259e11305ffed0ae0391ef8da2a16d68210 Mon Sep 17 00:00:00 2001 From: Sylvain Lebresne Date: Tue, 13 Sep 2011 12:37:39 +0000 Subject: [PATCH 04/17] Retry upload to central repository patch by stephenc; reviewed by slebresne for CASSANDRA-2691 git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-0.7@1170147 13f79535-47bb-0310-9956-ffa450edef68 --- build.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.xml b/build.xml index cee4405788..c904d50c56 100644 --- a/build.xml +++ b/build.xml @@ -255,7 +255,8 @@ url=${svn.entry.url}?pathrev=${svn.entry.commit.revision} - + + From 5d0cb3a9219a080673e3b7fcb8c87ebf65cdb8ad Mon Sep 17 00:00:00 2001 From: Sylvain Lebresne Date: Tue, 13 Sep 2011 12:39:44 +0000 Subject: [PATCH 05/17] merge from 0.8 git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-1.0.0@1170149 13f79535-47bb-0310-9956-ffa450edef68 --- build.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.xml b/build.xml index db3ccf96fa..c9aceb6cd6 100644 --- a/build.xml +++ b/build.xml @@ -315,7 +315,8 @@ url=${svn.entry.url}?pathrev=${svn.entry.commit.revision} - + + From c2709ba27757e5aabee28ff5c7affd0f87164fd6 Mon Sep 17 00:00:00 2001 From: Jonathan Ellis Date: Tue, 13 Sep 2011 12:57:47 +0000 Subject: [PATCH 06/17] fix RRR NPE patch by jbellis; reviewed by slebresne for CASSANDRA-3192 git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-1.0.0@1170162 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 2 +- src/java/org/apache/cassandra/service/RowRepairResolver.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 6b89bc031f..289ed9363d 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -24,7 +24,7 @@ * use lazy initialization instead of class initialization in NodeId (CASSANDRA-2953) * add paging to get_count (CASSANDRA-2894) - * fix "short reads" in [multi]get (CASSANDRA-2643, 3157) + * fix "short reads" in [multi]get (CASSANDRA-2643, 3157, 3192) * add optional compression for sstables (CASSANDRA-47, 3001, 3128) * add scheduler JMX metrics (CASSANDRA-2962) * add block level checksum for compressed data (CASSANDRA-1717) diff --git a/src/java/org/apache/cassandra/service/RowRepairResolver.java b/src/java/org/apache/cassandra/service/RowRepairResolver.java index 2bd5bec132..e1d9df0032 100644 --- a/src/java/org/apache/cassandra/service/RowRepairResolver.java +++ b/src/java/org/apache/cassandra/service/RowRepairResolver.java @@ -79,7 +79,7 @@ public class RowRepairResolver extends AbstractRowResolver endpoints.add(message.getFrom()); // compute maxLiveColumns to prevent short reads -- see https://issues.apache.org/jira/browse/CASSANDRA-2643 - int liveColumns = cf.getLiveColumnCount(); + int liveColumns = cf == null ? 0 : cf.getLiveColumnCount(); if (liveColumns > maxLiveColumns) maxLiveColumns = liveColumns; } From 0d37eb1b6161c2231df16f3454a6c61819536107 Mon Sep 17 00:00:00 2001 From: Sylvain Lebresne Date: Tue, 13 Sep 2011 13:58:41 +0000 Subject: [PATCH 07/17] minor cleanups related to reference counting git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-1.0.0@1170184 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/cassandra/db/CollationController.java | 4 ++-- .../org/apache/cassandra/io/sstable/SSTableReader.java | 10 ++-------- .../apache/cassandra/streaming/StreamInSession.java | 4 +++- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/java/org/apache/cassandra/db/CollationController.java b/src/java/org/apache/cassandra/db/CollationController.java index 7f5c1d84cd..e08ffd858c 100644 --- a/src/java/org/apache/cassandra/db/CollationController.java +++ b/src/java/org/apache/cassandra/db/CollationController.java @@ -151,9 +151,9 @@ public class CollationController } finally { - SSTableReader.releaseReferences(view.sstables); for (IColumnIterator iter : iterators) FileUtils.closeQuietly(iter); + SSTableReader.releaseReferences(view.sstables); } } @@ -223,9 +223,9 @@ public class CollationController } finally { - SSTableReader.releaseReferences(view.sstables); for (IColumnIterator iter : iterators) FileUtils.closeQuietly(iter); + SSTableReader.releaseReferences(view.sstables); } } diff --git a/src/java/org/apache/cassandra/io/sstable/SSTableReader.java b/src/java/org/apache/cassandra/io/sstable/SSTableReader.java index e847ab55e9..2f8509097f 100644 --- a/src/java/org/apache/cassandra/io/sstable/SSTableReader.java +++ b/src/java/org/apache/cassandra/io/sstable/SSTableReader.java @@ -647,14 +647,8 @@ public class SSTableReader extends SSTable /** * Mark the sstable as compacted. - * When calling this function, the caller must ensure two things: - * - He must have acquired a reference with acquireReference() - * - He must ensure that the SSTableReader is not referenced anywhere except for threads holding a reference. - * - * The reason we ask caller to acquire a reference is because this greatly simplify the logic here. - * If that wasn't the case, markCompacted would have to deal with both the case where some thread still - * have references and the case where no thread have any reference. Making this logic thread-safe is a - * bit hard, so we make sure that at least the caller thread has a reference and delegate the rest to releaseRefence() + * When calling this function, the caller must ensure that the SSTableReader is not referenced anywhere + * except for threads holding a reference. */ public void markCompacted() { diff --git a/src/java/org/apache/cassandra/streaming/StreamInSession.java b/src/java/org/apache/cassandra/streaming/StreamInSession.java index 19d0d18464..ab025a4fe2 100644 --- a/src/java/org/apache/cassandra/streaming/StreamInSession.java +++ b/src/java/org/apache/cassandra/streaming/StreamInSession.java @@ -134,7 +134,9 @@ public class StreamInSession assert sstable.getTableName().equals(table); // Acquiring the reference (for secondary index building) before adding it makes sure we don't have to care about races - sstable.acquireReference(); + if (!sstable.acquireReference()) + throw new RuntimeException("We shouldn't fail acquiring a reference on a sstable that has just been transfered"); + referenced.add(sstable); ColumnFamilyStore cfs = Table.open(sstable.getTableName()).getColumnFamilyStore(sstable.getColumnFamilyName()); From cfa0394f083d367e761cefe50e81ee7d0b181eb7 Mon Sep 17 00:00:00 2001 From: Jonathan Ellis Date: Tue, 13 Sep 2011 15:36:26 +0000 Subject: [PATCH 08/17] add mention of commitlog_total_space_in_mb to NEWS git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-1.0.0@1170213 13f79535-47bb-0310-9956-ffa450edef68 --- NEWS.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/NEWS.txt b/NEWS.txt index 4e84792ba6..3484b60288 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -56,10 +56,10 @@ Other - The old per-ColumnFamily memtable thresholds (memtable_throughput_in_mb, memtable_operations_in_millions, memtable_flush_after_mins) are ignored, in favor of the global - memtable_total_space_in_mb setting. This does not affect client - compatibility -- the old options are still allowed, but have no - effect. These options may be removed entirely in a future - release. + memtable_total_space_in_mb and commitlog_total_space_in_mb settings. + This does not affect client compatibility -- the old options are + still allowed, but have no effect. These options may be removed + entirely in a future release. 0.8.5 From 2f998d02c587314a3539846a3fc35ff145daabfd Mon Sep 17 00:00:00 2001 From: Sylvain Lebresne Date: Tue, 13 Sep 2011 16:03:51 +0000 Subject: [PATCH 09/17] merge from 0.8 git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-1.0.0@1170220 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 1 + .../apache/cassandra/db/CounterMutation.java | 12 +----- .../cassandra/db/HintedHandOffManager.java | 2 +- .../cassandra/service/ReadCallback.java | 12 +----- .../cassandra/service/StorageProxy.java | 37 +++++++++++++++++-- .../apache/cassandra/utils/FBUtilities.java | 14 +++++++ 6 files changed, 52 insertions(+), 26 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 289ed9363d..59b99e080f 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -82,6 +82,7 @@ (CASSANDRA-3129) * CustomTThreadPoolServer to log TTransportException at DEBUG level (CASSANDRA-3142) + * Randomize choice of first replica for counter increment (CASSANDRA-2890) 0.8.5 diff --git a/src/java/org/apache/cassandra/db/CounterMutation.java b/src/java/org/apache/cassandra/db/CounterMutation.java index b3ba646e85..269ec59406 100644 --- a/src/java/org/apache/cassandra/db/CounterMutation.java +++ b/src/java/org/apache/cassandra/db/CounterMutation.java @@ -28,7 +28,6 @@ import java.util.Collection; import java.util.HashSet; import java.util.List; import java.util.LinkedList; -import java.util.Random; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -54,15 +53,6 @@ public class CounterMutation implements IMutation private final RowMutation rowMutation; private final ConsistencyLevel consistency; - private static final ThreadLocal random = new ThreadLocal() - { - @Override - protected Random initialValue() - { - return new Random(); - } - }; - public CounterMutation(RowMutation rowMutation, ConsistencyLevel consistency) { this.rowMutation = rowMutation; @@ -137,7 +127,7 @@ public class CounterMutation implements IMutation { ColumnFamily cf = row.cf; // random check for merging to allow lessening the performance impact - if (cf.metadata().getMergeShardsChance() > random.get().nextDouble()) + if (cf.metadata().getMergeShardsChance() > FBUtilities.threadLocalRandom().nextDouble()) { ColumnFamily merger = computeShardMerger(cf); if (merger != null) diff --git a/src/java/org/apache/cassandra/db/HintedHandOffManager.java b/src/java/org/apache/cassandra/db/HintedHandOffManager.java index 3ff5d44523..4ccbe41af4 100644 --- a/src/java/org/apache/cassandra/db/HintedHandOffManager.java +++ b/src/java/org/apache/cassandra/db/HintedHandOffManager.java @@ -232,7 +232,7 @@ public class HintedHandOffManager implements HintedHandOffManagerMBean // sleep a random amount to stagger handoff delivery from different replicas. // (if we had to wait, then gossiper randomness took care of that for us already.) if (waited == 0) { - int sleep = new Random().nextInt(60000); + int sleep = FBUtilities.threadLocalRandom().nextInt(60000); logger_.debug("Sleeping {}ms to stagger hint delivery", sleep); Thread.sleep(sleep); } diff --git a/src/java/org/apache/cassandra/service/ReadCallback.java b/src/java/org/apache/cassandra/service/ReadCallback.java index 9ce5457388..9ef45d9b86 100644 --- a/src/java/org/apache/cassandra/service/ReadCallback.java +++ b/src/java/org/apache/cassandra/service/ReadCallback.java @@ -43,6 +43,7 @@ import org.apache.cassandra.net.Message; import org.apache.cassandra.net.MessagingService; import org.apache.cassandra.thrift.ConsistencyLevel; import org.apache.cassandra.thrift.UnavailableException; +import org.apache.cassandra.utils.FBUtilities; import org.apache.cassandra.utils.SimpleCondition; import org.apache.cassandra.utils.WrappedRunnable; @@ -50,15 +51,6 @@ public class ReadCallback implements IAsyncCallback { protected static final Logger logger = LoggerFactory.getLogger( ReadCallback.class ); - private static final ThreadLocal random = new ThreadLocal() - { - @Override - protected Random initialValue() - { - return new Random(); - } - }; - public final IResponseResolver resolver; protected final SimpleCondition condition = new SimpleCondition(); private final long startTime; @@ -99,7 +91,7 @@ public class ReadCallback implements IAsyncCallback String table = ((RowDigestResolver) resolver).table; String columnFamily = ((ReadCommand) command).getColumnFamilyName(); CFMetaData cfmd = Schema.instance.getTableMetaData(table).get(columnFamily); - return cfmd.getReadRepairChance() > random.get().nextDouble(); + return cfmd.getReadRepairChance() > FBUtilities.threadLocalRandom().nextDouble(); } // we don't read repair on range scans return false; diff --git a/src/java/org/apache/cassandra/service/StorageProxy.java b/src/java/org/apache/cassandra/service/StorageProxy.java index 507c08bf78..435bb4a35d 100644 --- a/src/java/org/apache/cassandra/service/StorageProxy.java +++ b/src/java/org/apache/cassandra/service/StorageProxy.java @@ -55,6 +55,7 @@ import org.apache.cassandra.gms.FailureDetector; import org.apache.cassandra.gms.Gossiper; import org.apache.cassandra.io.util.FastByteArrayOutputStream; import org.apache.cassandra.locator.AbstractReplicationStrategy; +import org.apache.cassandra.locator.IEndpointSnitch; import org.apache.cassandra.locator.TokenMetadata; import org.apache.cassandra.net.*; import org.apache.cassandra.thrift.*; @@ -455,7 +456,7 @@ public class StorageProxy implements StorageProxyMBean */ public static IWriteResponseHandler mutateCounter(CounterMutation cm, String localDataCenter) throws UnavailableException, TimeoutException, IOException { - InetAddress endpoint = findSuitableEndpoint(cm.getTable(), cm.key()); + InetAddress endpoint = findSuitableEndpoint(cm.getTable(), cm.key(), localDataCenter); if (endpoint.equals(FBUtilities.getBroadcastAddress())) { @@ -481,15 +482,43 @@ public class StorageProxy implements StorageProxyMBean } } - private static InetAddress findSuitableEndpoint(String table, ByteBuffer key) throws UnavailableException + /** + * Find a suitable replica as leader for counter update. + * For now, we pick a random replica in the local DC (or ask the snitch if + * there is no replica alive in the local DC). + * TODO: if we track the latency of the counter writes (which makes sense + * contrarily to standard writes since there is a read involved), we could + * trust the dynamic snitch entirely, which may be a better solution. It + * is unclear we want to mix those latencies with read latencies, so this + * may be a bit involved. + */ + private static InetAddress findSuitableEndpoint(String table, ByteBuffer key, String localDataCenter) throws UnavailableException { + IEndpointSnitch snitch = DatabaseDescriptor.getEndpointSnitch(); List endpoints = StorageService.instance.getLiveNaturalEndpoints(table, key); - DatabaseDescriptor.getEndpointSnitch().sortByProximity(FBUtilities.getBroadcastAddress(), endpoints); if (endpoints.isEmpty()) throw new UnavailableException(); - return endpoints.get(0); + + List localEndpoints = new ArrayList(); + for (InetAddress endpoint : endpoints) + { + if (snitch.getDatacenter(endpoint).equals(localDataCenter)) + localEndpoints.add(endpoint); + } + if (localEndpoints.isEmpty()) + { + // No endpoint in local DC, pick the closest endpoint according to the snitch + snitch.sortByProximity(FBUtilities.getBroadcastAddress(), endpoints); + return endpoints.get(0); + } + else + { + return localEndpoints.get(FBUtilities.threadLocalRandom().nextInt(localEndpoints.size())); + } } + + // Must be called on a replica of the mutation. This replica becomes the // leader of this mutation. public static IWriteResponseHandler applyCounterMutationOnLeader(CounterMutation cm, String localDataCenter) throws UnavailableException, TimeoutException, IOException diff --git a/src/java/org/apache/cassandra/utils/FBUtilities.java b/src/java/org/apache/cassandra/utils/FBUtilities.java index 685b2f71c3..4a8aa71a6f 100644 --- a/src/java/org/apache/cassandra/utils/FBUtilities.java +++ b/src/java/org/apache/cassandra/utils/FBUtilities.java @@ -138,6 +138,15 @@ public class FBUtilities } }; + private static final ThreadLocal localRandom = new ThreadLocal() + { + @Override + protected Random initialValue() + { + return new Random(); + } + }; + public static final int MAX_UNSIGNED_SHORT = 0xFFFF; public static MessageDigest threadLocalMD5Digest() @@ -157,6 +166,11 @@ public class FBUtilities } } + public static Random threadLocalRandom() + { + return localRandom.get(); + } + /** * Parses a string representing either a fraction, absolute value or percentage. */ From 44d0ac696a1855c37e866e251ba2e9c652573d07 Mon Sep 17 00:00:00 2001 From: Sylvain Lebresne Date: Tue, 13 Sep 2011 17:02:06 +0000 Subject: [PATCH 10/17] merge from 0.8 git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-1.0.0@1170237 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 1 + src/java/org/apache/cassandra/config/CFMetaData.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index 59b99e080f..63f2f580ff 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -83,6 +83,7 @@ * CustomTThreadPoolServer to log TTransportException at DEBUG level (CASSANDRA-3142) * Randomize choice of first replica for counter increment (CASSANDRA-2890) + * Fix using read_repair_chance instead of merge_shard_change (CASSANDRA-3202) 0.8.5 diff --git a/src/java/org/apache/cassandra/config/CFMetaData.java b/src/java/org/apache/cassandra/config/CFMetaData.java index abc57dbbf6..3d2cd5d11d 100644 --- a/src/java/org/apache/cassandra/config/CFMetaData.java +++ b/src/java/org/apache/cassandra/config/CFMetaData.java @@ -444,7 +444,7 @@ public final class CFMetaData public double getMergeShardsChance() { - return readRepairChance; + return mergeShardsChance; } public boolean getReplicateOnWrite() From daa6267e85673af9cd085efcf34d82e9aa3303bd Mon Sep 17 00:00:00 2001 From: Jonathan Ellis Date: Tue, 13 Sep 2011 17:29:56 +0000 Subject: [PATCH 11/17] clarify "No other nodes seen! Unable to bootstrap" error message patch by jbellis; reviewed by slebresne for CASSANDRA-3191 git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-1.0.0@1170257 13f79535-47bb-0310-9956-ffa450edef68 --- conf/cassandra.yaml | 4 ++-- src/java/org/apache/cassandra/dht/BootStrapper.java | 7 ++++++- .../cassandra/service/AbstractCassandraDaemon.java | 10 +++++----- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/conf/cassandra.yaml b/conf/cassandra.yaml index 7a7c125205..9a1f8bcf0a 100644 --- a/conf/cassandra.yaml +++ b/conf/cassandra.yaml @@ -84,8 +84,8 @@ saved_caches_directory: /var/lib/cassandra/saved_caches commitlog_sync: periodic commitlog_sync_period_in_ms: 10000 -# any class that implements the SeedProvider interface and has a constructor that takes a Map of -# parameters will do. +# any class that implements the SeedProvider interface and has a +# constructor that takes a Map of parameters will do. seed_provider: # Addresses of hosts that are deemed contact points. # Cassandra nodes use this list of hosts to find each other and learn diff --git a/src/java/org/apache/cassandra/dht/BootStrapper.java b/src/java/org/apache/cassandra/dht/BootStrapper.java index d957146f69..90f4ee43b9 100644 --- a/src/java/org/apache/cassandra/dht/BootStrapper.java +++ b/src/java/org/apache/cassandra/dht/BootStrapper.java @@ -165,7 +165,12 @@ public class BootStrapper } if (endpoints.isEmpty()) - throw new RuntimeException("No other nodes seen! Unable to bootstrap"); + throw new RuntimeException("No other nodes seen! Unable to bootstrap." + + "If you intended to start a single-node cluster, you should make sure " + + "your broadcast_address (or listen_address) is listed as a seed. " + + "Otherwise, you need to determine why the seed being contacted " + + "has no knowledge of the rest of the cluster. Usually, this can be solved " + + "by giving all nodes the same seed list."); Collections.sort(endpoints, new Comparator() { public int compare(InetAddress ia1, InetAddress ia2) diff --git a/src/java/org/apache/cassandra/service/AbstractCassandraDaemon.java b/src/java/org/apache/cassandra/service/AbstractCassandraDaemon.java index 12e82e9974..09ad3d5c74 100644 --- a/src/java/org/apache/cassandra/service/AbstractCassandraDaemon.java +++ b/src/java/org/apache/cassandra/service/AbstractCassandraDaemon.java @@ -346,15 +346,15 @@ public abstract class AbstractCassandraDaemon implements CassandraDaemon } start(); - } catch (Throwable e) + } + catch (Throwable e) { - String msg = "Exception encountered during startup."; - logger.error(msg, e); + logger.error("Exception encountered during startup", e); // try to warn user on stdout too, if we haven't already detached - System.out.println(msg); e.printStackTrace(); - + System.out.println("Exception encountered during startup: " + e.getMessage()); + System.exit(3); } } From f8be55b0bd3e8ffd86dfc1302945d2279de83ab8 Mon Sep 17 00:00:00 2001 From: Sylvain Lebresne Date: Tue, 13 Sep 2011 17:31:43 +0000 Subject: [PATCH 12/17] Fix repair streaming forwarding loop patch by slebresne; reviewed by brandon.williams for CASSANDRA-3194 git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-1.0.0@1170262 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 2 +- .../cassandra/streaming/StreamingRepairTask.java | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 63f2f580ff..dfa87f8625 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -54,7 +54,7 @@ * generate hints for replicas that timeout, not just replicas that are known to be down before starting (CASSANDRA-2034) * Add throttling for internode streaming (CASSANDRA-3080) - * make the repair of a range repair all replica (CASSANDRA-2610) + * make the repair of a range repair all replica (CASSANDRA-2610, 3194) * expose the ability to repair the first range (as returned by the partitioner) of a node (CASSANDRA-2606) * Streams Compression (CASSANDRA-3015) diff --git a/src/java/org/apache/cassandra/streaming/StreamingRepairTask.java b/src/java/org/apache/cassandra/streaming/StreamingRepairTask.java index 4a93f9286b..6cee195757 100644 --- a/src/java/org/apache/cassandra/streaming/StreamingRepairTask.java +++ b/src/java/org/apache/cassandra/streaming/StreamingRepairTask.java @@ -78,7 +78,7 @@ public class StreamingRepairTask implements Runnable public static StreamingRepairTask create(InetAddress ep1, InetAddress ep2, String tableName, String cfName, Collection ranges, Runnable callback) { - InetAddress local = FBUtilities.getLocalAddress(); + InetAddress local = FBUtilities.getBroadcastAddress(); UUID id = UUIDGen.makeType1UUIDFromHost(local); // We can take anyone of the node as source or destination, however if one is localhost, we put at source to avoid a forwarding InetAddress src = ep2.equals(local) ? ep2 : ep1; @@ -99,7 +99,7 @@ public class StreamingRepairTask implements Runnable public void run() { - if (src.equals(FBUtilities.getLocalAddress())) + if (src.equals(FBUtilities.getBroadcastAddress())) { initiateStreaming(); } @@ -205,7 +205,7 @@ public class StreamingRepairTask implements Runnable throw new IOError(e); } - assert task.src.equals(FBUtilities.getLocalAddress()); + assert task.src.equals(FBUtilities.getBroadcastAddress()); assert task.owner.equals(message.getFrom()); logger.info(String.format("[streaming task #%s] Received task from %s to stream %d ranges to %s", task.id, message.getFrom(), task.ranges.size(), task.dst)); @@ -219,7 +219,7 @@ public class StreamingRepairTask implements Runnable ByteArrayOutputStream bos = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(bos); StreamingRepairTask.serializer.serialize(task, dos, version); - Message msg = new Message(FBUtilities.getLocalAddress(), StorageService.Verb.STREAMING_REPAIR_REQUEST, bos.toByteArray(), version); + Message msg = new Message(FBUtilities.getBroadcastAddress(), StorageService.Verb.STREAMING_REPAIR_REQUEST, bos.toByteArray(), version); MessagingService.instance().sendOneWay(msg, task.src); } } @@ -248,7 +248,7 @@ public class StreamingRepairTask implements Runnable return; } - assert task.owner.equals(FBUtilities.getLocalAddress()); + assert task.owner.equals(FBUtilities.getBroadcastAddress()); logger.info(String.format("[streaming task #%s] task succeeded", task.id)); if (task.callback != null) @@ -262,7 +262,7 @@ public class StreamingRepairTask implements Runnable ByteArrayOutputStream bos = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(bos); UUIDGen.write(taskid, dos); - Message msg = new Message(FBUtilities.getLocalAddress(), StorageService.Verb.STREAMING_REPAIR_RESPONSE, bos.toByteArray(), version); + Message msg = new Message(FBUtilities.getBroadcastAddress(), StorageService.Verb.STREAMING_REPAIR_RESPONSE, bos.toByteArray(), version); MessagingService.instance().sendOneWay(msg, remote); } } From effb653450a11abd5e0fdc221f9b2c7a046e829a Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Tue, 13 Sep 2011 18:30:25 +0000 Subject: [PATCH 13/17] Return both listen_address and rpc_address through describe_ring. Patch by Nick Bailey, reviewed by brandonwilliams for CASSANDRA-3187 git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-1.0.0@1170285 13f79535-47bb-0310-9956-ffa450edef68 --- interface/cassandra.thrift | 9 + .../thrift/AuthenticationRequest.java | 22 +- .../apache/cassandra/thrift/Cassandra.java | 294 +++++++++--------- .../org/apache/cassandra/thrift/CfDef.java | 62 ++-- .../apache/cassandra/thrift/ColumnDef.java | 22 +- .../apache/cassandra/thrift/CqlMetadata.java | 44 +-- .../apache/cassandra/thrift/CqlResult.java | 18 +- .../org/apache/cassandra/thrift/CqlRow.java | 18 +- .../org/apache/cassandra/thrift/KsDef.java | 40 +-- .../apache/cassandra/thrift/TokenRange.java | 147 ++++++++- .../cassandra/service/StorageService.java | 37 ++- .../cassandra/thrift/CassandraServer.java | 18 +- 12 files changed, 448 insertions(+), 283 deletions(-) diff --git a/interface/cassandra.thrift b/interface/cassandra.thrift index 03c968c7be..d31c1a2f4b 100644 --- a/interface/cassandra.thrift +++ b/interface/cassandra.thrift @@ -342,10 +342,19 @@ struct Mutation { 2: optional Deletion deletion, } +/** + A TokenRange describes part of the Cassandra ring, it is a mapping from a range to + endpoints responsible for that range. + @param start_token The first token in the range + @param end_token The last token in the range + @param endpoints The endpoints responsible for the range (listed by their configured listen_address) + @param rpc_endpoints The endpoints responsible for the range (listed by their configured rpc_address) +*/ struct TokenRange { 1: required string start_token, 2: required string end_token, 3: required list endpoints, + 4: optional list rpc_endpoints } /** diff --git a/interface/thrift/gen-java/org/apache/cassandra/thrift/AuthenticationRequest.java b/interface/thrift/gen-java/org/apache/cassandra/thrift/AuthenticationRequest.java index 1cec461883..2aa2378905 100644 --- a/interface/thrift/gen-java/org/apache/cassandra/thrift/AuthenticationRequest.java +++ b/interface/thrift/gen-java/org/apache/cassandra/thrift/AuthenticationRequest.java @@ -308,15 +308,15 @@ public class AuthenticationRequest implements org.apache.thrift.TBase(2*_map24.size); - for (int _i25 = 0; _i25 < _map24.size; ++_i25) + org.apache.thrift.protocol.TMap _map28 = iprot.readMapBegin(); + this.credentials = new HashMap(2*_map28.size); + for (int _i29 = 0; _i29 < _map28.size; ++_i29) { - String _key26; - String _val27; - _key26 = iprot.readString(); - _val27 = iprot.readString(); - this.credentials.put(_key26, _val27); + String _key30; + String _val31; + _key30 = iprot.readString(); + _val31 = iprot.readString(); + this.credentials.put(_key30, _val31); } iprot.readMapEnd(); } @@ -343,10 +343,10 @@ public class AuthenticationRequest implements org.apache.thrift.TBase _iter28 : this.credentials.entrySet()) + for (Map.Entry _iter32 : this.credentials.entrySet()) { - oprot.writeString(_iter28.getKey()); - oprot.writeString(_iter28.getValue()); + oprot.writeString(_iter32.getKey()); + oprot.writeString(_iter32.getValue()); } oprot.writeMapEnd(); } diff --git a/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java b/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java index 6be5d808cd..a5c2f75d1d 100644 --- a/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java +++ b/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java @@ -7736,14 +7736,14 @@ public class Cassandra { case 0: // SUCCESS if (field.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list75 = iprot.readListBegin(); - this.success = new ArrayList(_list75.size); - for (int _i76 = 0; _i76 < _list75.size; ++_i76) + org.apache.thrift.protocol.TList _list79 = iprot.readListBegin(); + this.success = new ArrayList(_list79.size); + for (int _i80 = 0; _i80 < _list79.size; ++_i80) { - ColumnOrSuperColumn _elem77; - _elem77 = new ColumnOrSuperColumn(); - _elem77.read(iprot); - this.success.add(_elem77); + ColumnOrSuperColumn _elem81; + _elem81 = new ColumnOrSuperColumn(); + _elem81.read(iprot); + this.success.add(_elem81); } iprot.readListEnd(); } @@ -7793,9 +7793,9 @@ public class Cassandra { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.success.size())); - for (ColumnOrSuperColumn _iter78 : this.success) + for (ColumnOrSuperColumn _iter82 : this.success) { - _iter78.write(oprot); + _iter82.write(oprot); } oprot.writeListEnd(); } @@ -9597,13 +9597,13 @@ public class Cassandra { case 1: // KEYS if (field.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list79 = iprot.readListBegin(); - this.keys = new ArrayList(_list79.size); - for (int _i80 = 0; _i80 < _list79.size; ++_i80) + org.apache.thrift.protocol.TList _list83 = iprot.readListBegin(); + this.keys = new ArrayList(_list83.size); + for (int _i84 = 0; _i84 < _list83.size; ++_i84) { - ByteBuffer _elem81; - _elem81 = iprot.readBinary(); - this.keys.add(_elem81); + ByteBuffer _elem85; + _elem85 = iprot.readBinary(); + this.keys.add(_elem85); } iprot.readListEnd(); } @@ -9653,9 +9653,9 @@ public class Cassandra { oprot.writeFieldBegin(KEYS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, this.keys.size())); - for (ByteBuffer _iter82 : this.keys) + for (ByteBuffer _iter86 : this.keys) { - oprot.writeBinary(_iter82); + oprot.writeBinary(_iter86); } oprot.writeListEnd(); } @@ -10244,26 +10244,26 @@ public class Cassandra { case 0: // SUCCESS if (field.type == org.apache.thrift.protocol.TType.MAP) { { - org.apache.thrift.protocol.TMap _map83 = iprot.readMapBegin(); - this.success = new HashMap>(2*_map83.size); - for (int _i84 = 0; _i84 < _map83.size; ++_i84) + org.apache.thrift.protocol.TMap _map87 = iprot.readMapBegin(); + this.success = new HashMap>(2*_map87.size); + for (int _i88 = 0; _i88 < _map87.size; ++_i88) { - ByteBuffer _key85; - List _val86; - _key85 = iprot.readBinary(); + ByteBuffer _key89; + List _val90; + _key89 = iprot.readBinary(); { - org.apache.thrift.protocol.TList _list87 = iprot.readListBegin(); - _val86 = new ArrayList(_list87.size); - for (int _i88 = 0; _i88 < _list87.size; ++_i88) + org.apache.thrift.protocol.TList _list91 = iprot.readListBegin(); + _val90 = new ArrayList(_list91.size); + for (int _i92 = 0; _i92 < _list91.size; ++_i92) { - ColumnOrSuperColumn _elem89; - _elem89 = new ColumnOrSuperColumn(); - _elem89.read(iprot); - _val86.add(_elem89); + ColumnOrSuperColumn _elem93; + _elem93 = new ColumnOrSuperColumn(); + _elem93.read(iprot); + _val90.add(_elem93); } iprot.readListEnd(); } - this.success.put(_key85, _val86); + this.success.put(_key89, _val90); } iprot.readMapEnd(); } @@ -10313,14 +10313,14 @@ public class Cassandra { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.LIST, this.success.size())); - for (Map.Entry> _iter90 : this.success.entrySet()) + for (Map.Entry> _iter94 : this.success.entrySet()) { - oprot.writeBinary(_iter90.getKey()); + oprot.writeBinary(_iter94.getKey()); { - oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, _iter90.getValue().size())); - for (ColumnOrSuperColumn _iter91 : _iter90.getValue()) + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, _iter94.getValue().size())); + for (ColumnOrSuperColumn _iter95 : _iter94.getValue()) { - _iter91.write(oprot); + _iter95.write(oprot); } oprot.writeListEnd(); } @@ -10908,13 +10908,13 @@ public class Cassandra { case 1: // KEYS if (field.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list92 = iprot.readListBegin(); - this.keys = new ArrayList(_list92.size); - for (int _i93 = 0; _i93 < _list92.size; ++_i93) + org.apache.thrift.protocol.TList _list96 = iprot.readListBegin(); + this.keys = new ArrayList(_list96.size); + for (int _i97 = 0; _i97 < _list96.size; ++_i97) { - ByteBuffer _elem94; - _elem94 = iprot.readBinary(); - this.keys.add(_elem94); + ByteBuffer _elem98; + _elem98 = iprot.readBinary(); + this.keys.add(_elem98); } iprot.readListEnd(); } @@ -10964,9 +10964,9 @@ public class Cassandra { oprot.writeFieldBegin(KEYS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, this.keys.size())); - for (ByteBuffer _iter95 : this.keys) + for (ByteBuffer _iter99 : this.keys) { - oprot.writeBinary(_iter95); + oprot.writeBinary(_iter99); } oprot.writeListEnd(); } @@ -11551,15 +11551,15 @@ public class Cassandra { case 0: // SUCCESS if (field.type == org.apache.thrift.protocol.TType.MAP) { { - org.apache.thrift.protocol.TMap _map96 = iprot.readMapBegin(); - this.success = new HashMap(2*_map96.size); - for (int _i97 = 0; _i97 < _map96.size; ++_i97) + org.apache.thrift.protocol.TMap _map100 = iprot.readMapBegin(); + this.success = new HashMap(2*_map100.size); + for (int _i101 = 0; _i101 < _map100.size; ++_i101) { - ByteBuffer _key98; - int _val99; - _key98 = iprot.readBinary(); - _val99 = iprot.readI32(); - this.success.put(_key98, _val99); + ByteBuffer _key102; + int _val103; + _key102 = iprot.readBinary(); + _val103 = iprot.readI32(); + this.success.put(_key102, _val103); } iprot.readMapEnd(); } @@ -11609,10 +11609,10 @@ public class Cassandra { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.I32, this.success.size())); - for (Map.Entry _iter100 : this.success.entrySet()) + for (Map.Entry _iter104 : this.success.entrySet()) { - oprot.writeBinary(_iter100.getKey()); - oprot.writeI32(_iter100.getValue()); + oprot.writeBinary(_iter104.getKey()); + oprot.writeI32(_iter104.getValue()); } oprot.writeMapEnd(); } @@ -12796,14 +12796,14 @@ public class Cassandra { case 0: // SUCCESS if (field.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list101 = iprot.readListBegin(); - this.success = new ArrayList(_list101.size); - for (int _i102 = 0; _i102 < _list101.size; ++_i102) + org.apache.thrift.protocol.TList _list105 = iprot.readListBegin(); + this.success = new ArrayList(_list105.size); + for (int _i106 = 0; _i106 < _list105.size; ++_i106) { - KeySlice _elem103; - _elem103 = new KeySlice(); - _elem103.read(iprot); - this.success.add(_elem103); + KeySlice _elem107; + _elem107 = new KeySlice(); + _elem107.read(iprot); + this.success.add(_elem107); } iprot.readListEnd(); } @@ -12853,9 +12853,9 @@ public class Cassandra { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.success.size())); - for (KeySlice _iter104 : this.success) + for (KeySlice _iter108 : this.success) { - _iter104.write(oprot); + _iter108.write(oprot); } oprot.writeListEnd(); } @@ -14039,14 +14039,14 @@ public class Cassandra { case 0: // SUCCESS if (field.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list105 = iprot.readListBegin(); - this.success = new ArrayList(_list105.size); - for (int _i106 = 0; _i106 < _list105.size; ++_i106) + org.apache.thrift.protocol.TList _list109 = iprot.readListBegin(); + this.success = new ArrayList(_list109.size); + for (int _i110 = 0; _i110 < _list109.size; ++_i110) { - KeySlice _elem107; - _elem107 = new KeySlice(); - _elem107.read(iprot); - this.success.add(_elem107); + KeySlice _elem111; + _elem111 = new KeySlice(); + _elem111.read(iprot); + this.success.add(_elem111); } iprot.readListEnd(); } @@ -14096,9 +14096,9 @@ public class Cassandra { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.success.size())); - for (KeySlice _iter108 : this.success) + for (KeySlice _iter112 : this.success) { - _iter108.write(oprot); + _iter112.write(oprot); } oprot.writeListEnd(); } @@ -17043,8 +17043,6 @@ public class Cassandra { private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { - // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. - __isset_bit_vector = new BitSet(1); read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); @@ -18943,38 +18941,38 @@ public class Cassandra { case 1: // MUTATION_MAP if (field.type == org.apache.thrift.protocol.TType.MAP) { { - org.apache.thrift.protocol.TMap _map109 = iprot.readMapBegin(); - this.mutation_map = new HashMap>>(2*_map109.size); - for (int _i110 = 0; _i110 < _map109.size; ++_i110) + org.apache.thrift.protocol.TMap _map113 = iprot.readMapBegin(); + this.mutation_map = new HashMap>>(2*_map113.size); + for (int _i114 = 0; _i114 < _map113.size; ++_i114) { - ByteBuffer _key111; - Map> _val112; - _key111 = iprot.readBinary(); + ByteBuffer _key115; + Map> _val116; + _key115 = iprot.readBinary(); { - org.apache.thrift.protocol.TMap _map113 = iprot.readMapBegin(); - _val112 = new HashMap>(2*_map113.size); - for (int _i114 = 0; _i114 < _map113.size; ++_i114) + org.apache.thrift.protocol.TMap _map117 = iprot.readMapBegin(); + _val116 = new HashMap>(2*_map117.size); + for (int _i118 = 0; _i118 < _map117.size; ++_i118) { - String _key115; - List _val116; - _key115 = iprot.readString(); + String _key119; + List _val120; + _key119 = iprot.readString(); { - org.apache.thrift.protocol.TList _list117 = iprot.readListBegin(); - _val116 = new ArrayList(_list117.size); - for (int _i118 = 0; _i118 < _list117.size; ++_i118) + org.apache.thrift.protocol.TList _list121 = iprot.readListBegin(); + _val120 = new ArrayList(_list121.size); + for (int _i122 = 0; _i122 < _list121.size; ++_i122) { - Mutation _elem119; - _elem119 = new Mutation(); - _elem119.read(iprot); - _val116.add(_elem119); + Mutation _elem123; + _elem123 = new Mutation(); + _elem123.read(iprot); + _val120.add(_elem123); } iprot.readListEnd(); } - _val112.put(_key115, _val116); + _val116.put(_key119, _val120); } iprot.readMapEnd(); } - this.mutation_map.put(_key111, _val112); + this.mutation_map.put(_key115, _val116); } iprot.readMapEnd(); } @@ -19008,19 +19006,19 @@ public class Cassandra { oprot.writeFieldBegin(MUTATION_MAP_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.MAP, this.mutation_map.size())); - for (Map.Entry>> _iter120 : this.mutation_map.entrySet()) + for (Map.Entry>> _iter124 : this.mutation_map.entrySet()) { - oprot.writeBinary(_iter120.getKey()); + oprot.writeBinary(_iter124.getKey()); { - oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.LIST, _iter120.getValue().size())); - for (Map.Entry> _iter121 : _iter120.getValue().entrySet()) + oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.LIST, _iter124.getValue().size())); + for (Map.Entry> _iter125 : _iter124.getValue().entrySet()) { - oprot.writeString(_iter121.getKey()); + oprot.writeString(_iter125.getKey()); { - oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, _iter121.getValue().size())); - for (Mutation _iter122 : _iter121.getValue()) + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, _iter125.getValue().size())); + for (Mutation _iter126 : _iter125.getValue()) { - _iter122.write(oprot); + _iter126.write(oprot); } oprot.writeListEnd(); } @@ -20835,25 +20833,25 @@ public class Cassandra { case 0: // SUCCESS if (field.type == org.apache.thrift.protocol.TType.MAP) { { - org.apache.thrift.protocol.TMap _map123 = iprot.readMapBegin(); - this.success = new HashMap>(2*_map123.size); - for (int _i124 = 0; _i124 < _map123.size; ++_i124) + org.apache.thrift.protocol.TMap _map127 = iprot.readMapBegin(); + this.success = new HashMap>(2*_map127.size); + for (int _i128 = 0; _i128 < _map127.size; ++_i128) { - String _key125; - List _val126; - _key125 = iprot.readString(); + String _key129; + List _val130; + _key129 = iprot.readString(); { - org.apache.thrift.protocol.TList _list127 = iprot.readListBegin(); - _val126 = new ArrayList(_list127.size); - for (int _i128 = 0; _i128 < _list127.size; ++_i128) + org.apache.thrift.protocol.TList _list131 = iprot.readListBegin(); + _val130 = new ArrayList(_list131.size); + for (int _i132 = 0; _i132 < _list131.size; ++_i132) { - String _elem129; - _elem129 = iprot.readString(); - _val126.add(_elem129); + String _elem133; + _elem133 = iprot.readString(); + _val130.add(_elem133); } iprot.readListEnd(); } - this.success.put(_key125, _val126); + this.success.put(_key129, _val130); } iprot.readMapEnd(); } @@ -20887,14 +20885,14 @@ public class Cassandra { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.LIST, this.success.size())); - for (Map.Entry> _iter130 : this.success.entrySet()) + for (Map.Entry> _iter134 : this.success.entrySet()) { - oprot.writeString(_iter130.getKey()); + oprot.writeString(_iter134.getKey()); { - oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, _iter130.getValue().size())); - for (String _iter131 : _iter130.getValue()) + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, _iter134.getValue().size())); + for (String _iter135 : _iter134.getValue()) { - oprot.writeString(_iter131); + oprot.writeString(_iter135); } oprot.writeListEnd(); } @@ -21493,14 +21491,14 @@ public class Cassandra { case 0: // SUCCESS if (field.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list132 = iprot.readListBegin(); - this.success = new ArrayList(_list132.size); - for (int _i133 = 0; _i133 < _list132.size; ++_i133) + org.apache.thrift.protocol.TList _list136 = iprot.readListBegin(); + this.success = new ArrayList(_list136.size); + for (int _i137 = 0; _i137 < _list136.size; ++_i137) { - KsDef _elem134; - _elem134 = new KsDef(); - _elem134.read(iprot); - this.success.add(_elem134); + KsDef _elem138; + _elem138 = new KsDef(); + _elem138.read(iprot); + this.success.add(_elem138); } iprot.readListEnd(); } @@ -21534,9 +21532,9 @@ public class Cassandra { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.success.size())); - for (KsDef _iter135 : this.success) + for (KsDef _iter139 : this.success) { - _iter135.write(oprot); + _iter139.write(oprot); } oprot.writeListEnd(); } @@ -23249,14 +23247,14 @@ public class Cassandra { case 0: // SUCCESS if (field.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list136 = iprot.readListBegin(); - this.success = new ArrayList(_list136.size); - for (int _i137 = 0; _i137 < _list136.size; ++_i137) + org.apache.thrift.protocol.TList _list140 = iprot.readListBegin(); + this.success = new ArrayList(_list140.size); + for (int _i141 = 0; _i141 < _list140.size; ++_i141) { - TokenRange _elem138; - _elem138 = new TokenRange(); - _elem138.read(iprot); - this.success.add(_elem138); + TokenRange _elem142; + _elem142 = new TokenRange(); + _elem142.read(iprot); + this.success.add(_elem142); } iprot.readListEnd(); } @@ -23290,9 +23288,9 @@ public class Cassandra { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.success.size())); - for (TokenRange _iter139 : this.success) + for (TokenRange _iter143 : this.success) { - _iter139.write(oprot); + _iter143.write(oprot); } oprot.writeListEnd(); } @@ -26094,13 +26092,13 @@ public class Cassandra { case 0: // SUCCESS if (field.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list140 = iprot.readListBegin(); - this.success = new ArrayList(_list140.size); - for (int _i141 = 0; _i141 < _list140.size; ++_i141) + org.apache.thrift.protocol.TList _list144 = iprot.readListBegin(); + this.success = new ArrayList(_list144.size); + for (int _i145 = 0; _i145 < _list144.size; ++_i145) { - String _elem142; - _elem142 = iprot.readString(); - this.success.add(_elem142); + String _elem146; + _elem146 = iprot.readString(); + this.success.add(_elem146); } iprot.readListEnd(); } @@ -26134,9 +26132,9 @@ public class Cassandra { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, this.success.size())); - for (String _iter143 : this.success) + for (String _iter147 : this.success) { - oprot.writeString(_iter143); + oprot.writeString(_iter147); } oprot.writeListEnd(); } diff --git a/interface/thrift/gen-java/org/apache/cassandra/thrift/CfDef.java b/interface/thrift/gen-java/org/apache/cassandra/thrift/CfDef.java index ccfc3086d2..fe8b965c5e 100644 --- a/interface/thrift/gen-java/org/apache/cassandra/thrift/CfDef.java +++ b/interface/thrift/gen-java/org/apache/cassandra/thrift/CfDef.java @@ -2232,14 +2232,14 @@ public class CfDef implements org.apache.thrift.TBase, jav case 13: // COLUMN_METADATA if (field.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list34 = iprot.readListBegin(); - this.column_metadata = new ArrayList(_list34.size); - for (int _i35 = 0; _i35 < _list34.size; ++_i35) + org.apache.thrift.protocol.TList _list38 = iprot.readListBegin(); + this.column_metadata = new ArrayList(_list38.size); + for (int _i39 = 0; _i39 < _list38.size; ++_i39) { - ColumnDef _elem36; - _elem36 = new ColumnDef(); - _elem36.read(iprot); - this.column_metadata.add(_elem36); + ColumnDef _elem40; + _elem40 = new ColumnDef(); + _elem40.read(iprot); + this.column_metadata.add(_elem40); } iprot.readListEnd(); } @@ -2349,15 +2349,15 @@ public class CfDef implements org.apache.thrift.TBase, jav case 30: // COMPACTION_STRATEGY_OPTIONS if (field.type == org.apache.thrift.protocol.TType.MAP) { { - org.apache.thrift.protocol.TMap _map37 = iprot.readMapBegin(); - this.compaction_strategy_options = new HashMap(2*_map37.size); - for (int _i38 = 0; _i38 < _map37.size; ++_i38) + org.apache.thrift.protocol.TMap _map41 = iprot.readMapBegin(); + this.compaction_strategy_options = new HashMap(2*_map41.size); + for (int _i42 = 0; _i42 < _map41.size; ++_i42) { - String _key39; - String _val40; - _key39 = iprot.readString(); - _val40 = iprot.readString(); - this.compaction_strategy_options.put(_key39, _val40); + String _key43; + String _val44; + _key43 = iprot.readString(); + _val44 = iprot.readString(); + this.compaction_strategy_options.put(_key43, _val44); } iprot.readMapEnd(); } @@ -2376,15 +2376,15 @@ public class CfDef implements org.apache.thrift.TBase, jav case 32: // COMPRESSION_OPTIONS if (field.type == org.apache.thrift.protocol.TType.MAP) { { - org.apache.thrift.protocol.TMap _map41 = iprot.readMapBegin(); - this.compression_options = new HashMap(2*_map41.size); - for (int _i42 = 0; _i42 < _map41.size; ++_i42) + org.apache.thrift.protocol.TMap _map45 = iprot.readMapBegin(); + this.compression_options = new HashMap(2*_map45.size); + for (int _i46 = 0; _i46 < _map45.size; ++_i46) { - String _key43; - String _val44; - _key43 = iprot.readString(); - _val44 = iprot.readString(); - this.compression_options.put(_key43, _val44); + String _key47; + String _val48; + _key47 = iprot.readString(); + _val48 = iprot.readString(); + this.compression_options.put(_key47, _val48); } iprot.readMapEnd(); } @@ -2465,9 +2465,9 @@ public class CfDef implements org.apache.thrift.TBase, jav oprot.writeFieldBegin(COLUMN_METADATA_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.column_metadata.size())); - for (ColumnDef _iter45 : this.column_metadata) + for (ColumnDef _iter49 : this.column_metadata) { - _iter45.write(oprot); + _iter49.write(oprot); } oprot.writeListEnd(); } @@ -2554,10 +2554,10 @@ public class CfDef implements org.apache.thrift.TBase, jav oprot.writeFieldBegin(COMPACTION_STRATEGY_OPTIONS_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, this.compaction_strategy_options.size())); - for (Map.Entry _iter46 : this.compaction_strategy_options.entrySet()) + for (Map.Entry _iter50 : this.compaction_strategy_options.entrySet()) { - oprot.writeString(_iter46.getKey()); - oprot.writeString(_iter46.getValue()); + oprot.writeString(_iter50.getKey()); + oprot.writeString(_iter50.getValue()); } oprot.writeMapEnd(); } @@ -2574,10 +2574,10 @@ public class CfDef implements org.apache.thrift.TBase, jav oprot.writeFieldBegin(COMPRESSION_OPTIONS_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, this.compression_options.size())); - for (Map.Entry _iter47 : this.compression_options.entrySet()) + for (Map.Entry _iter51 : this.compression_options.entrySet()) { - oprot.writeString(_iter47.getKey()); - oprot.writeString(_iter47.getValue()); + oprot.writeString(_iter51.getKey()); + oprot.writeString(_iter51.getValue()); } oprot.writeMapEnd(); } diff --git a/interface/thrift/gen-java/org/apache/cassandra/thrift/ColumnDef.java b/interface/thrift/gen-java/org/apache/cassandra/thrift/ColumnDef.java index 0d92f452bc..10a70f02fd 100644 --- a/interface/thrift/gen-java/org/apache/cassandra/thrift/ColumnDef.java +++ b/interface/thrift/gen-java/org/apache/cassandra/thrift/ColumnDef.java @@ -650,15 +650,15 @@ public class ColumnDef implements org.apache.thrift.TBase(2*_map29.size); - for (int _i30 = 0; _i30 < _map29.size; ++_i30) + org.apache.thrift.protocol.TMap _map33 = iprot.readMapBegin(); + this.index_options = new HashMap(2*_map33.size); + for (int _i34 = 0; _i34 < _map33.size; ++_i34) { - String _key31; - String _val32; - _key31 = iprot.readString(); - _val32 = iprot.readString(); - this.index_options.put(_key31, _val32); + String _key35; + String _val36; + _key35 = iprot.readString(); + _val36 = iprot.readString(); + this.index_options.put(_key35, _val36); } iprot.readMapEnd(); } @@ -710,10 +710,10 @@ public class ColumnDef implements org.apache.thrift.TBase _iter33 : this.index_options.entrySet()) + for (Map.Entry _iter37 : this.index_options.entrySet()) { - oprot.writeString(_iter33.getKey()); - oprot.writeString(_iter33.getValue()); + oprot.writeString(_iter37.getKey()); + oprot.writeString(_iter37.getValue()); } oprot.writeMapEnd(); } diff --git a/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlMetadata.java b/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlMetadata.java index dcab531e94..e2f3256fea 100644 --- a/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlMetadata.java +++ b/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlMetadata.java @@ -554,15 +554,15 @@ public class CqlMetadata implements org.apache.thrift.TBase(2*_map61.size); - for (int _i62 = 0; _i62 < _map61.size; ++_i62) + org.apache.thrift.protocol.TMap _map65 = iprot.readMapBegin(); + this.name_types = new HashMap(2*_map65.size); + for (int _i66 = 0; _i66 < _map65.size; ++_i66) { - ByteBuffer _key63; - String _val64; - _key63 = iprot.readBinary(); - _val64 = iprot.readString(); - this.name_types.put(_key63, _val64); + ByteBuffer _key67; + String _val68; + _key67 = iprot.readBinary(); + _val68 = iprot.readString(); + this.name_types.put(_key67, _val68); } iprot.readMapEnd(); } @@ -573,15 +573,15 @@ public class CqlMetadata implements org.apache.thrift.TBase(2*_map65.size); - for (int _i66 = 0; _i66 < _map65.size; ++_i66) + org.apache.thrift.protocol.TMap _map69 = iprot.readMapBegin(); + this.value_types = new HashMap(2*_map69.size); + for (int _i70 = 0; _i70 < _map69.size; ++_i70) { - ByteBuffer _key67; - String _val68; - _key67 = iprot.readBinary(); - _val68 = iprot.readString(); - this.value_types.put(_key67, _val68); + ByteBuffer _key71; + String _val72; + _key71 = iprot.readBinary(); + _val72 = iprot.readString(); + this.value_types.put(_key71, _val72); } iprot.readMapEnd(); } @@ -622,10 +622,10 @@ public class CqlMetadata implements org.apache.thrift.TBase _iter69 : this.name_types.entrySet()) + for (Map.Entry _iter73 : this.name_types.entrySet()) { - oprot.writeBinary(_iter69.getKey()); - oprot.writeString(_iter69.getValue()); + oprot.writeBinary(_iter73.getKey()); + oprot.writeString(_iter73.getValue()); } oprot.writeMapEnd(); } @@ -635,10 +635,10 @@ public class CqlMetadata implements org.apache.thrift.TBase _iter70 : this.value_types.entrySet()) + for (Map.Entry _iter74 : this.value_types.entrySet()) { - oprot.writeBinary(_iter70.getKey()); - oprot.writeString(_iter70.getValue()); + oprot.writeBinary(_iter74.getKey()); + oprot.writeString(_iter74.getValue()); } oprot.writeMapEnd(); } diff --git a/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlResult.java b/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlResult.java index 603a37ac99..8aae0ae477 100644 --- a/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlResult.java +++ b/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlResult.java @@ -541,14 +541,14 @@ public class CqlResult implements org.apache.thrift.TBase(_list71.size); - for (int _i72 = 0; _i72 < _list71.size; ++_i72) + org.apache.thrift.protocol.TList _list75 = iprot.readListBegin(); + this.rows = new ArrayList(_list75.size); + for (int _i76 = 0; _i76 < _list75.size; ++_i76) { - CqlRow _elem73; - _elem73 = new CqlRow(); - _elem73.read(iprot); - this.rows.add(_elem73); + CqlRow _elem77; + _elem77 = new CqlRow(); + _elem77.read(iprot); + this.rows.add(_elem77); } iprot.readListEnd(); } @@ -597,9 +597,9 @@ public class CqlResult implements org.apache.thrift.TBase, case 2: // COLUMNS if (field.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list57 = iprot.readListBegin(); - this.columns = new ArrayList(_list57.size); - for (int _i58 = 0; _i58 < _list57.size; ++_i58) + org.apache.thrift.protocol.TList _list61 = iprot.readListBegin(); + this.columns = new ArrayList(_list61.size); + for (int _i62 = 0; _i62 < _list61.size; ++_i62) { - Column _elem59; - _elem59 = new Column(); - _elem59.read(iprot); - this.columns.add(_elem59); + Column _elem63; + _elem63 = new Column(); + _elem63.read(iprot); + this.columns.add(_elem63); } iprot.readListEnd(); } @@ -434,9 +434,9 @@ public class CqlRow implements org.apache.thrift.TBase, oprot.writeFieldBegin(COLUMNS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.columns.size())); - for (Column _iter60 : this.columns) + for (Column _iter64 : this.columns) { - _iter60.write(oprot); + _iter64.write(oprot); } oprot.writeListEnd(); } diff --git a/interface/thrift/gen-java/org/apache/cassandra/thrift/KsDef.java b/interface/thrift/gen-java/org/apache/cassandra/thrift/KsDef.java index 7d137a8e49..7d79bc4caf 100644 --- a/interface/thrift/gen-java/org/apache/cassandra/thrift/KsDef.java +++ b/interface/thrift/gen-java/org/apache/cassandra/thrift/KsDef.java @@ -718,15 +718,15 @@ public class KsDef implements org.apache.thrift.TBase, jav case 3: // STRATEGY_OPTIONS if (field.type == org.apache.thrift.protocol.TType.MAP) { { - org.apache.thrift.protocol.TMap _map48 = iprot.readMapBegin(); - this.strategy_options = new HashMap(2*_map48.size); - for (int _i49 = 0; _i49 < _map48.size; ++_i49) + org.apache.thrift.protocol.TMap _map52 = iprot.readMapBegin(); + this.strategy_options = new HashMap(2*_map52.size); + for (int _i53 = 0; _i53 < _map52.size; ++_i53) { - String _key50; - String _val51; - _key50 = iprot.readString(); - _val51 = iprot.readString(); - this.strategy_options.put(_key50, _val51); + String _key54; + String _val55; + _key54 = iprot.readString(); + _val55 = iprot.readString(); + this.strategy_options.put(_key54, _val55); } iprot.readMapEnd(); } @@ -745,14 +745,14 @@ public class KsDef implements org.apache.thrift.TBase, jav case 5: // CF_DEFS if (field.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list52 = iprot.readListBegin(); - this.cf_defs = new ArrayList(_list52.size); - for (int _i53 = 0; _i53 < _list52.size; ++_i53) + org.apache.thrift.protocol.TList _list56 = iprot.readListBegin(); + this.cf_defs = new ArrayList(_list56.size); + for (int _i57 = 0; _i57 < _list56.size; ++_i57) { - CfDef _elem54; - _elem54 = new CfDef(); - _elem54.read(iprot); - this.cf_defs.add(_elem54); + CfDef _elem58; + _elem58 = new CfDef(); + _elem58.read(iprot); + this.cf_defs.add(_elem58); } iprot.readListEnd(); } @@ -798,10 +798,10 @@ public class KsDef implements org.apache.thrift.TBase, jav oprot.writeFieldBegin(STRATEGY_OPTIONS_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, this.strategy_options.size())); - for (Map.Entry _iter55 : this.strategy_options.entrySet()) + for (Map.Entry _iter59 : this.strategy_options.entrySet()) { - oprot.writeString(_iter55.getKey()); - oprot.writeString(_iter55.getValue()); + oprot.writeString(_iter59.getKey()); + oprot.writeString(_iter59.getValue()); } oprot.writeMapEnd(); } @@ -817,9 +817,9 @@ public class KsDef implements org.apache.thrift.TBase, jav oprot.writeFieldBegin(CF_DEFS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.cf_defs.size())); - for (CfDef _iter56 : this.cf_defs) + for (CfDef _iter60 : this.cf_defs) { - _iter56.write(oprot); + _iter60.write(oprot); } oprot.writeListEnd(); } diff --git a/interface/thrift/gen-java/org/apache/cassandra/thrift/TokenRange.java b/interface/thrift/gen-java/org/apache/cassandra/thrift/TokenRange.java index 7068f5bc6a..6880542cde 100644 --- a/interface/thrift/gen-java/org/apache/cassandra/thrift/TokenRange.java +++ b/interface/thrift/gen-java/org/apache/cassandra/thrift/TokenRange.java @@ -42,22 +42,33 @@ import java.util.Arrays; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +/** + * A TokenRange describes part of the Cassandra ring, it is a mapping from a range to + * endpoints responsible for that range. + * @param start_token The first token in the range + * @param end_token The last token in the range + * @param endpoints The endpoints responsible for the range (listed by their configured listen_address) + * @param rpc_endpoints The endpoints responsible for the range (listed by their configured rpc_address) + */ public class TokenRange implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TokenRange"); private static final org.apache.thrift.protocol.TField START_TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("start_token", org.apache.thrift.protocol.TType.STRING, (short)1); private static final org.apache.thrift.protocol.TField END_TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("end_token", org.apache.thrift.protocol.TType.STRING, (short)2); private static final org.apache.thrift.protocol.TField ENDPOINTS_FIELD_DESC = new org.apache.thrift.protocol.TField("endpoints", org.apache.thrift.protocol.TType.LIST, (short)3); + private static final org.apache.thrift.protocol.TField RPC_ENDPOINTS_FIELD_DESC = new org.apache.thrift.protocol.TField("rpc_endpoints", org.apache.thrift.protocol.TType.LIST, (short)4); public String start_token; public String end_token; public List endpoints; + public List rpc_endpoints; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { START_TOKEN((short)1, "start_token"), END_TOKEN((short)2, "end_token"), - ENDPOINTS((short)3, "endpoints"); + ENDPOINTS((short)3, "endpoints"), + RPC_ENDPOINTS((short)4, "rpc_endpoints"); private static final Map byName = new HashMap(); @@ -78,6 +89,8 @@ public class TokenRange implements org.apache.thrift.TBase __this__rpc_endpoints = new ArrayList(); + for (String other_element : other.rpc_endpoints) { + __this__rpc_endpoints.add(other_element); + } + this.rpc_endpoints = __this__rpc_endpoints; + } } public TokenRange deepCopy() { @@ -175,6 +198,7 @@ public class TokenRange implements org.apache.thrift.TBase getRpc_endpointsIterator() { + return (this.rpc_endpoints == null) ? null : this.rpc_endpoints.iterator(); + } + + public void addToRpc_endpoints(String elem) { + if (this.rpc_endpoints == null) { + this.rpc_endpoints = new ArrayList(); + } + this.rpc_endpoints.add(elem); + } + + public List getRpc_endpoints() { + return this.rpc_endpoints; + } + + public TokenRange setRpc_endpoints(List rpc_endpoints) { + this.rpc_endpoints = rpc_endpoints; + return this; + } + + public void unsetRpc_endpoints() { + this.rpc_endpoints = null; + } + + /** Returns true if field rpc_endpoints is set (has been assigned a value) and false otherwise */ + public boolean isSetRpc_endpoints() { + return this.rpc_endpoints != null; + } + + public void setRpc_endpointsIsSet(boolean value) { + if (!value) { + this.rpc_endpoints = null; + } + } + public void setFieldValue(_Fields field, Object value) { switch (field) { case START_TOKEN: @@ -290,6 +353,14 @@ public class TokenRange implements org.apache.thrift.TBase)value); + } + break; + } } @@ -304,6 +375,9 @@ public class TokenRange implements org.apache.thrift.TBase(_list23.size); + for (int _i24 = 0; _i24 < _list23.size; ++_i24) + { + String _elem25; + _elem25 = iprot.readString(); + this.rpc_endpoints.add(_elem25); + } + iprot.readListEnd(); + } + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); } @@ -505,14 +622,28 @@ public class TokenRange implements org.apache.thrift.TBase> getRangeToEndpointMap(String keyspace) { - // some people just want to get a visual representation of things. Allow null and set it to the first - // non-system table. - if (keyspace == null) - keyspace = Schema.instance.getNonSystemTables().get(0); - /* All the ranges for the tokens */ Map> map = new HashMap>(); for (Map.Entry> entry : getRangeToAddressMap(keyspace).entrySet()) @@ -655,6 +650,21 @@ public class StorageService implements IEndpointStateChangeSubscriber, StorageSe return map; } + /** + * Return the rpc address associated with an endpoint as a string. + * @param endpoint The endpoint to get rpc address for + * @return + */ + public String getRpcaddress(InetAddress endpoint) + { + if (endpoint.equals(FBUtilities.getBroadcastAddress())) + return DatabaseDescriptor.getRpcAddress().getHostAddress(); + else if (Gossiper.instance.getEndpointStateForEndpoint(endpoint).getApplicationState(ApplicationState.RPC_ADDRESS) == null) + return endpoint.getHostAddress(); + else + return Gossiper.instance.getEndpointStateForEndpoint(endpoint).getApplicationState(ApplicationState.RPC_ADDRESS).value; + } + /** * for a keyspace, return the ranges and corresponding RPC addresses for a given keyspace. * @param keyspace @@ -662,11 +672,6 @@ public class StorageService implements IEndpointStateChangeSubscriber, StorageSe */ public Map> getRangeToRpcaddressMap(String keyspace) { - // some people just want to get a visual representation of things. Allow null and set it to the first - // non-system table. - if (keyspace == null) - keyspace = Schema.instance.getNonSystemTables().get(0); - /* All the ranges for the tokens */ Map> map = new HashMap>(); for (Map.Entry> entry : getRangeToAddressMap(keyspace).entrySet()) @@ -674,12 +679,7 @@ public class StorageService implements IEndpointStateChangeSubscriber, StorageSe List rpcaddrs = new ArrayList(); for (InetAddress endpoint: entry.getValue()) { - if (endpoint.equals(FBUtilities.getBroadcastAddress())) - rpcaddrs.add(DatabaseDescriptor.getRpcAddress().getHostAddress()); - else if (Gossiper.instance.getEndpointStateForEndpoint(endpoint).getApplicationState(ApplicationState.RPC_ADDRESS) == null) - rpcaddrs.add(endpoint.getHostAddress()); - else - rpcaddrs.add(Gossiper.instance.getEndpointStateForEndpoint(endpoint).getApplicationState(ApplicationState.RPC_ADDRESS).value); + rpcaddrs.add(getRpcaddress(endpoint)); } map.put(entry.getKey(), rpcaddrs); } @@ -704,6 +704,11 @@ public class StorageService implements IEndpointStateChangeSubscriber, StorageSe public Map> getRangeToAddressMap(String keyspace) { + // some people just want to get a visual representation of things. Allow null and set it to the first + // non-system table. + if (keyspace == null) + keyspace = Schema.instance.getNonSystemTables().get(0); + List ranges = getAllRanges(tokenMetadata_.sortedTokens()); return constructRangeToEndpointMap(keyspace, ranges); } diff --git a/src/java/org/apache/cassandra/thrift/CassandraServer.java b/src/java/org/apache/cassandra/thrift/CassandraServer.java index 2fba777e55..055bb2ff96 100644 --- a/src/java/org/apache/cassandra/thrift/CassandraServer.java +++ b/src/java/org/apache/cassandra/thrift/CassandraServer.java @@ -20,6 +20,7 @@ package org.apache.cassandra.thrift; import java.io.IOException; import java.io.UnsupportedEncodingException; +import java.net.InetAddress; import java.net.SocketAddress; import java.nio.ByteBuffer; import java.nio.charset.CharacterCodingException; @@ -786,11 +787,22 @@ public class CassandraServer implements Cassandra.Iface throw new InvalidRequestException("There is no ring for the keyspace: " + keyspace); List ranges = new ArrayList(); Token.TokenFactory tf = StorageService.getPartitioner().getTokenFactory(); - for (Map.Entry> entry : StorageService.instance.getRangeToRpcaddressMap(keyspace).entrySet()) + + Map> address_map = StorageService.instance.getRangeToAddressMap(keyspace); + for (Map.Entry> entry : address_map.entrySet()) { Range range = entry.getKey(); - List endpoints = entry.getValue(); - ranges.add(new TokenRange(tf.toString(range.left), tf.toString(range.right), endpoints)); + List endpoints = new ArrayList(); + List rpc_endpoints = new ArrayList(); + for (InetAddress endpoint : entry.getValue()) + { + endpoints.add(endpoint.getHostAddress()); + rpc_endpoints.add(StorageService.instance.getRpcaddress(endpoint)); + } + + TokenRange tr = new TokenRange(tf.toString(range.left), tf.toString(range.right), endpoints); + tr.rpc_endpoints = rpc_endpoints; + ranges.add(tr); } return ranges; } From 71ebcafb49033dc895db971ddf7b702bed55a8cd Mon Sep 17 00:00:00 2001 From: Jonathan Ellis Date: Tue, 13 Sep 2011 19:24:15 +0000 Subject: [PATCH 14/17] Fix divide by zero error in GCInspector patch by jbellis; reviewed by slebresne for CASSANDRA-3164 git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-0.7@1170308 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/cassandra/service/GCInspector.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/java/org/apache/cassandra/service/GCInspector.java b/src/java/org/apache/cassandra/service/GCInspector.java index e88f6719d2..e9d494dba0 100644 --- a/src/java/org/apache/cassandra/service/GCInspector.java +++ b/src/java/org/apache/cassandra/service/GCInspector.java @@ -106,7 +106,7 @@ public class GCInspector if (previousCount == null) previousCount = 0L; - if (count == previousCount) + if (count.equals(previousCount)) continue; gccounts.put(gc.getName(), count); From a9e0930a0889d5f4e2710e8c40600141b78d97ac Mon Sep 17 00:00:00 2001 From: Jonathan Ellis Date: Tue, 13 Sep 2011 19:25:44 +0000 Subject: [PATCH 15/17] update CHANGES git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-0.7@1170309 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index 2b2ac22c88..6c18b224de 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,7 @@ +0.7.10 + * Fix divide by zero error in GCInspector (CASSANDRA-3164) + + 0.7.9 * don't include tmp files as sstable when create cfs (CASSANDRA-2929) * log Java classpath on startup (CASSANDRA-2895) From 3c2db692f2fb45b5920d27fd2ea1e3e6ac974f53 Mon Sep 17 00:00:00 2001 From: Jonathan Ellis Date: Tue, 13 Sep 2011 19:54:39 +0000 Subject: [PATCH 16/17] ant gen-thrift-java git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-1.0.0@1170325 13f79535-47bb-0310-9956-ffa450edef68 --- .../thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java b/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java index de7793176d..114881de8d 100644 --- a/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java +++ b/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java @@ -17041,6 +17041,8 @@ public class Cassandra { private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. + __isset_bit_vector = new BitSet(1); read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); From d9bd402bf51567bd9711bcbe1d74c80b7aec2595 Mon Sep 17 00:00:00 2001 From: Jonathan Ellis Date: Tue, 13 Sep 2011 20:28:12 +0000 Subject: [PATCH 17/17] revert CASSANDRA-2388 (again) git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-0.7@1170333 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 3 ++- .../org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 6c18b224de..c343c61e97 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,5 +1,6 @@ 0.7.10 * Fix divide by zero error in GCInspector (CASSANDRA-3164) + * revert CASSANDRA-2388 0.7.9 @@ -8,7 +9,7 @@ * prune index scan resultset back to original request for lazy resultset expansion case (CASSANDRA-2964) * (Hadoop) fail jobs when Cassandra node has failed but TaskTracker - has not (CASSANDRA-2388) + has not (CASSANDRA-2388) * avoid retaining references to dropped CFS objects in CompactionManager.estimatedCompactions (CASSANDRA-2708) * remove gossip state when a new IP takes over a token (CASSANDRA-3071) diff --git a/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java b/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java index aa2b9f12f0..b0bf427951 100644 --- a/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java +++ b/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java @@ -138,6 +138,8 @@ public class ColumnFamilyRecordReader extends RecordReader>>