cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eev...@apache.org
Subject svn commit: r1038864 - in /cassandra/trunk: ./ bin/ debian/ interface/thrift/gen-java/org/apache/cassandra/thrift/ src/java/org/apache/cassandra/cli/ src/java/org/apache/cassandra/db/ src/java/org/apache/cassandra/db/migration/ src/java/org/apache/cass...
Date Wed, 24 Nov 2010 23:04:39 GMT
Author: eevans
Date: Wed Nov 24 23:04:38 2010
New Revision: 1038864

URL: http://svn.apache.org/viewvc?rev=1038864&view=rev
Log:
merge w/ 0.7 branch

Modified:
    cassandra/trunk/   (props changed)
    cassandra/trunk/CHANGES.txt
    cassandra/trunk/bin/json2sstable
    cassandra/trunk/debian/init
    cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java 
 (props changed)
    cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java   (props
changed)
    cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java
  (props changed)
    cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java
  (props changed)
    cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java
  (props changed)
    cassandra/trunk/src/java/org/apache/cassandra/cli/CliMain.java
    cassandra/trunk/src/java/org/apache/cassandra/db/Table.java
    cassandra/trunk/src/java/org/apache/cassandra/db/migration/UpdateKeyspace.java
    cassandra/trunk/src/java/org/apache/cassandra/dht/BootStrapper.java
    cassandra/trunk/src/java/org/apache/cassandra/locator/TokenMetadata.java
    cassandra/trunk/src/java/org/apache/cassandra/service/DatacenterQuorumResponseHandler.java
    cassandra/trunk/src/java/org/apache/cassandra/service/DatacenterSyncWriteResponseHandler.java
    cassandra/trunk/src/java/org/apache/cassandra/service/DatacenterWriteResponseHandler.java
    cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java
    cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java
    cassandra/trunk/test/unit/org/apache/cassandra/locator/ReplicationStrategyEndpointCacheTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/locator/SimpleStrategyTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/service/AntiEntropyServiceTest.java

Propchange: cassandra/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Nov 24 23:04:38 2010
@@ -1,5 +1,5 @@
 /cassandra/branches/cassandra-0.6:922689-1037847
-/cassandra/branches/cassandra-0.7:1026517-1038283
+/cassandra/branches/cassandra-0.7:1026517-1038863
 /incubator/cassandra/branches/cassandra-0.3:774578-796573
 /incubator/cassandra/branches/cassandra-0.4:810145-834239,834349-834350
 /incubator/cassandra/branches/cassandra-0.5:888872-915439

Modified: cassandra/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/trunk/CHANGES.txt?rev=1038864&r1=1038863&r2=1038864&view=diff
==============================================================================
--- cassandra/trunk/CHANGES.txt (original)
+++ cassandra/trunk/CHANGES.txt Wed Nov 24 23:04:38 2010
@@ -8,6 +8,9 @@ dev
  * require index_type to be present when specifying index_name
    on ColumnDef (CASSANDRA-1759)
  * fix add/remove index bugs in CFMetadata (CASSANDRA-1768)
+ * rebuild Strategy during system_update_keyspace (CASSANDRA-1762)
+ * cli updates prompt to ... in continuation lines (CASSANDRA-1770)
+ * improvements to Debian init script (CASSANDRA-1772)
 
 
 0.7.0-rc1

Modified: cassandra/trunk/bin/json2sstable
URL: http://svn.apache.org/viewvc/cassandra/trunk/bin/json2sstable?rev=1038864&r1=1038863&r2=1038864&view=diff
==============================================================================
--- cassandra/trunk/bin/json2sstable (original)
+++ cassandra/trunk/bin/json2sstable Wed Nov 24 23:04:38 2010
@@ -1,50 +1,50 @@
-#!/bin/sh
-
-# 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.
-
-if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
-    for include in /usr/share/cassandra/cassandra.in.sh \
-                   /usr/local/share/cassandra/cassandra.in.sh \
-                   /opt/cassandra/cassandra.in.sh \
-                   ~/.cassandra.in.sh \
-                   `dirname $0`/cassandra.in.sh; do
-        if [ -r $include ]; then
-            . $include
-            break
-        fi
-    done
-elif [ -r $CASSANDRA_INCLUDE ]; then
-    . $CASSANDRA_INCLUDE
-fi
-
-# Use JAVA_HOME if set, otherwise look for java in PATH
-if [ -x $JAVA_HOME/bin/java ]; then
-    JAVA=$JAVA_HOME/bin/java
-else
-    JAVA=`which java`
-fi
-
-if [ -z $CLASSPATH ]; then
-    echo "You must set the CLASSPATH var" >&2
-    exit 1
-fi
-
-$JAVA -cp $CLASSPATH  -Dstorage-config=$CASSANDRA_CONF \
-        -Dlog4j.configuration=log4j-tools.properties \
-        org.apache.cassandra.tools.SSTableImport "$@"
-
-# vi:ai sw=4 ts=4 tw=0 et
+#!/bin/sh
+
+# 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.
+
+if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
+    for include in /usr/share/cassandra/cassandra.in.sh \
+                   /usr/local/share/cassandra/cassandra.in.sh \
+                   /opt/cassandra/cassandra.in.sh \
+                   ~/.cassandra.in.sh \
+                   `dirname $0`/cassandra.in.sh; do
+        if [ -r $include ]; then
+            . $include
+            break
+        fi
+    done
+elif [ -r $CASSANDRA_INCLUDE ]; then
+    . $CASSANDRA_INCLUDE
+fi
+
+# Use JAVA_HOME if set, otherwise look for java in PATH
+if [ -x $JAVA_HOME/bin/java ]; then
+    JAVA=$JAVA_HOME/bin/java
+else
+    JAVA=`which java`
+fi
+
+if [ -z $CLASSPATH ]; then
+    echo "You must set the CLASSPATH var" >&2
+    exit 1
+fi
+
+$JAVA -cp $CLASSPATH  -Dstorage-config=$CASSANDRA_CONF \
+        -Dlog4j.configuration=log4j-tools.properties \
+        org.apache.cassandra.tools.SSTableImport "$@"
+
+# vi:ai sw=4 ts=4 tw=0 et

Modified: cassandra/trunk/debian/init
URL: http://svn.apache.org/viewvc/cassandra/trunk/debian/init?rev=1038864&r1=1038863&r2=1038864&view=diff
==============================================================================
--- cassandra/trunk/debian/init (original)
+++ cassandra/trunk/debian/init Wed Nov 24 23:04:38 2010
@@ -18,6 +18,7 @@ PIDFILE=/var/run/$NAME.pid
 SCRIPTNAME=/etc/init.d/$NAME
 CONFDIR=/etc/cassandra
 JSVC=/usr/bin/jsvc
+WAIT_FOR_START=10
 
 # The first existing directory is used for JAVA_HOME if needed.
 JVM_SEARCH_DIRS="/usr/lib/jvm/java-6-openjdk /usr/lib/jvm/java-6-sun"
@@ -87,16 +88,21 @@ classpath()
 }
 
 #
-# Function that returns 0 if process is running, 1 if not
+# Function that returns 0 if process is running, or nonzero if not.
 #
+# The nonzero value is 3 if the process is simply not running, and 1 if the
+# process is not running but the pidfile exists (to match the exit codes for
+# the "status" command; see LSB core spec 3.1, section 20.2)
+#
+CMD_PATT="-user.cassandra.+CassandraDaemon"
 is_running()
 {
     if [ -f $PIDFILE ]; then
-        if ps -p `cat $PIDFILE` &> /dev/null; then
-            return 0
-        fi
+        pid=`cat $PIDFILE`
+        grep -Eq "$CMD_PATT" "/proc/$pid/cmdline" 2>/dev/null && return 0
+        return 1
     fi
-    return 1
+    return 3
 }
 
 #
@@ -121,7 +127,12 @@ do_start()
         $JVM_OPTS \
         org.apache.cassandra.thrift.CassandraDaemon
 
-    if ! is_running; then return 2; fi
+    is_running && return 0
+    for tries in `seq $WAIT_FOR_START`; do
+        sleep 1
+        is_running && return 0
+    done
+    return 2
 }
 
 #
@@ -175,8 +186,18 @@ case "$1" in
 		;;
 	esac
 	;;
+  status)
+    is_running
+    stat=$?
+    case "$stat" in
+      0) log_success_msg "$DESC is running" ;;
+      1) log_failure_msg "could not access pidfile for $DESC" ;;
+      *) log_success_msg "$DESC is not running" ;;
+    esac
+    exit "$stat"
+    ;;
   *)
-	echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
+	echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2
 	exit 3
 	;;
 esac

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Nov 24 23:04:38 2010
@@ -1,5 +1,5 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:922689-1037847
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1026517-1038283
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1026517-1038863
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/Cassandra.java:774578-796573
 /incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/Cassandra.java:810145-834239,834349-834350
 /incubator/cassandra/branches/cassandra-0.5/interface/gen-java/org/apache/cassandra/service/Cassandra.java:888872-903502

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Nov 24 23:04:38 2010
@@ -1,5 +1,5 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:922689-1037847
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1026517-1038283
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1026517-1038863
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/column_t.java:774578-792198
 /incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/Column.java:810145-834239,834349-834350
 /incubator/cassandra/branches/cassandra-0.5/interface/gen-java/org/apache/cassandra/service/Column.java:888872-903502

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Nov 24 23:04:38 2010
@@ -1,5 +1,5 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:922689-1037847
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1026517-1038283
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1026517-1038863
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/InvalidRequestException.java:774578-796573
 /incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/InvalidRequestException.java:810145-834239,834349-834350
 /incubator/cassandra/branches/cassandra-0.5/interface/gen-java/org/apache/cassandra/service/InvalidRequestException.java:888872-903502

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Nov 24 23:04:38 2010
@@ -1,5 +1,5 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:922689-1037847
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1026517-1038283
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1026517-1038863
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/NotFoundException.java:774578-796573
 /incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/NotFoundException.java:810145-834239,834349-834350
 /incubator/cassandra/branches/cassandra-0.5/interface/gen-java/org/apache/cassandra/service/NotFoundException.java:888872-903502

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Nov 24 23:04:38 2010
@@ -1,5 +1,5 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:922689-1037847
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1026517-1038283
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1026517-1038863
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/superColumn_t.java:774578-792198
 /incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/SuperColumn.java:810145-834239,834349-834350
 /incubator/cassandra/branches/cassandra-0.5/interface/gen-java/org/apache/cassandra/service/SuperColumn.java:888872-903502

Modified: cassandra/trunk/src/java/org/apache/cassandra/cli/CliMain.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cli/CliMain.java?rev=1038864&r1=1038863&r2=1038864&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cli/CliMain.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cli/CliMain.java Wed Nov 24 23:04:38 2010
@@ -183,7 +183,7 @@ public class CliMain
     private static void printBanner()
     {
         sessionState.out.println("Welcome to cassandra CLI.\n");
-        sessionState.out.println("Type 'help' or '?' for help. Type 'quit' or 'exit' to quit.");
+        sessionState.out.println("Type 'help;' or '?' for help. Type 'quit;' or 'exit;' to
quit.");
     }
 
     /**
@@ -323,7 +323,7 @@ public class CliMain
 
         while (line != null)
         {
-            prompt = (inCompoundStatement) ? "\t" : getPrompt(cliClient);
+            prompt = (inCompoundStatement) ? "...\t" : getPrompt(cliClient);
 
             line = reader.readLine(prompt).trim();
 
@@ -332,7 +332,7 @@ public class CliMain
 
             currentStatement += line;
 
-            if (line.endsWith(";"))
+            if (line.endsWith(";") || line.equals("?"))
             {
                 processStatement(currentStatement);
                 currentStatement = "";

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/Table.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/Table.java?rev=1038864&r1=1038863&r2=1038864&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/Table.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/Table.java Wed Nov 24 23:04:38 2010
@@ -96,7 +96,7 @@ public class Table
     public final Map<Integer, ColumnFamilyStore> columnFamilyStores = new HashMap<Integer,
ColumnFamilyStore>(); // TODO make private again
     private final Object[] indexLocks;
     private ScheduledFuture<?> flushTask;
-    public final AbstractReplicationStrategy replicationStrategy;
+    private volatile AbstractReplicationStrategy replicationStrategy;
 
     public static Table open(String table)
     {
@@ -244,11 +244,7 @@ public class Table
         KSMetaData ksm = DatabaseDescriptor.getKSMetaData(table);
         try
         {
-            replicationStrategy = AbstractReplicationStrategy.createReplicationStrategy(table,
-                                                                                        ksm.strategyClass,
-                                                                                        StorageService.instance.getTokenMetadata(),
-                                                                                        DatabaseDescriptor.getEndpointSnitch(),
-                                                                                        ksm.strategyOptions);
+            createReplicationStrategy(ksm);
         }
         catch (ConfigurationException e)
         {
@@ -302,7 +298,19 @@ public class Table
         };
         flushTask = StorageService.scheduledTasks.scheduleWithFixedDelay(runnable, minCheckMs,
minCheckMs, TimeUnit.MILLISECONDS);
     }
-    
+
+    public void createReplicationStrategy(KSMetaData ksm) throws ConfigurationException
+    {
+        if (replicationStrategy != null)
+            StorageService.instance.getTokenMetadata().unregister(replicationStrategy);
+            
+        replicationStrategy = AbstractReplicationStrategy.createReplicationStrategy(ksm.name,
+                                                                                    ksm.strategyClass,
+                                                                                    StorageService.instance.getTokenMetadata(),
+                                                                                    DatabaseDescriptor.getEndpointSnitch(),
+                                                                                    ksm.strategyOptions);
+    }
+
     // best invoked on the compaction mananger.
     public void dropCf(Integer cfId) throws IOException
     {
@@ -557,6 +565,11 @@ public class Table
         return new IndexBuilder(cfs, columns, iter);
     }
 
+    public AbstractReplicationStrategy getReplicationStrategy()
+    {
+        return replicationStrategy;
+    }
+
     public class IndexBuilder implements ICompactionInfo
     {
         private final ColumnFamilyStore cfs;

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/migration/UpdateKeyspace.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/migration/UpdateKeyspace.java?rev=1038864&r1=1038863&r2=1038864&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/migration/UpdateKeyspace.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/migration/UpdateKeyspace.java Wed Nov
24 23:04:38 2010
@@ -5,6 +5,7 @@ import org.apache.cassandra.config.Confi
 import org.apache.cassandra.config.DatabaseDescriptor;
 import org.apache.cassandra.config.KSMetaData;
 import org.apache.cassandra.db.Table;
+import org.apache.cassandra.service.StorageService;
 import org.apache.cassandra.utils.FBUtilities;
 import org.apache.cassandra.utils.UUIDGen;
 
@@ -59,7 +60,18 @@ public class UpdateKeyspace extends Migr
     {
         DatabaseDescriptor.clearTableDefinition(oldKsm, newVersion);
         DatabaseDescriptor.setTableDefinition(newKsm, newVersion);
-        Table.open(newKsm.name).replicationStrategy.clearEndpointCache();
+
+
+        Table table = Table.open(newKsm.name);
+        try
+        {
+            table.createReplicationStrategy(newKsm);
+        }
+        catch (ConfigurationException e)
+        {
+            throw new IOException(e);
+        }
+
         logger.info("Keyspace updated. Please perform any manual operations.");
     }
 

Modified: cassandra/trunk/src/java/org/apache/cassandra/dht/BootStrapper.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/dht/BootStrapper.java?rev=1038864&r1=1038863&r2=1038864&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/dht/BootStrapper.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/dht/BootStrapper.java Wed Nov 24 23:04:38
2010
@@ -191,7 +191,7 @@ public class BootStrapper
     Multimap<Range, InetAddress> getRangesWithSources(String table)
     {
         assert tokenMetadata.sortedTokens().size() > 0;
-        final AbstractReplicationStrategy strat = Table.open(table).replicationStrategy;
+        final AbstractReplicationStrategy strat = Table.open(table).getReplicationStrategy();
         Collection<Range> myRanges = strat.getPendingAddressRanges(tokenMetadata, token,
address);
 
         Multimap<Range, InetAddress> myRangeAddresses = ArrayListMultimap.create();

Modified: cassandra/trunk/src/java/org/apache/cassandra/locator/TokenMetadata.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/locator/TokenMetadata.java?rev=1038864&r1=1038863&r2=1038864&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/locator/TokenMetadata.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/locator/TokenMetadata.java Wed Nov 24 23:04:38
2010
@@ -540,6 +540,11 @@ public class TokenMetadata
         subscribers.add(subscriber);
     }
 
+    public void unregister(AbstractReplicationStrategy subscriber)
+    {
+        subscribers.remove(subscriber);
+    }
+
     /**
      * write endpoints may be different from read endpoints, because read endpoints only
need care about the
      * "natural" nodes for a token, but write endpoints also need to account for nodes that
are bootstrapping

Modified: cassandra/trunk/src/java/org/apache/cassandra/service/DatacenterQuorumResponseHandler.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/service/DatacenterQuorumResponseHandler.java?rev=1038864&r1=1038863&r2=1038864&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/service/DatacenterQuorumResponseHandler.java
(original)
+++ cassandra/trunk/src/java/org/apache/cassandra/service/DatacenterQuorumResponseHandler.java
Wed Nov 24 23:04:38 2010
@@ -65,7 +65,7 @@ public class DatacenterQuorumResponseHan
     @Override
     public int determineBlockFor(ConsistencyLevel consistency_level, String table)
 	{
-        NetworkTopologyStrategy stategy = (NetworkTopologyStrategy) Table.open(table).replicationStrategy;
+        NetworkTopologyStrategy stategy = (NetworkTopologyStrategy) Table.open(table).getReplicationStrategy();
 		return (stategy.getReplicationFactor(localdc) / 2) + 1;
 	}
 }

Modified: cassandra/trunk/src/java/org/apache/cassandra/service/DatacenterSyncWriteResponseHandler.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/service/DatacenterSyncWriteResponseHandler.java?rev=1038864&r1=1038863&r2=1038864&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/service/DatacenterSyncWriteResponseHandler.java
(original)
+++ cassandra/trunk/src/java/org/apache/cassandra/service/DatacenterSyncWriteResponseHandler.java
Wed Nov 24 23:04:38 2010
@@ -63,7 +63,7 @@ public class DatacenterSyncWriteResponse
         super(writeEndpoints, hintedEndpoints, consistencyLevel);
         assert consistencyLevel == ConsistencyLevel.LOCAL_QUORUM;
 
-        strategy = (NetworkTopologyStrategy) Table.open(table).replicationStrategy;
+        strategy = (NetworkTopologyStrategy) Table.open(table).getReplicationStrategy();
 
         for (String dc : strategy.getDatacenters())
         {

Modified: cassandra/trunk/src/java/org/apache/cassandra/service/DatacenterWriteResponseHandler.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/service/DatacenterWriteResponseHandler.java?rev=1038864&r1=1038863&r2=1038864&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/service/DatacenterWriteResponseHandler.java
(original)
+++ cassandra/trunk/src/java/org/apache/cassandra/service/DatacenterWriteResponseHandler.java
Wed Nov 24 23:04:38 2010
@@ -65,7 +65,7 @@ public class DatacenterWriteResponseHand
     @Override
     protected int determineBlockFor(String table)
     {
-        NetworkTopologyStrategy strategy = (NetworkTopologyStrategy) Table.open(table).replicationStrategy;
+        NetworkTopologyStrategy strategy = (NetworkTopologyStrategy) Table.open(table).getReplicationStrategy();
         return (strategy.getReplicationFactor(localdc) / 2) + 1;
     }
 

Modified: cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java?rev=1038864&r1=1038863&r2=1038864&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java Wed Nov 24 23:04:38
2010
@@ -105,7 +105,7 @@ public class StorageProxy implements Sto
             {
                 mostRecentRowMutation = rm;
                 String table = rm.getTable();
-                AbstractReplicationStrategy rs = Table.open(table).replicationStrategy;
+                AbstractReplicationStrategy rs = Table.open(table).getReplicationStrategy();
 
                 List<InetAddress> naturalEndpoints = ss.getNaturalEndpoints(table,
rm.key());
                 Collection<InetAddress> writeEndpoints = ss.getTokenMetadata().getWriteEndpoints(StorageService.getPartitioner().getToken(rm.key()),
table, naturalEndpoints);
@@ -343,7 +343,7 @@ public class StorageProxy implements Sto
                 if (logger.isDebugEnabled())
                     logger.debug("strongread reading " + (m == message ? "data" : "digest")
+ " for " + command + " from " + m.getMessageId() + "@" + endpoint);
             }
-            AbstractReplicationStrategy rs = Table.open(command.table).replicationStrategy;
+            AbstractReplicationStrategy rs = Table.open(command.table).getReplicationStrategy();
             QuorumResponseHandler<Row> quorumResponseHandler = rs.getQuorumResponseHandler(new
ReadResponseResolver(command.table), consistency_level);
             MessagingService.instance.sendRR(messages, endpoints, quorumResponseHandler);
             quorumResponseHandlers.add(quorumResponseHandler);
@@ -369,7 +369,7 @@ public class StorageProxy implements Sto
             }
             catch (DigestMismatchException ex)
             {
-                AbstractReplicationStrategy rs = Table.open(command.table).replicationStrategy;
+                AbstractReplicationStrategy rs = Table.open(command.table).getReplicationStrategy();
                 QuorumResponseHandler<Row> qrhRepair = rs.getQuorumResponseHandler(new
ReadResponseResolver(command.table), ConsistencyLevel.QUORUM);
                 if (logger.isDebugEnabled())
                     logger.debug("Digest mismatch:", ex);
@@ -449,7 +449,7 @@ public class StorageProxy implements Sto
 
                 // collect replies and resolve according to consistency level
                 RangeSliceResponseResolver resolver = new RangeSliceResponseResolver(command.keyspace,
liveEndpoints);
-                AbstractReplicationStrategy rs = Table.open(command.keyspace).replicationStrategy;
+                AbstractReplicationStrategy rs = Table.open(command.keyspace).getReplicationStrategy();
                 QuorumResponseHandler<List<Row>> handler = rs.getQuorumResponseHandler(resolver,
consistency_level);
                 // TODO bail early if live endpoints can't satisfy requested consistency
level
                 for (InetAddress endpoint : liveEndpoints) 
@@ -663,7 +663,7 @@ public class StorageProxy implements Sto
 
             // collect replies and resolve according to consistency level
             RangeSliceResponseResolver resolver = new RangeSliceResponseResolver(keyspace,
liveEndpoints);
-            AbstractReplicationStrategy rs = Table.open(keyspace).replicationStrategy;
+            AbstractReplicationStrategy rs = Table.open(keyspace).getReplicationStrategy();
             QuorumResponseHandler<List<Row>> handler = rs.getQuorumResponseHandler(resolver,
consistency_level);
             
             // bail early if live endpoints can't satisfy requested consistency level

Modified: cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java?rev=1038864&r1=1038863&r2=1038864&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java Wed Nov 24 23:04:38
2010
@@ -558,7 +558,7 @@ public class StorageService implements I
         Map<Range, List<InetAddress>> rangeToEndpointMap = new HashMap<Range,
List<InetAddress>>();
         for (Range range : ranges)
         {
-            rangeToEndpointMap.put(range, Table.open(keyspace).replicationStrategy.getNaturalEndpoints(range.right));
+            rangeToEndpointMap.put(range, Table.open(keyspace).getReplicationStrategy().getNaturalEndpoints(range.right));
         }
         return rangeToEndpointMap;
     }
@@ -824,7 +824,7 @@ public class StorageService implements I
     private void calculatePendingRanges()
     {
         for (String table : DatabaseDescriptor.getNonSystemTables())
-            calculatePendingRanges(Table.open(table).replicationStrategy, table);
+            calculatePendingRanges(Table.open(table).getReplicationStrategy(), table);
     }
 
     // public & static for testing purposes
@@ -894,7 +894,7 @@ public class StorageService implements I
     private Multimap<InetAddress, Range> getNewSourceRanges(String table, Set<Range>
ranges) 
     {
         InetAddress myAddress = FBUtilities.getLocalAddress();
-        Multimap<Range, InetAddress> rangeAddresses = Table.open(table).replicationStrategy.getRangeAddresses(tokenMetadata_);
+        Multimap<Range, InetAddress> rangeAddresses = Table.open(table).getReplicationStrategy().getRangeAddresses(tokenMetadata_);
         Multimap<InetAddress, Range> sourceRanges = HashMultimap.create();
         IFailureDetector failureDetector = FailureDetector.instance;
 
@@ -1017,7 +1017,7 @@ public class StorageService implements I
 
         // Find (for each range) all nodes that store replicas for these ranges as well
         for (Range range : ranges)
-            currentReplicaEndpoints.put(range, Table.open(table).replicationStrategy.calculateNaturalEndpoints(range.right,
tokenMetadata_));
+            currentReplicaEndpoints.put(range, Table.open(table).getReplicationStrategy().calculateNaturalEndpoints(range.right,
tokenMetadata_));
 
         TokenMetadata temp = tokenMetadata_.cloneAfterAllLeft();
 
@@ -1035,7 +1035,7 @@ public class StorageService implements I
         // range.
         for (Range range : ranges)
         {
-            Collection<InetAddress> newReplicaEndpoints = Table.open(table).replicationStrategy.calculateNaturalEndpoints(range.right,
temp);
+            Collection<InetAddress> newReplicaEndpoints = Table.open(table).getReplicationStrategy().calculateNaturalEndpoints(range.right,
temp);
             newReplicaEndpoints.removeAll(currentReplicaEndpoints.get(range));
             if (logger_.isDebugEnabled())
                 if (newReplicaEndpoints.isEmpty())
@@ -1359,7 +1359,7 @@ public class StorageService implements I
      */
     Collection<Range> getRangesForEndpoint(String table, InetAddress ep)
     {
-        return Table.open(table).replicationStrategy.getAddressRanges().get(ep);
+        return Table.open(table).getReplicationStrategy().getAddressRanges().get(ep);
     }
 
     /**
@@ -1409,7 +1409,7 @@ public class StorageService implements I
      */
     public List<InetAddress> getNaturalEndpoints(String table, Token token)
     {
-        return Table.open(table).replicationStrategy.getNaturalEndpoints(token);
+        return Table.open(table).getReplicationStrategy().getNaturalEndpoints(token);
     }
 
     /**
@@ -1427,7 +1427,7 @@ public class StorageService implements I
     public List<InetAddress> getLiveNaturalEndpoints(String table, Token token)
     {
         List<InetAddress> liveEps = new ArrayList<InetAddress>();
-        List<InetAddress> endpoints = Table.open(table).replicationStrategy.getNaturalEndpoints(token);
+        List<InetAddress> endpoints = Table.open(table).getReplicationStrategy().getNaturalEndpoints(token);
 
         for (InetAddress endpoint : endpoints)
         {

Modified: cassandra/trunk/test/unit/org/apache/cassandra/locator/ReplicationStrategyEndpointCacheTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/locator/ReplicationStrategyEndpointCacheTest.java?rev=1038864&r1=1038863&r2=1038864&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/locator/ReplicationStrategyEndpointCacheTest.java
(original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/locator/ReplicationStrategyEndpointCacheTest.java
Wed Nov 24 23:04:38 2010
@@ -43,7 +43,7 @@ public class ReplicationStrategyEndpoint
         tmd = new TokenMetadata();
         searchToken = new BigIntegerToken(String.valueOf(15));
 
-        strategy = getStrategyWithNewTokenMetadata(Table.open("Keyspace3").replicationStrategy,
tmd);
+        strategy = getStrategyWithNewTokenMetadata(Table.open("Keyspace3").getReplicationStrategy(),
tmd);
 
         tmd.updateNormalToken(new BigIntegerToken(String.valueOf(10)), InetAddress.getByName("127.0.0.1"));
         tmd.updateNormalToken(new BigIntegerToken(String.valueOf(20)), InetAddress.getByName("127.0.0.2"));

Modified: cassandra/trunk/test/unit/org/apache/cassandra/locator/SimpleStrategyTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/locator/SimpleStrategyTest.java?rev=1038864&r1=1038863&r2=1038864&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/locator/SimpleStrategyTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/locator/SimpleStrategyTest.java Wed Nov
24 23:04:38 2010
@@ -43,7 +43,7 @@ public class SimpleStrategyTest extends 
     @Test
     public void tryValidTable()
     {
-        assert Table.open("Keyspace1").replicationStrategy != null;
+        assert Table.open("Keyspace1").getReplicationStrategy() != null;
     }
 
     @Test

Modified: cassandra/trunk/test/unit/org/apache/cassandra/service/AntiEntropyServiceTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/service/AntiEntropyServiceTest.java?rev=1038864&r1=1038863&r2=1038864&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/service/AntiEntropyServiceTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/service/AntiEntropyServiceTest.java Wed
Nov 24 23:04:38 2010
@@ -183,7 +183,7 @@ public class AntiEntropyServiceTest exte
 
         // generate rf*2 nodes, and ensure that only neighbors specified by the ARS are returned
         addTokens(2 * DatabaseDescriptor.getReplicationFactor(tablename));
-        AbstractReplicationStrategy ars = Table.open(tablename).replicationStrategy;
+        AbstractReplicationStrategy ars = Table.open(tablename).getReplicationStrategy();
         Set<InetAddress> expected = new HashSet<InetAddress>();
         for (Range replicaRange : ars.getAddressRanges().get(FBUtilities.getLocalAddress()))
         {



Mime
View raw message