You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by br...@apache.org on 2014/07/25 17:47:31 UTC
[03/10] git commit: Add unordered PITR test
Add unordered PITR test
Patch by Ala' Alkhaldi, reviewed by brandonwilliams for CASSANDRA-6905
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/d9cc6c1b
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/d9cc6c1b
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/d9cc6c1b
Branch: refs/heads/cassandra-2.1
Commit: d9cc6c1bf610f13533df23f1b5fa99f955abd85f
Parents: 59c7e25
Author: Brandon Williams <br...@apache.org>
Authored: Fri Jul 25 10:45:31 2014 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Fri Jul 25 10:45:31 2014 -0500
----------------------------------------------------------------------
.../cassandra/db/RecoveryManagerTest.java | 36 ++++++++++++++++++++
1 file changed, 36 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/d9cc6c1b/test/unit/org/apache/cassandra/db/RecoveryManagerTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/RecoveryManagerTest.java b/test/unit/org/apache/cassandra/db/RecoveryManagerTest.java
index d14d184..cc24111 100644
--- a/test/unit/org/apache/cassandra/db/RecoveryManagerTest.java
+++ b/test/unit/org/apache/cassandra/db/RecoveryManagerTest.java
@@ -129,4 +129,40 @@ public class RecoveryManagerTest extends SchemaLoader
ColumnFamily cf = Util.getColumnFamily(keyspace1, dk, "Standard1");
Assert.assertEquals(6, cf.getColumnCount());
}
+
+
+ @Test
+ public void testRecoverPITUnordered() throws Exception
+ {
+ Date date = CommitLogArchiver.format.parse("2112:12:12 12:12:12");
+ long timeMS = date.getTime();
+
+ Keyspace keyspace1 = Keyspace.open(KEYSPACE1);
+ DecoratedKey dk = Util.dk("dkey");
+
+ // Col 0 and 9 are the only ones to be recovered
+ for (int i = 0; i < 10; ++i)
+ {
+ long ts;
+ if(i==9)
+ ts = TimeUnit.MILLISECONDS.toMicros(timeMS - 1000);
+ else
+ ts = TimeUnit.MILLISECONDS.toMicros(timeMS + (i * 1000));
+
+ ColumnFamily cf = ArrayBackedSortedColumns.factory.create(KEYSPACE1, "Standard1");
+ cf.addColumn(column("name-" + i, "value", ts));
+ Mutation rm = new Mutation(KEYSPACE1, dk.getKey(), cf);
+ rm.apply();
+ }
+
+ ColumnFamily cf = Util.getColumnFamily(keyspace1, dk, "Standard1");
+ Assert.assertEquals(10, cf.getColumnCount());
+
+ keyspace1.getColumnFamilyStore("Standard1").clearUnsafe();
+ CommitLog.instance.resetUnsafe(); // disassociate segments from live CL
+ CommitLog.instance.recover();
+
+ cf = Util.getColumnFamily(keyspace1, dk, "Standard1");
+ Assert.assertEquals(2, cf.getColumnCount());
+ }
}