You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by yu...@apache.org on 2012/07/27 17:19:38 UTC

[23/50] [abbrv] git commit: Merge #4427 to trunk

Merge #4427 to trunk


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/34cd6912
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/34cd6912
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/34cd6912

Branch: refs/heads/cassandra-1.1
Commit: 34cd6912b0e506f923ef33329fc9966d79222e77
Parents: 8d6fe24 ff64c5d
Author: Brandon Williams <br...@apache.org>
Authored: Mon Jul 23 11:22:37 2012 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Mon Jul 23 11:22:37 2012 -0500

----------------------------------------------------------------------
 CHANGES.txt                                        |    6 +++
 debian/cassandra.postinst                          |   10 +++++-
 doc/cql3/CQL.textile                               |    7 +++-
 .../org/apache/cassandra/config/CFMetaData.java    |   25 +++++++++++++
 src/java/org/apache/cassandra/db/SystemTable.java  |   28 ++++++++++++---
 src/java/org/apache/cassandra/dht/Bounds.java      |    5 ++-
 .../apache/cassandra/service/StorageService.java   |   25 +++++++++----
 test/unit/org/apache/cassandra/cli/CliTest.java    |    8 ++++
 8 files changed, 97 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/34cd6912/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index e9fdbf4,b2a9faf..55d0bcd
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,38 -1,6 +1,40 @@@
 +1.2-dev
 + * Introduce new json format with row level deletion (CASSANDRA-4054)
 + * remove redundant "name" column from schema_keyspaces (CASSANDRA-4433)
 + * improve "nodetool ring" handling of multi-dc clusters (CASSANDRA-3047)
 + * update NTS calculateNaturalEndpoints to be O(N log N) (CASSANDRA-3881)
 + * add UseCondCardMark XX jvm settings on jdk 1.7 (CASSANDRA-4366)
 + * split up rpc timeout by operation type (CASSANDRA-2819)
 + * rewrite key cache save/load to use only sequential i/o (CASSANDRA-3762)
 + * update MS protocol with a version handshake + broadcast address id
 +   (CASSANDRA-4311)
 + * multithreaded hint replay (CASSANDRA-4189)
 + * add inter-node message compression (CASSANDRA-3127)
 + * remove COPP (CASSANDRA-2479)
 + * Track tombstone expiration and compact when tombstone content is
 +   higher than a configurable threshold, default 20% (CASSANDRA-3442, 4234)
 + * update MurmurHash to version 3 (CASSANDRA-2975)
 + * (CLI) track elapsed time for `delete' operation (CASSANDRA-4060)
 + * (CLI) jline version is bumped to 1.0 to properly  support
 +   'delete' key function (CASSANDRA-4132)
 + * Save IndexSummary into new SSTable 'Summary' component (CASSANDRA-2392, 4289)
 + * Add support for range tombstones (CASSANDRA-3708)
 + * Improve MessagingService efficiency (CASSANDRA-3617)
 + * Avoid ID conflicts from concurrent schema changes (CASSANDRA-3794)
 + * Set thrift HSHA server thread limit to unlimited by default (CASSANDRA-4277)
 + * Avoids double serialization of CF id in RowMutation messages
 +   (CASSANDRA-4293)
 + * stream compressed sstables directly with java nio (CASSANDRA-4297)
 + * Support multiple ranges in SliceQueryFilter (CASSANDRA-3885)
 + * Add column metadata to system column families (CASSANDRA-4018)
 + * (cql3) Always use composite types by default (CASSANDRA-4329)
 + * (cql3) Add support for set, map and list (CASSANDRA-3647)
 + * Validate date type correctly (CASSANDRA-4441)
 +
 +
  1.1.3
+  * flush based on data size, not throughput; overwritten columns no 
+    longer artificially inflate liveRatio (CASSANDRA-4399)
   * update default commitlog segment size to 32MB and total commitlog
     size to 32/1024 MB for 32/64 bit JVMs, respectively (CASSANDRA-4422)
   * avoid using global partitioner to estimate ranges in index sstables

http://git-wip-us.apache.org/repos/asf/cassandra/blob/34cd6912/src/java/org/apache/cassandra/config/CFMetaData.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/34cd6912/src/java/org/apache/cassandra/db/SystemTable.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/SystemTable.java
index 48d9151,af07156..e852003
--- a/src/java/org/apache/cassandra/db/SystemTable.java
+++ b/src/java/org/apache/cassandra/db/SystemTable.java
@@@ -358,20 -359,45 +365,31 @@@ public class SystemTabl
          return generation;
      }
  
-     public static boolean isBootstrapped()
+     public static BootstrapState getBootstrapState()
      {
 -        Table table = Table.open(Table.SYSTEM_TABLE);
 -        QueryFilter filter = QueryFilter.getNamesFilter(decorate(BOOTSTRAP_KEY),
 -                                                        new QueryPath(STATUS_CF),
 -                                                        BOOTSTRAP);
 -        ColumnFamily cf = table.getColumnFamilyStore(STATUS_CF).getColumnFamily(filter);
 -        if (cf == null)
 +        String req = "SELECT bootstrapped FROM system.%s WHERE key='%s'";
 +        UntypedResultSet result = processInternal(String.format(req, LOCAL_CF, LOCAL_KEY));
 +
 +        if (result.isEmpty() || !result.one().has("bootstrapped"))
-             return false;
-         return result.one().getBoolean("bootstrapped");
+             return BootstrapState.NEEDS_BOOTSTRAP;
 -        IColumn c = cf.getColumn(BOOTSTRAP);
 -        return BootstrapState.values()[c.value().get(c.value().position())];
++        return BootstrapState.values()[result.one().getInt("bootstrapped")];
+     }
+ 
+     public static boolean bootstrapComplete()
+     {
+         return getBootstrapState() == BootstrapState.COMPLETED;
      }
  
-     public static void setBootstrapped(boolean isBootstrapped)
+     public static boolean bootstrapInProgress()
+     {
+         return getBootstrapState() == BootstrapState.IN_PROGRESS;
+     }
+ 
+     public static void setBootstrapState(BootstrapState state)
      {
 -        ColumnFamily cf = ColumnFamily.create(Table.SYSTEM_TABLE, STATUS_CF);
 -        cf.addColumn(new Column(BOOTSTRAP,
 -                                ByteBuffer.wrap(new byte[] { (byte) (state.ordinal()) }),
 -                                FBUtilities.timestampMicros()));
 -        RowMutation rm = new RowMutation(Table.SYSTEM_TABLE, BOOTSTRAP_KEY);
 -        rm.add(cf);
 -        try
 -        {
 -            rm.apply();
 -        }
 -        catch (IOException e)
 -        {
 -            throw new RuntimeException(e);
 -        }
 +        String req = "INSERT INTO system.%s (key, bootstrapped) VALUES ('%s', '%b')";
-         processInternal(String.format(req, LOCAL_CF, LOCAL_KEY, isBootstrapped));
++        processInternal(String.format(req, LOCAL_CF, LOCAL_KEY, getBootstrapState()));
++        forceBlockingFlush(LOCAL_CF);
      }
  
      public static boolean isIndexBuilt(String table, String indexName)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/34cd6912/src/java/org/apache/cassandra/dht/Bounds.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/34cd6912/src/java/org/apache/cassandra/service/StorageService.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/service/StorageService.java
index 621b06b,28a3551..d8bed6f
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@@ -513,17 -559,26 +513,26 @@@ public class StorageService implements 
  
          if (DatabaseDescriptor.isAutoBootstrap()
                  && DatabaseDescriptor.getSeeds().contains(FBUtilities.getBroadcastAddress())
-                 && !SystemTable.isBootstrapped())
+                 && !SystemTable.bootstrapComplete())
 -            logger_.info("This node will not auto bootstrap because it is configured to be a seed node.");
 +            logger.info("This node will not auto bootstrap because it is configured to be a seed node.");
  
 -        InetAddress current = null;
 +        Set<InetAddress> current = new HashSet<InetAddress>();
-         // first startup is only chance to bootstrap
 +        Collection<Token> tokens;
+         // we can bootstrap at startup, or if we detect a previous attempt that failed, which is to say:
+         // DD.isAutoBootstrap must be true AND:
+         //  bootstrap is not recorded as complete, OR
+         //  DD.getSeeds does not contain our BCA, OR
+         //  we do not have non-system tables already
+         // OR:
+         //  we detect that we were previously trying to bootstrap (ST.bootstrapInProgress is true)
 -        Token<?> token;
          if (DatabaseDescriptor.isAutoBootstrap()
-             && !(SystemTable.isBootstrapped()
-                  || DatabaseDescriptor.getSeeds().contains(FBUtilities.getBroadcastAddress())
-                  || !Schema.instance.getNonSystemTables().isEmpty()))
+                 && !(SystemTable.bootstrapComplete() || DatabaseDescriptor.getSeeds().contains(FBUtilities.getBroadcastAddress()) || !Schema.instance.getNonSystemTables().isEmpty())
+                 || SystemTable.bootstrapInProgress())
          {
+             if (SystemTable.bootstrapInProgress())
 -                logger_.warn("Detected previous bootstrap failure; retrying");
++                logger.warn("Detected previous bootstrap failure; retrying");
+             else
+                 SystemTable.setBootstrapState(SystemTable.BootstrapState.IN_PROGRESS);
              setMode(Mode.JOINING, "waiting for ring and schema information", true);
              // first sleep the delay to make sure we see the schema
              try
@@@ -679,14 -667,13 +688,14 @@@
          if (!isSurveyMode)
          {
              // start participating in the ring.
-             SystemTable.setBootstrapped(true);
+             SystemTable.setBootstrapState(SystemTable.BootstrapState.COMPLETED);
 -            setToken(token);
 +            setTokens(tokens);
              // remove the existing info about the replaced node.
 -            if (current != null)
 -                Gossiper.instance.replacedEndpoint(current);
 -            logger_.info("Bootstrap/Replace/Move completed! Now serving reads.");
 -            assert tokenMetadata_.sortedTokens().size() > 0;
 +            if (!current.isEmpty())
 +                for (InetAddress existing : current)
 +                    Gossiper.instance.replacedEndpoint(existing);
 +            logger.info("Bootstrap/Replace/Move completed! Now serving reads.");
 +            assert tokenMetadata.sortedTokens().size() > 0;
          }
          else
          {
@@@ -703,11 -690,11 +712,11 @@@
          }
          else if (isSurveyMode)
          {
 -            setToken(SystemTable.getSavedToken());
 +            setTokens(SystemTable.getSavedTokens());
-             SystemTable.setBootstrapped(true);
+             SystemTable.setBootstrapState(SystemTable.BootstrapState.COMPLETED);
              isSurveyMode = false;
 -            logger_.info("Leaving write survey mode and joining ring at operator request");
 -            assert tokenMetadata_.sortedTokens().size() > 0;
 +            logger.info("Leaving write survey mode and joining ring at operator request");
 +            assert tokenMetadata.sortedTokens().size() > 0;
          }
      }
  
@@@ -2423,13 -2282,13 +2432,13 @@@
  
      private void leaveRing()
      {
-         SystemTable.setBootstrapped(false);
+         SystemTable.setBootstrapState(SystemTable.BootstrapState.NEEDS_BOOTSTRAP);
 -        tokenMetadata_.removeEndpoint(FBUtilities.getBroadcastAddress());
 +        tokenMetadata.removeEndpoint(FBUtilities.getBroadcastAddress());
          calculatePendingRanges();
  
 -        Gossiper.instance.addLocalApplicationState(ApplicationState.STATUS, valueFactory.left(getLocalToken(),Gossiper.computeExpireTime()));
 +        Gossiper.instance.addLocalApplicationState(ApplicationState.STATUS, valueFactory.left(getLocalTokens(),Gossiper.computeExpireTime()));
          int delay = Math.max(RING_DELAY, Gossiper.intervalInMillis * 2);
 -        logger_.info("Announcing that I have left the ring for " + delay + "ms");
 +        logger.info("Announcing that I have left the ring for " + delay + "ms");
          try
          {
              Thread.sleep(delay);