Merge branch 'cassandra-2.2' into trunk

Conflicts:
        test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java


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

Branch: refs/heads/trunk
Commit: c9126687828402a2ce860f1a47d78fb18b54a419
Parents: f713be4 1657639
Author: Joshua McKenzie <[email protected]>
Authored: Thu Jul 23 11:13:20 2015 -0400
Committer: Joshua McKenzie <[email protected]>
Committed: Thu Jul 23 11:13:20 2015 -0400

----------------------------------------------------------------------
 conf/cassandra-env.ps1                          | 20 ++++++++++++++++++++
 .../cassandra/db/ColumnFamilyStoreTest.java     |  6 ++++++
 2 files changed, 26 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/c9126687/conf/cassandra-env.ps1
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c9126687/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
index 065479b,5419ef5..9da4876
--- a/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
+++ b/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
@@@ -21,9 -21,36 +21,10 @@@ package org.apache.cassandra.db
  import java.io.File;
  import java.io.IOException;
  import java.nio.ByteBuffer;
 -import java.nio.charset.CharacterCodingException;
 -import java.util.Arrays;
 -import java.util.Collection;
 -import java.util.Collections;
 -import java.util.HashMap;
 -import java.util.HashSet;
 -import java.util.Iterator;
 -import java.util.LinkedList;
 -import java.util.List;
 -import java.util.Map;
 -import java.util.Random;
 -import java.util.Set;
 -import java.util.SortedSet;
 -import java.util.TreeSet;
 -import java.util.UUID;
 -import java.util.concurrent.ExecutionException;
 -import java.util.concurrent.Future;
 -import java.util.concurrent.TimeUnit;
 +import java.util.*;
  
 -import com.google.common.base.Function;
 -import com.google.common.collect.Iterables;
 -import com.google.common.collect.Sets;
 -
 -import org.apache.cassandra.db.index.PerRowSecondaryIndexTest;
 -import org.apache.cassandra.io.sstable.*;
 -import org.apache.cassandra.io.sstable.format.SSTableReader;
 -import org.apache.cassandra.io.sstable.format.SSTableWriter;
 -import org.apache.commons.lang3.ArrayUtils;
 -import org.apache.commons.lang3.StringUtils;
 +import org.junit.Before;
+ import org.junit.Assume;
  import org.junit.BeforeClass;
  import org.junit.Test;
  import org.junit.runner.RunWith;
@@@ -294,42 -1035,24 +295,47 @@@ public class ColumnFamilyStoreTes
  
          // and it remains so after flush. (this wasn't failing before, but 
it's good to check.)
          cfs.forceBlockingFlush();
 -        assertRowAndColCount(1, 2, true, cfs.getRangeSlice(Util.range("f", 
"g"), null, ThriftValidation.asIFilter(sp, cfs.metadata, null), 100));
 +        assertRangeCount(cfs, col, val, 4);
      }
  
 -
 -    private ColumnFamilyStore insertKey1Key2()
 +    @Test
 +    public void testClearEphemeralSnapshots() throws Throwable
      {
 -        ColumnFamilyStore cfs = 
Keyspace.open(KEYSPACE2).getColumnFamilyStore(CF_STANDARD1);
 -        List<Mutation> rms = new LinkedList<>();
 -        Mutation rm;
 -        rm = new Mutation(KEYSPACE2, ByteBufferUtil.bytes("key1"));
 -        rm.add(CF_STANDARD1, cellname("Column1"), 
ByteBufferUtil.bytes("asdf"), 0);
 -        rms.add(rm);
 -        Util.writeColumnFamily(rms);
++        // We don't do snapshot-based repair on Windows so we don't have 
ephemeral snapshots from repair that need clearing.
++        // This test will fail as we'll revert to the 
WindowsFailedSnapshotTracker and counts will be off, but since we
++        // don't do snapshot-based repair on Windows, we just skip this test.
++        Assume.assumeTrue(!FBUtilities.isWindows());
+ 
 -        rm = new Mutation(KEYSPACE2, ByteBufferUtil.bytes("key2"));
 -        rm.add(CF_STANDARD1, cellname("Column1"), 
ByteBufferUtil.bytes("asdf"), 0);
 -        rms.add(rm);
 -        return Util.writeColumnFamily(rms);
 +        ColumnFamilyStore cfs = 
Keyspace.open(KEYSPACE1).getColumnFamilyStore(CF_INDEX1);
 +
 +        //cleanup any previous test gargbage
 +        cfs.clearSnapshot("");
 +
 +        int numRows = 1000;
 +        long[] colValues = new long [numRows * 2]; // each row has two columns
 +        for (int i = 0; i < colValues.length; i+=2)
 +        {
 +            colValues[i] = (i % 4 == 0 ? 1L : 2L); // index column
 +            colValues[i+1] = 3L; //other column
 +        }
 +        ScrubTest.fillIndexCF(cfs, false, colValues);
 +
 +        cfs.snapshot("nonEphemeralSnapshot", null, false);
 +        cfs.snapshot("ephemeralSnapshot", null, true);
 +
 +        Map<String, Pair<Long, Long>> snapshotDetails = 
cfs.getSnapshotDetails();
 +        assertEquals(2, snapshotDetails.size());
 +        assertTrue(snapshotDetails.containsKey("ephemeralSnapshot"));
 +        assertTrue(snapshotDetails.containsKey("nonEphemeralSnapshot"));
 +
 +        ColumnFamilyStore.clearEphemeralSnapshots(cfs.directories);
 +
 +        snapshotDetails = cfs.getSnapshotDetails();
 +        assertEquals(1, snapshotDetails.size());
 +        assertTrue(snapshotDetails.containsKey("nonEphemeralSnapshot"));
 +
 +        //test cleanup
 +        cfs.clearSnapshot("");
      }
  
      @Test

Reply via email to