Author: gdusbabek
Date: Thu Mar 3 22:54:56 2011
New Revision: 1076866
URL: http://svn.apache.org/viewvc?rev=1076866&view=rev
Log:
initialize localendpoint in gossiper earlier. patch by gdusbabek, reviewed by
jbellis. CASSANDRA-2228
Modified:
cassandra/branches/cassandra-0.7/CHANGES.txt
cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/gms/Gossiper.java
cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageService.java
cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/cli/CliTest.java
cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/service/RemoveTest.java
Modified: cassandra/branches/cassandra-0.7/CHANGES.txt
URL:
http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/CHANGES.txt?rev=1076866&r1=1076865&r2=1076866&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/CHANGES.txt (original)
+++ cassandra/branches/cassandra-0.7/CHANGES.txt Thu Mar 3 22:54:56 2011
@@ -1,7 +1,7 @@
0.7.4
* add nodetool join command (CASSANDRA-2160)
* fix secondary indexes on pre-existing or streamed data (CASSANDRA-2244)
-
+ * initialize endpoing in gossiper earlier (CASSANDRA-2228)
0.7.3
* Keep endpoint state until aVeryLongTime (CASSANDRA-2115)
Modified:
cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/gms/Gossiper.java
URL:
http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/gms/Gossiper.java?rev=1076866&r1=1076865&r2=1076866&view=diff
==============================================================================
---
cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/gms/Gossiper.java
(original)
+++
cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/gms/Gossiper.java
Thu Mar 3 22:54:56 2011
@@ -26,6 +26,7 @@ import java.util.*;
import java.util.Map.Entry;
import java.util.concurrent.*;
+import org.apache.cassandra.utils.FBUtilities;
import org.cliffc.high_scale_lib.NonBlockingHashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -149,6 +150,7 @@ public class Gossiper implements IFailur
private Gossiper()
{
+ localEndpoint_ = FBUtilities.getLocalAddress();
// 3 days
aVeryLongTime_ = 259200 * 1000;
// half of QUARATINE_DELAY, to ensure justRemovedEndpoints has enough
leeway to prevent re-gossip
@@ -870,14 +872,13 @@ public class Gossiper implements IFailur
* Start the gossiper with the generation # retrieved from the System
* table
*/
- public void start(InetAddress localEndpoint, int generationNbr)
+ public void start(int generationNbr)
{
- localEndpoint_ = localEndpoint;
/* Get the seeds from the config and initialize them. */
Set<InetAddress> seedHosts = DatabaseDescriptor.getSeeds();
for (InetAddress seed : seedHosts)
{
- if (seed.equals(localEndpoint))
+ if (seed.equals(localEndpoint_))
continue;
seeds_.add(seed);
}
Modified:
cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageService.java
URL:
http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageService.java?rev=1076866&r1=1076865&r2=1076866&view=diff
==============================================================================
---
cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageService.java
(original)
+++
cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageService.java
Thu Mar 3 22:54:56 2011
@@ -282,7 +282,7 @@ public class StorageService implements I
if (!initialized)
{
logger_.warn("Starting gossip by operator request");
- Gossiper.instance.start(FBUtilities.getLocalAddress(),
(int)(System.currentTimeMillis() / 1000));
+ Gossiper.instance.start((int)(System.currentTimeMillis() / 1000));
initialized = true;
}
}
@@ -343,7 +343,7 @@ public class StorageService implements I
logger_.info("Starting up client gossip");
setMode("Client", false);
Gossiper.instance.register(this);
- Gossiper.instance.start(FBUtilities.getLocalAddress(),
(int)(System.currentTimeMillis() / 1000)); // needed for node-ring gathering.
+ Gossiper.instance.start((int)(System.currentTimeMillis() / 1000)); //
needed for node-ring gathering.
MessagingService.instance().listen(FBUtilities.getLocalAddress());
// sleep a while to allow gossip to warm up (the other nodes need to
know about this one before they can reply).
@@ -418,7 +418,7 @@ public class StorageService implements I
// (we won't be part of the storage ring though until we add a nodeId
to our state, below.)
Gossiper.instance.register(this);
Gossiper.instance.register(migrationManager);
- Gossiper.instance.start(FBUtilities.getLocalAddress(),
SystemTable.incrementAndGetGeneration()); // needed for node-ring gathering.
+ Gossiper.instance.start(SystemTable.incrementAndGetGeneration()); //
needed for node-ring gathering.
MessagingService.instance().listen(FBUtilities.getLocalAddress());
StorageLoadBalancer.instance.startBroadcasting();
Modified:
cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/cli/CliTest.java
URL:
http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/cli/CliTest.java?rev=1076866&r1=1076865&r2=1076866&view=diff
==============================================================================
---
cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/cli/CliTest.java
(original)
+++
cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/cli/CliTest.java
Thu Mar 3 22:54:56 2011
@@ -145,7 +145,7 @@ public class CliTest extends CleanupHelp
"HELP",
"?"
};
-
+
@Test
public void testCli() throws IOException, TTransportException,
ConfigurationException
{
Modified:
cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/service/RemoveTest.java
URL:
http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/service/RemoveTest.java?rev=1076866&r1=1076865&r2=1076866&view=diff
==============================================================================
---
cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/service/RemoveTest.java
(original)
+++
cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/service/RemoveTest.java
Thu Mar 3 22:54:56 2011
@@ -72,7 +72,7 @@ public class RemoveTest extends CleanupH
Util.createInitialRing(ss, partitioner, endpointTokens, keyTokens,
hosts, 6);
MessagingService.instance().listen(FBUtilities.getLocalAddress());
- Gossiper.instance.start(FBUtilities.getLocalAddress(), 1);
+ Gossiper.instance.start(1);
for (int i = 0; i < 6; i++)
{
Gossiper.instance.initializeNodeUnsafe(hosts.get(i), 1);