You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2014/09/30 21:11:21 UTC

[5/6] git commit: merge from 2.0

merge from 2.0


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

Branch: refs/heads/cassandra-2.1
Commit: 1394b128c65ef1ad59f765e9c9c5058cac04ca69
Parents: ef65d58 7bff183
Author: Jonathan Ellis <jb...@apache.org>
Authored: Tue Sep 30 14:08:29 2014 -0500
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Tue Sep 30 14:10:11 2014 -0500

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../cassandra/db/commitlog/CommitLog.java       | 17 +++++++++---
 .../db/commitlog/CommitLogArchiver.java         | 28 +++++++++++++++++++-
 3 files changed, 41 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/1394b128/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 9881a94,6f59a29..3c217e2
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,55 -1,9 +1,56 @@@
 -2.0.12:
 - * Archive any commitlog segments present at startup (CASSANDRA-6904)
 -
 -
 -2.0.11:
 +2.1.1
   * Ignore fat clients when checking for endpoint collision (CASSANDRA-7939)
 + * Make sstablerepairedset take a list of files (CASSANDRA-7995)
 + * (cqlsh) Tab completeion for indexes on map keys (CASSANDRA-7972)
 + * (cqlsh) Fix UDT field selection in select clause (CASSANDRA-7891)
 + * Fix resource leak in event of corrupt sstable
 + * (cqlsh) Add command line option for cqlshrc file path (CASSANDRA-7131)
 + * Provide visibility into prepared statements churn (CASSANDRA-7921, CASSANDRA-7930)
 + * Invalidate prepared statements when their keyspace or table is
 +   dropped (CASSANDRA-7566)
 + * cassandra-stress: fix support for NetworkTopologyStrategy (CASSANDRA-7945)
 + * Fix saving caches when a table is dropped (CASSANDRA-7784)
 + * Add better error checking of new stress profile (CASSANDRA-7716)
 + * Use ThreadLocalRandom and remove FBUtilities.threadLocalRandom (CASSANDRA-7934)
 + * Prevent operator mistakes due to simultaneous bootstrap (CASSANDRA-7069)
 + * cassandra-stress supports whitelist mode for node config (CASSANDRA-7658)
 + * GCInspector more closely tracks GC; cassandra-stress and nodetool report it (CASSANDRA-7916)
 + * nodetool won't output bogus ownership info without a keyspace (CASSANDRA-7173)
 + * Add human readable option to nodetool commands (CASSANDRA-5433)
 + * Don't try to set repairedAt on old sstables (CASSANDRA-7913)
 + * Add metrics for tracking PreparedStatement use (CASSANDRA-7719)
 + * (cqlsh) tab-completion for triggers (CASSANDRA-7824)
 + * (cqlsh) Support for query paging (CASSANDRA-7514)
 + * (cqlsh) Show progress of COPY operations (CASSANDRA-7789)
 + * Add syntax to remove multiple elements from a map (CASSANDRA-6599)
 + * Support non-equals conditions in lightweight transactions (CASSANDRA-6839)
 + * Add IF [NOT] EXISTS to create/drop triggers (CASSANDRA-7606)
 + * (cqlsh) Display the current logged-in user (CASSANDRA-7785)
 + * (cqlsh) Don't ignore CTRL-C during COPY FROM execution (CASSANDRA-7815)
 + * (cqlsh) Order UDTs according to cross-type dependencies in DESCRIBE
 +   output (CASSANDRA-7659)
 + * (cqlsh) Fix handling of CAS statement results (CASSANDRA-7671)
 + * (cqlsh) COPY TO/FROM improvements (CASSANDRA-7405)
 + * Support list index operations with conditions (CASSANDRA-7499)
 + * Add max live/tombstoned cells to nodetool cfstats output (CASSANDRA-7731)
 + * Validate IPv6 wildcard addresses properly (CASSANDRA-7680)
 + * (cqlsh) Error when tracing query (CASSANDRA-7613)
 + * Avoid IOOBE when building SyntaxError message snippet (CASSANDRA-7569)
 + * SSTableExport uses correct validator to create string representation of partition
 +   keys (CASSANDRA-7498)
 + * Avoid NPEs when receiving type changes for an unknown keyspace (CASSANDRA-7689)
 + * Add support for custom 2i validation (CASSANDRA-7575)
 + * Pig support for hadoop CqlInputFormat (CASSANDRA-6454)
 + * Add listen_interface and rpc_interface options (CASSANDRA-7417)
 + * Improve schema merge performance (CASSANDRA-7444)
 + * Adjust MT depth based on # of partition validating (CASSANDRA-5263)
 + * Optimise NativeCell comparisons (CASSANDRA-6755)
 + * Configurable client timeout for cqlsh (CASSANDRA-7516)
 + * Include snippet of CQL query near syntax error in messages (CASSANDRA-7111)
 + * Make repair -pr work with -local (CASSANDRA-7450)
 + * Fix error in sstableloader with -cph > 1 (CASSANDRA-8007)
 +Merged from 2.0:
++ * Archive any commitlog segments present at startup (CASSANDRA-6904)
   * CrcCheckChance should adjust based on live CFMetadata not 
     sstable metadata (CASSANDRA-7978)
   * token() should only accept columns in the partitioning

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1394b128/src/java/org/apache/cassandra/db/commitlog/CommitLog.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1394b128/src/java/org/apache/cassandra/db/commitlog/CommitLogArchiver.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/commitlog/CommitLogArchiver.java
index 2795cae,f020182..c385f75
--- a/src/java/org/apache/cassandra/db/commitlog/CommitLogArchiver.java
+++ b/src/java/org/apache/cassandra/db/commitlog/CommitLogArchiver.java
@@@ -103,23 -103,22 +103,45 @@@ public class CommitLogArchive
          }
      }
  
 +    public void maybeArchive(final CommitLogSegment segment)
 +    {
 +        if (Strings.isNullOrEmpty(archiveCommand))
 +            return;
 +
 +        archivePending.put(segment.getName(), executor.submit(new WrappedRunnable()
 +        {
 +            protected void runMayThrow() throws IOException
 +            {
 +                segment.waitForFinalSync();
 +                String command = archiveCommand.replace("%name", segment.getName());
 +                command = command.replace("%path", segment.getPath());
 +                exec(command);
 +            }
 +        }));
 +    }
 +
++    /**
++     * Differs from the above because it can be used on any file, rather than only
++     * managed commit log segments (and thus cannot call waitForFinalSync).
++     *
++     * Used to archive files present in the commit log directory at startup (CASSANDRA-6904)
++     */
+     public void maybeArchive(final String path, final String name)
+     {
+         if (Strings.isNullOrEmpty(archiveCommand))
+             return;
+ 
+         archivePending.put(name, executor.submit(new WrappedRunnable()
+         {
+             protected void runMayThrow() throws IOException
+             {
+                 String command = archiveCommand.replace("%name", name);
+                 command = command.replace("%path", path);
+                 exec(command);
+             }
+         }));
+     }
+ 
      public boolean maybeWaitForArchiving(String name)
      {
          Future<?> f = archivePending.remove(name);
@@@ -161,26 -160,7 +183,30 @@@
              }
              for (File fromFile : files)
              {
 -                File toFile = new File(DatabaseDescriptor.getCommitLogLocation(), new CommitLogDescriptor(CommitLogSegment.getNextId()).fileName());
 +                CommitLogDescriptor fromHeader = CommitLogDescriptor.fromHeader(fromFile);
 +                CommitLogDescriptor fromName = CommitLogDescriptor.isValid(fromFile.getName()) ? CommitLogDescriptor.fromFileName(fromFile.getName()) : null;
 +                CommitLogDescriptor descriptor;
 +                if (fromHeader == null && fromName == null)
 +                    throw new IllegalStateException("Cannot safely construct descriptor for segment, either from its name or its header: " + fromFile.getPath());
 +                else if (fromHeader != null && fromName != null && !fromHeader.equals(fromName))
 +                    throw new IllegalStateException(String.format("Cannot safely construct descriptor for segment, as name and header descriptors do not match (%s vs %s): %s", fromHeader, fromName, fromFile.getPath()));
 +                else if (fromName != null && fromHeader == null && fromName.version >= CommitLogDescriptor.VERSION_21)
 +                    throw new IllegalStateException("Cannot safely construct descriptor for segment, as name descriptor implies a version that should contain a header descriptor, but that descriptor could not be read: " + fromFile.getPath());
 +                else if (fromHeader != null)
 +                    descriptor = fromHeader;
 +                else descriptor = fromName;
 +
 +                if (descriptor.version > CommitLogDescriptor.VERSION_21)
 +                    throw new IllegalStateException("Unsupported commit log version: " + descriptor.version);
 +
 +                File toFile = new File(DatabaseDescriptor.getCommitLogLocation(), descriptor.fileName());
 +                if (toFile.exists())
-                     throw new IllegalStateException("Trying to restore archive " + fromFile.getPath() + ", but the same segment already exists in the restore location: " + toFile.getPath());
++                {
++                    logger.debug("Skipping restore of archive {} as the segment already exists in the restore location {}",
++                                 fromFile.getPath(), toFile.getPath());
++                    continue;
++                }
 +
                  String command = restoreCommand.replace("%from", fromFile.getPath());
                  command = command.replace("%to", toFile.getPath());
                  try