cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alek...@apache.org
Subject [3/4] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
Date Wed, 01 Jul 2015 19:22:21 GMT
Merge branch 'cassandra-2.1' into cassandra-2.2


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

Branch: refs/heads/trunk
Commit: cda407ae049aa4a21a8d7f0c28bf57d6466a1e00
Parents: fbe96b3 31aa2a2
Author: Aleksey Yeschenko <aleksey@apache.org>
Authored: Wed Jul 1 22:16:26 2015 +0300
Committer: Aleksey Yeschenko <aleksey@apache.org>
Committed: Wed Jul 1 22:16:26 2015 +0300

----------------------------------------------------------------------
 CHANGES.txt                                          |  5 +++--
 src/java/org/apache/cassandra/config/Schema.java     |  2 +-
 .../org/apache/cassandra/db/ColumnFamilyStore.java   |  2 +-
 src/java/org/apache/cassandra/db/Keyspace.java       | 15 +++++++++++++--
 src/java/org/apache/cassandra/db/Mutation.java       |  2 +-
 test/unit/org/apache/cassandra/db/CommitLogTest.java |  2 +-
 6 files changed, 20 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/cda407ae/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 0abf6db,5c55b9e..104f6ab
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,34 -1,14 +1,35 @@@
 -2.1.8
 +2.2.0-rc2
 + * (cqlsh) Allow setting the initial connection timeout (CASSANDRA-9601)
 + * BulkLoader has --transport-factory option but does not use it (CASSANDRA-9675)
 + * Allow JMX over SSL directly from nodetool (CASSANDRA-9090)
 + * Update cqlsh for UDFs (CASSANDRA-7556)
 + * Change Windows kernel default timer resolution (CASSANDRA-9634)
 + * Deprected sstable2json and json2sstable (CASSANDRA-9618)
 + * Allow native functions in user-defined aggregates (CASSANDRA-9542)
 + * Don't repair system_distributed by default (CASSANDRA-9621)
 + * Fix mixing min, max, and count aggregates for blob type (CASSANRA-9622)
 + * Rename class for DATE type in Java driver (CASSANDRA-9563)
 + * Duplicate compilation of UDFs on coordinator (CASSANDRA-9475)
 + * Fix connection leak in CqlRecordWriter (CASSANDRA-9576)
 + * Mlockall before opening system sstables & remove boot_without_jna option (CASSANDRA-9573)
 + * Add functions to convert timeuuid to date or time, deprecate dateOf and unixTimestampOf
(CASSANDRA-9229)
 + * Make sure we cancel non-compacting sstables from LifecycleTransaction (CASSANDRA-9566)
 + * Fix deprecated repair JMX API (CASSANDRA-9570)
 + * Add logback metrics (CASSANDRA-9378)
 + * Update and refactor ant test/test-compression to run the tests in parallel (CASSANDRA-9583)
 +Merged from 2.1:
   * Update internal python driver for cqlsh (CASSANDRA-9064)
-  * Avoids ballot clash in Paxos (CASSANDRA-9649)
   * Fix IndexOutOfBoundsException when inserting tuple with too many
     elements using the string literal notation (CASSANDRA-9559)
 - * Allow JMX over SSL directly from nodetool (CASSANDRA-9090)
 - * Fix incorrect result for IN queries where column not found (CASSANDRA-9540)
   * Enable describe on indices (CASSANDRA-7814)
 + * Fix incorrect result for IN queries where column not found (CASSANDRA-9540)
   * ColumnFamilyStore.selectAndReference may block during compaction (CASSANDRA-9637)
 + * Fix bug in cardinality check when compacting (CASSANDRA-9580)
 + * Fix memory leak in Ref due to ConcurrentLinkedQueue.remove() behaviour (CASSANDRA-9549)
 + * Make rebuild only run one at a time (CASSANDRA-9119)
- Merged from 2.0
+ Merged from 2.0:
+  * Fix setting 'durable_writes' in ALTER KEYSPACE (CASSANDRA-9560)
 - * Avoid ballot clash in Paxos (CASSANDRA-9649)
++ * Avoids ballot clash in Paxos (CASSANDRA-9649)
   * Improve trace messages for RR (CASSANDRA-9479)
   * Fix suboptimal secondary index selection when restricted
     clustering column is also indexed (CASSANDRA-9631)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/cda407ae/src/java/org/apache/cassandra/config/Schema.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/config/Schema.java
index 2678cb3,8e9802f..548341e
--- a/src/java/org/apache/cassandra/config/Schema.java
+++ b/src/java/org/apache/cassandra/config/Schema.java
@@@ -407,202 -416,20 +407,202 @@@ public class Schem
          updateVersionAndAnnounce();
      }
  
 -    public static boolean invalidSchemaRow(Row row)
 +    public void addKeyspace(KSMetaData ksm)
      {
 -        return row.cf == null || (row.cf.isMarkedForDelete() && !row.cf.hasColumns());
 +        assert getKSMetaData(ksm.name) == null;
 +        load(ksm);
 +
 +        Keyspace.open(ksm.name);
 +        MigrationManager.instance.notifyCreateKeyspace(ksm);
      }
  
 -    public static boolean ignoredSchemaRow(Row row)
 +    public void updateKeyspace(String ksName)
      {
 -        try
 -        {
 -            return systemKeyspaceNames.contains(ByteBufferUtil.string(row.key.getKey()));
 -        }
 -        catch (CharacterCodingException e)
 +        KSMetaData oldKsm = getKSMetaData(ksName);
 +        assert oldKsm != null;
 +        KSMetaData newKsm = LegacySchemaTables.createKeyspaceFromName(ksName).cloneWith(oldKsm.cfMetaData().values(),
oldKsm.userTypes);
 +
 +        setKeyspaceDefinition(newKsm);
++        Keyspace.open(ksName).setMetadata(newKsm);
 +
-         Keyspace.open(ksName).createReplicationStrategy(newKsm);
 +        MigrationManager.instance.notifyUpdateKeyspace(newKsm);
 +    }
 +
 +    public void dropKeyspace(String ksName)
 +    {
 +        KSMetaData ksm = Schema.instance.getKSMetaData(ksName);
 +        String snapshotName = Keyspace.getTimestampedSnapshotName(ksName);
 +
 +        CompactionManager.instance.interruptCompactionFor(ksm.cfMetaData().values(), true);
 +
 +        Keyspace keyspace = Keyspace.open(ksm.name);
 +
 +        // remove all cfs from the keyspace instance.
 +        List<UUID> droppedCfs = new ArrayList<>();
 +        for (CFMetaData cfm : ksm.cfMetaData().values())
          {
 -            throw new RuntimeException(e);
 +            ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(cfm.cfName);
 +
 +            purge(cfm);
 +
 +            if (DatabaseDescriptor.isAutoSnapshot())
 +                cfs.snapshot(snapshotName);
 +            Keyspace.open(ksm.name).dropCf(cfm.cfId);
 +
 +            droppedCfs.add(cfm.cfId);
          }
 +
 +        // remove the keyspace from the static instances.
 +        Keyspace.clear(ksm.name);
 +        clearKeyspaceDefinition(ksm);
 +
 +        keyspace.writeOrder.awaitNewBarrier();
 +
 +        // force a new segment in the CL
 +        CommitLog.instance.forceRecycleAllSegments(droppedCfs);
 +
 +        MigrationManager.instance.notifyDropKeyspace(ksm);
 +    }
 +
 +    public void addTable(CFMetaData cfm)
 +    {
 +        assert getCFMetaData(cfm.ksName, cfm.cfName) == null;
 +        KSMetaData ksm = getKSMetaData(cfm.ksName).cloneWithTableAdded(cfm);
 +
 +        logger.info("Loading {}", cfm);
 +
 +        load(cfm);
 +
 +        // make sure it's init-ed w/ the old definitions first,
 +        // since we're going to call initCf on the new one manually
 +        Keyspace.open(cfm.ksName);
 +
 +        setKeyspaceDefinition(ksm);
 +        Keyspace.open(ksm.name).initCf(cfm.cfId, cfm.cfName, true);
 +        MigrationManager.instance.notifyCreateColumnFamily(cfm);
 +    }
 +
 +    public void updateTable(String ksName, String tableName)
 +    {
 +        CFMetaData cfm = getCFMetaData(ksName, tableName);
 +        assert cfm != null;
 +        boolean columnsDidChange = cfm.reload();
 +
 +        Keyspace keyspace = Keyspace.open(cfm.ksName);
 +        keyspace.getColumnFamilyStore(cfm.cfName).reload();
 +        MigrationManager.instance.notifyUpdateColumnFamily(cfm, columnsDidChange);
 +    }
 +
 +    public void dropTable(String ksName, String tableName)
 +    {
 +        KSMetaData ksm = getKSMetaData(ksName);
 +        assert ksm != null;
 +        ColumnFamilyStore cfs = Keyspace.open(ksName).getColumnFamilyStore(tableName);
 +        assert cfs != null;
 +
 +        // reinitialize the keyspace.
 +        CFMetaData cfm = ksm.cfMetaData().get(tableName);
 +
 +        purge(cfm);
 +        setKeyspaceDefinition(ksm.cloneWithTableRemoved(cfm));
 +
 +        CompactionManager.instance.interruptCompactionFor(Arrays.asList(cfm), true);
 +
 +        if (DatabaseDescriptor.isAutoSnapshot())
 +            cfs.snapshot(Keyspace.getTimestampedSnapshotName(cfs.name));
 +        Keyspace.open(ksm.name).dropCf(cfm.cfId);
 +        MigrationManager.instance.notifyDropColumnFamily(cfm);
 +
 +        CommitLog.instance.forceRecycleAllSegments(Collections.singleton(cfm.cfId));
 +    }
 +
 +    public void addType(UserType ut)
 +    {
 +        KSMetaData ksm = getKSMetaData(ut.keyspace);
 +        assert ksm != null;
 +
 +        logger.info("Loading {}", ut);
 +
 +        ksm.userTypes.addType(ut);
 +
 +        MigrationManager.instance.notifyCreateUserType(ut);
 +    }
 +
 +    public void updateType(UserType ut)
 +    {
 +        KSMetaData ksm = getKSMetaData(ut.keyspace);
 +        assert ksm != null;
 +
 +        logger.info("Updating {}", ut);
 +
 +        ksm.userTypes.addType(ut);
 +
 +        MigrationManager.instance.notifyUpdateUserType(ut);
 +    }
 +
 +    public void dropType(UserType ut)
 +    {
 +        KSMetaData ksm = getKSMetaData(ut.keyspace);
 +        assert ksm != null;
 +
 +        ksm.userTypes.removeType(ut);
 +
 +        MigrationManager.instance.notifyDropUserType(ut);
 +    }
 +
 +    public void addFunction(UDFunction udf)
 +    {
 +        logger.info("Loading {}", udf);
 +
 +        Functions.addOrReplaceFunction(udf);
 +
 +        MigrationManager.instance.notifyCreateFunction(udf);
 +    }
 +
 +    public void updateFunction(UDFunction udf)
 +    {
 +        logger.info("Updating {}", udf);
 +
 +        Functions.addOrReplaceFunction(udf);
 +
 +        MigrationManager.instance.notifyUpdateFunction(udf);
 +    }
 +
 +    public void dropFunction(UDFunction udf)
 +    {
 +        logger.info("Drop {}", udf);
 +
 +        // TODO: this is kind of broken as this remove all overloads of the function name
 +        Functions.removeFunction(udf.name(), udf.argTypes());
 +
 +        MigrationManager.instance.notifyDropFunction(udf);
 +    }
 +
 +    public void addAggregate(UDAggregate udf)
 +    {
 +        logger.info("Loading {}", udf);
 +
 +        Functions.addOrReplaceFunction(udf);
 +
 +        MigrationManager.instance.notifyCreateAggregate(udf);
 +    }
 +
 +    public void updateAggregate(UDAggregate udf)
 +    {
 +        logger.info("Updating {}", udf);
 +
 +        Functions.addOrReplaceFunction(udf);
 +
 +        MigrationManager.instance.notifyUpdateAggregate(udf);
 +    }
 +
 +    public void dropAggregate(UDAggregate udf)
 +    {
 +        logger.info("Drop {}", udf);
 +
 +        // TODO: this is kind of broken as this remove all overloads of the function name
 +        Functions.removeFunction(udf.name(), udf.argTypes());
 +
 +        MigrationManager.instance.notifyDropAggregate(udf);
      }
  }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/cda407ae/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/cda407ae/src/java/org/apache/cassandra/db/Keyspace.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/Keyspace.java
index 1d86784,4f59c40..548d2be
--- a/src/java/org/apache/cassandra/db/Keyspace.java
+++ b/src/java/org/apache/cassandra/db/Keyspace.java
@@@ -69,8 -74,8 +69,8 @@@ public class Keyspac
      public final OpOrder writeOrder = new OpOrder();
  
      /* ColumnFamilyStore per column family */
 -    private final ConcurrentMap<UUID, ColumnFamilyStore> columnFamilyStores = new
ConcurrentHashMap<UUID, ColumnFamilyStore>();
 +    private final ConcurrentMap<UUID, ColumnFamilyStore> columnFamilyStores = new
ConcurrentHashMap<>();
+     private volatile KSMetaData metadata;
      private volatile AbstractReplicationStrategy replicationStrategy;
  
      public static final Function<String,Keyspace> keyspaceTransformer = new Function<String,
Keyspace>()
@@@ -275,19 -280,7 +275,19 @@@
          }
      }
  
 +    private Keyspace(KSMetaData metadata)
 +    {
 +        this.metadata = metadata;
 +        createReplicationStrategy(metadata);
 +        this.metric = new KeyspaceMetrics(this);
 +    }
 +
 +    public static Keyspace mockKS(KSMetaData metadata)
 +    {
 +        return new Keyspace(metadata);
 +    }
 +
-     public void createReplicationStrategy(KSMetaData ksm)
+     private void createReplicationStrategy(KSMetaData ksm)
      {
          replicationStrategy = AbstractReplicationStrategy.createReplicationStrategy(ksm.name,
                                                                                      ksm.strategyClass,

http://git-wip-us.apache.org/repos/asf/cassandra/blob/cda407ae/src/java/org/apache/cassandra/db/Mutation.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/cda407ae/test/unit/org/apache/cassandra/db/CommitLogTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/db/CommitLogTest.java
index 1ab678f,9a8a1dc..c53d371
--- a/test/unit/org/apache/cassandra/db/CommitLogTest.java
+++ b/test/unit/org/apache/cassandra/db/CommitLogTest.java
@@@ -340,13 -345,13 +340,13 @@@ public class CommitLogTes
      }
  
      @Test
 -    public void testTruncateWithoutSnapshotNonDurable()  throws ExecutionException, InterruptedException
 +    public void testTruncateWithoutSnapshotNonDurable() throws IOException
      {
 -        CommitLog.instance.resetUnsafe();
 +        CommitLog.instance.resetUnsafe(true);
          boolean prevAutoSnapshot = DatabaseDescriptor.isAutoSnapshot();
          DatabaseDescriptor.setAutoSnapshot(false);
 -        Keyspace notDurableKs = Keyspace.open("NoCommitlogSpace");
 +        Keyspace notDurableKs = Keyspace.open(KEYSPACE2);
-         Assert.assertFalse(notDurableKs.metadata.durableWrites);
+         Assert.assertFalse(notDurableKs.getMetadata().durableWrites);
          ColumnFamilyStore cfs = notDurableKs.getColumnFamilyStore("Standard1");
          CellNameType type = notDurableKs.getColumnFamilyStore("Standard1").getComparator();
          Mutation rm;


Mime
View raw message