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 2015/05/19 16:00:59 UTC
[08/16] cassandra git commit: Merge branch 'cassandra-2.0' into
cassandra-2.1
http://git-wip-us.apache.org/repos/asf/cassandra/blob/d693ca12/src/java/org/apache/cassandra/tools/StandaloneScrubber.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/tools/StandaloneScrubber.java
index d420218,26768f3..459df98
--- a/src/java/org/apache/cassandra/tools/StandaloneScrubber.java
+++ b/src/java/org/apache/cassandra/tools/StandaloneScrubber.java
@@@ -109,7 -121,7 +110,7 @@@ public class StandaloneScrubbe
{
try
{
- Scrubber scrubber = new Scrubber(cfs, sstable, options.skipCorrupted, handler, true);
- Scrubber scrubber = new Scrubber(cfs, sstable, options.skipCorrupted, !options.noValidate, handler, true);
++ Scrubber scrubber = new Scrubber(cfs, sstable, options.skipCorrupted, handler, true, !options.noValidate);
try
{
scrubber.scrub();
http://git-wip-us.apache.org/repos/asf/cassandra/blob/d693ca12/test/unit/org/apache/cassandra/db/ScrubTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/db/ScrubTest.java
index a19c76d,94c7e34..028cf6c
--- a/test/unit/org/apache/cassandra/db/ScrubTest.java
+++ b/test/unit/org/apache/cassandra/db/ScrubTest.java
@@@ -30,7 -30,10 +30,11 @@@ import java.util.Set
import java.util.concurrent.ExecutionException;
import org.apache.cassandra.cql3.QueryProcessor;
-import org.apache.cassandra.db.compaction.OperationType;
++import org.apache.cassandra.db.composites.CellNameType;
+import org.apache.cassandra.exceptions.ConfigurationException;
+ import org.apache.cassandra.db.marshal.CompositeType;
+ import org.apache.cassandra.db.marshal.LongType;
+ import org.apache.cassandra.db.marshal.UTF8Type;
import org.apache.cassandra.exceptions.RequestExecutionException;
import org.apache.cassandra.io.compress.CompressionMetadata;
import org.apache.cassandra.utils.UUIDGen;
@@@ -124,7 -123,7 +128,7 @@@ public class ScrubTest extends SchemaLo
overrideWithGarbage(sstable, ByteBufferUtil.bytes("0"), ByteBufferUtil.bytes("1"));
// with skipCorrupted == false, the scrub is expected to fail
- Scrubber scrubber = new Scrubber(cfs, sstable, false, false);
- Scrubber scrubber = new Scrubber(cfs, sstable, false, true);
++ Scrubber scrubber = new Scrubber(cfs, sstable, false, false, true);
try
{
scrubber.scrub();
@@@ -134,9 -133,10 +138,9 @@@
// with skipCorrupted == true, the corrupt row will be skipped
Scrubber.ScrubResult scrubResult;
- scrubber = new Scrubber(cfs, sstable, true, false);
- scrubber = new Scrubber(cfs, sstable, true, true);
++ scrubber = new Scrubber(cfs, sstable, true, false, true);
scrubResult = scrubber.scrubWithResult();
scrubber.close();
- cfs.replaceCompactedSSTables(Collections.singletonList(sstable), Collections.singletonList(scrubber.getNewSSTable()), OperationType.SCRUB);
assertNotNull(scrubResult);
@@@ -182,7 -181,7 +186,7 @@@
overrideWithGarbage(sstable, ByteBufferUtil.bytes("0"), ByteBufferUtil.bytes("1"));
// with skipCorrupted == false, the scrub is expected to fail
- Scrubber scrubber = new Scrubber(cfs, sstable, false, false);
- Scrubber scrubber = new Scrubber(cfs, sstable, false, true);
++ Scrubber scrubber = new Scrubber(cfs, sstable, false, false, true);
try
{
scrubber.scrub();
@@@ -191,9 -190,10 +195,9 @@@
catch (IOError err) {}
// with skipCorrupted == true, the corrupt row will be skipped
- scrubber = new Scrubber(cfs, sstable, true, false);
- scrubber = new Scrubber(cfs, sstable, true, true);
++ scrubber = new Scrubber(cfs, sstable, true, false, true);
scrubber.scrub();
scrubber.close();
- cfs.replaceCompactedSSTables(Collections.singletonList(sstable), Collections.singletonList(scrubber.getNewSSTable()), OperationType.SCRUB);
assertEquals(1, cfs.getSSTables().size());
// verify that we can read all of the rows, and there is now one less row
@@@ -324,7 -324,7 +328,7 @@@
components.add(Component.TOC);
SSTableReader sstable = SSTableReader.openNoValidation(desc, components, metadata);
-- Scrubber scrubber = new Scrubber(cfs, sstable, false, true);
++ Scrubber scrubber = new Scrubber(cfs, sstable, false, true, true);
scrubber.scrub();
cfs.loadNewSSTables();
@@@ -420,9 -420,19 +424,19 @@@
Keyspace keyspace = Keyspace.open("Keyspace1");
ColumnFamilyStore cfs = keyspace.getColumnFamilyStore("test_compact_static_columns");
- QueryProcessor.processInternal("INSERT INTO \"Keyspace1\".test_compact_static_columns (a, b, c, d) VALUES (123, c3db07e8-b602-11e3-bc6b-e0b9a54a6d93, true, 'foobar')");
+ QueryProcessor.executeInternal("INSERT INTO \"Keyspace1\".test_compact_static_columns (a, b, c, d) VALUES (123, c3db07e8-b602-11e3-bc6b-e0b9a54a6d93, true, 'foobar')");
cfs.forceBlockingFlush();
- CompactionManager.instance.performScrub(cfs, false);
+ CompactionManager.instance.performScrub(cfs, false, true);
+
+ QueryProcessor.process("CREATE TABLE \"Keyspace1\".test_scrub_validation (a text primary key, b int)", ConsistencyLevel.ONE);
+ ColumnFamilyStore cfs2 = keyspace.getColumnFamilyStore("test_scrub_validation");
- RowMutation mutation = new RowMutation("Keyspace1", UTF8Type.instance.decompose("key"));
- CompositeType ct = (CompositeType) cfs2.getComparator();
- mutation.add("test_scrub_validation", ct.decompose("b"), LongType.instance.decompose(1L), System.currentTimeMillis());
++ Mutation mutation = new Mutation("Keyspace1", UTF8Type.instance.decompose("key"));
++ CellNameType ct = cfs2.getComparator();
++ mutation.add("test_scrub_validation", ct.makeCellName("b"), LongType.instance.decompose(1L), System.currentTimeMillis());
+ mutation.apply();
+ cfs2.forceBlockingFlush();
+
+ CompactionManager.instance.performScrub(cfs2, false, false);
}
/**
@@@ -434,12 -444,12 +448,12 @@@
Keyspace keyspace = Keyspace.open("Keyspace1");
ColumnFamilyStore cfs = keyspace.getColumnFamilyStore("UUIDKeys");
- ColumnFamily cf = TreeMapBackedSortedColumns.factory.create("Keyspace1", "UUIDKeys");
+ ColumnFamily cf = ArrayBackedSortedColumns.factory.create("Keyspace1", "UUIDKeys");
cf.addColumn(column(CFMetaData.DEFAULT_KEY_ALIAS, "not a uuid", 1L));
- RowMutation rm = new RowMutation("Keyspace1", ByteBufferUtil.bytes(UUIDGen.getTimeUUID()), cf);
- rm.applyUnsafe();
+ Mutation mutation = new Mutation("Keyspace1", ByteBufferUtil.bytes(UUIDGen.getTimeUUID()), cf);
+ mutation.applyUnsafe();
cfs.forceBlockingFlush();
- CompactionManager.instance.performScrub(cfs, false);
+ CompactionManager.instance.performScrub(cfs, false, true);
assertEquals(1, cfs.getSSTables().size());
}
@@@ -456,14 -466,14 +470,14 @@@
Keyspace keyspace = Keyspace.open("Keyspace1");
ColumnFamilyStore cfs = keyspace.getColumnFamilyStore("test_compact_dynamic_columns");
- QueryProcessor.processInternal("INSERT INTO \"Keyspace1\".test_compact_dynamic_columns (a, b, c) VALUES (0, 'a', 'foo')");
- QueryProcessor.processInternal("INSERT INTO \"Keyspace1\".test_compact_dynamic_columns (a, b, c) VALUES (0, 'b', 'bar')");
- QueryProcessor.processInternal("INSERT INTO \"Keyspace1\".test_compact_dynamic_columns (a, b, c) VALUES (0, 'c', 'boo')");
+ QueryProcessor.executeInternal("INSERT INTO \"Keyspace1\".test_compact_dynamic_columns (a, b, c) VALUES (0, 'a', 'foo')");
+ QueryProcessor.executeInternal("INSERT INTO \"Keyspace1\".test_compact_dynamic_columns (a, b, c) VALUES (0, 'b', 'bar')");
+ QueryProcessor.executeInternal("INSERT INTO \"Keyspace1\".test_compact_dynamic_columns (a, b, c) VALUES (0, 'c', 'boo')");
cfs.forceBlockingFlush();
- CompactionManager.instance.performScrub(cfs, true);
+ CompactionManager.instance.performScrub(cfs, true, true);
// Scrub is silent, but it will remove broken records. So reading everything back to make sure nothing to "scrubbed away"
- UntypedResultSet rs = QueryProcessor.processInternal("SELECT * FROM \"Keyspace1\".test_compact_dynamic_columns");
+ UntypedResultSet rs = QueryProcessor.executeInternal("SELECT * FROM \"Keyspace1\".test_compact_dynamic_columns");
assertEquals(3, rs.size());
Iterator<UntypedResultSet.Row> iter = rs.iterator();