use of org.apache.accumulo.server.data.ServerMutation in project accumulo by apache.
the class LogicalTimeTest method testSetUpdateTimes.
@Test
public void testSetUpdateTimes() {
List<Mutation> ms = new java.util.ArrayList<>();
ServerMutation m = createMock(ServerMutation.class);
ServerMutation m2 = createMock(ServerMutation.class);
m.setSystemTimestamp(1235L);
replay(m);
m2.setSystemTimestamp(1236L);
replay(m2);
ms.add(m);
ms.add(m2);
long currTime = ltime.setUpdateTimes(ms);
assertEquals(TIME + 2L, currTime);
verify(m);
verify(m2);
}
use of org.apache.accumulo.server.data.ServerMutation in project accumulo by apache.
the class MillisTimeTest method testSetUpdateTimes.
@Test
public void testSetUpdateTimes() {
List<Mutation> ms = new java.util.ArrayList<>();
ServerMutation m = createMock(ServerMutation.class);
m.setSystemTimestamp(anyLong());
replay(m);
ms.add(m);
long currTime = mtime.setUpdateTimes(ms);
assertTrue(currTime > TIME);
verify(m);
}
use of org.apache.accumulo.server.data.ServerMutation in project accumulo by apache.
the class SortedLogRecoveryTest method testSimple.
@Test
public void testSimple() throws IOException {
// Create a test log
Mutation m = new ServerMutation(new Text("row1"));
m.put(cf, cq, value);
KeyValue[] entries = new KeyValue[] { createKeyValue(OPEN, 0, -1, "1"), createKeyValue(DEFINE_TABLET, 1, 1, extent), createKeyValue(MUTATION, 2, 1, m) };
Map<String, KeyValue[]> logs = new TreeMap<>();
logs.put("testlog", entries);
// Recover
List<Mutation> mutations = recover(logs, extent);
// Verify recovered data
Assert.assertEquals(1, mutations.size());
Assert.assertEquals(m, mutations.get(0));
}
use of org.apache.accumulo.server.data.ServerMutation in project accumulo by apache.
the class SortedLogRecoveryTest method testCompactionCrossesLogs4.
@Test
public void testCompactionCrossesLogs4() throws IOException {
// Create a test log
Mutation ignored = new ServerMutation(new Text("ignored"));
ignored.put(cf, cq, value);
Mutation m = new ServerMutation(new Text("row1"));
m.put(cf, cq, value);
Mutation m2 = new ServerMutation(new Text("row2"));
m2.put(cf, cq, value);
Mutation m3 = new ServerMutation(new Text("row3"));
m3.put(cf, cq, value);
Mutation m4 = new ServerMutation(new Text("row4"));
m4.put(cf, cq, value);
Mutation m5 = new ServerMutation(new Text("row5"));
m5.put(cf, cq, value);
Mutation m6 = new ServerMutation(new Text("row6"));
m6.put(cf, cq, value);
KeyValue[] entries = new KeyValue[] { createKeyValue(OPEN, 0, -1, "1"), createKeyValue(DEFINE_TABLET, 1, 1, extent), createKeyValue(COMPACTION_START, 4, 1, "/t1/f1"), // createKeyValue(COMPACTION_FINISH, 5, 1, null),
createKeyValue(MUTATION, 2, 1, m), createKeyValue(MUTATION, 3, 1, m2) };
KeyValue[] entries2 = new KeyValue[] { createKeyValue(OPEN, 5, -1, "2"), createKeyValue(DEFINE_TABLET, 6, 1, extent), createKeyValue(MUTATION, 7, 1, m3), createKeyValue(MUTATION, 8, 1, m4) };
KeyValue[] entries3 = new KeyValue[] { createKeyValue(OPEN, 9, -1, "3"), createKeyValue(DEFINE_TABLET, 10, 1, extent), // createKeyValue(COMPACTION_FINISH, 11, 1, null),
createKeyValue(COMPACTION_START, 12, 1, "/t1/f1"), // createKeyValue(COMPACTION_FINISH, 19, 1, null),
createKeyValue(MUTATION, 8, 1, m5), createKeyValue(MUTATION, 20, 1, m6) };
Map<String, KeyValue[]> logs = new TreeMap<>();
logs.put("entries", entries);
logs.put("entries2", entries2);
logs.put("entries3", entries3);
// Recover
List<Mutation> mutations = recover(logs, extent);
// Verify recovered data
Assert.assertEquals(6, mutations.size());
Assert.assertEquals(m, mutations.get(0));
Assert.assertEquals(m2, mutations.get(1));
Assert.assertEquals(m3, mutations.get(2));
Assert.assertEquals(m4, mutations.get(3));
Assert.assertEquals(m5, mutations.get(4));
Assert.assertEquals(m6, mutations.get(5));
}
use of org.apache.accumulo.server.data.ServerMutation in project accumulo by apache.
the class SortedLogRecoveryTest method testDoubleFinish.
@Test
public void testDoubleFinish() throws IOException {
// Create a test log
Mutation ignored = new ServerMutation(new Text("ignored"));
ignored.put(cf, cq, value);
Mutation m = new ServerMutation(new Text("row1"));
m.put(cf, cq, value);
Mutation m2 = new ServerMutation(new Text("row2"));
m2.put(cf, cq, new Value("123".getBytes()));
KeyValue[] entries = new KeyValue[] { createKeyValue(OPEN, 0, -1, "1"), createKeyValue(DEFINE_TABLET, 1, 1, extent), createKeyValue(COMPACTION_FINISH, 2, 1, null), createKeyValue(COMPACTION_START, 4, 1, "/t1/f1"), createKeyValue(COMPACTION_FINISH, 6, 1, null), createKeyValue(MUTATION, 3, 1, ignored), createKeyValue(MUTATION, 5, 1, m), createKeyValue(MUTATION, 7, 1, m2) };
Map<String, KeyValue[]> logs = new TreeMap<>();
logs.put("entries", entries);
// Recover
List<Mutation> mutations = recover(logs, extent);
// Verify recovered data
Assert.assertEquals(2, mutations.size());
Assert.assertEquals(m, mutations.get(0));
Assert.assertEquals(m2, mutations.get(1));
}
Aggregations