use of org.apache.accumulo.tserver.InMemoryMap.MemoryIterator in project accumulo by apache.
the class InMemoryMapTest method testDecodeValueModification.
@Test
public void testDecodeValueModification() throws Exception {
// This test case is the fix for ACCUMULO-4483
InMemoryMap imm = newInMemoryMap(false, tempFolder.newFolder().getAbsolutePath());
mutate(imm, "r1", "foo:cq1", 3, "");
MemoryIterator ski1 = imm.skvIterator(null);
imm.delete(0);
ski1.seek(new Range(new Text("r1")), LocalityGroupUtil.EMPTY_CF_SET, false);
assertEqualsNoNext(ski1, "r1", "foo:cq1", 3, "");
ski1.seek(new Range(new Text("r1")), LocalityGroupUtil.EMPTY_CF_SET, false);
testAndCallNext(ski1, "r1", "foo:cq1", 3, "");
assertFalse(ski1.hasTop());
ski1.close();
}
use of org.apache.accumulo.tserver.InMemoryMap.MemoryIterator in project accumulo by apache.
the class InMemoryMapTest method testEmptyNoSampleConfig.
@Test
public void testEmptyNoSampleConfig() throws Exception {
InMemoryMap imm = newInMemoryMap(false, tempFolder.newFolder().getAbsolutePath());
SamplerConfigurationImpl sampleConfig2 = new SamplerConfigurationImpl(RowSampler.class.getName(), ImmutableMap.of("hasher", "murmur3_32", "modulus", "9"));
// when in mem map is empty should be able to get sample iterator with any sample config
MemoryIterator iter = imm.skvIterator(sampleConfig2);
iter.seek(new Range(), LocalityGroupUtil.EMPTY_CF_SET, false);
Assert.assertFalse(iter.hasTop());
}
use of org.apache.accumulo.tserver.InMemoryMap.MemoryIterator in project accumulo by apache.
the class InMemoryMapTest method deepCopyAndDelete.
private void deepCopyAndDelete(int interleaving, boolean interrupt) throws Exception {
// interleaving == 0 intentionally omitted, this runs the test w/o deleting in mem map
InMemoryMap imm = newInMemoryMap(false, tempFolder.newFolder().getAbsolutePath());
mutate(imm, "r1", "foo:cq1", 3, "bar1");
mutate(imm, "r1", "foo:cq2", 3, "bar2");
MemoryIterator ski1 = imm.skvIterator(null);
AtomicBoolean iflag = new AtomicBoolean(false);
ski1.setInterruptFlag(iflag);
if (interleaving == 1) {
imm.delete(0);
if (interrupt)
iflag.set(true);
}
SortedKeyValueIterator<Key, Value> dc = ski1.deepCopy(new SampleIE());
if (interleaving == 2) {
imm.delete(0);
if (interrupt)
iflag.set(true);
}
dc.seek(new Range(), LocalityGroupUtil.EMPTY_CF_SET, false);
ski1.seek(new Range(), LocalityGroupUtil.EMPTY_CF_SET, false);
if (interleaving == 3) {
imm.delete(0);
if (interrupt)
iflag.set(true);
}
testAndCallNext(dc, "r1", "foo:cq1", 3, "bar1");
testAndCallNext(ski1, "r1", "foo:cq1", 3, "bar1");
dc.seek(new Range(), LocalityGroupUtil.EMPTY_CF_SET, false);
if (interleaving == 4) {
imm.delete(0);
if (interrupt)
iflag.set(true);
}
testAndCallNext(ski1, "r1", "foo:cq2", 3, "bar2");
testAndCallNext(dc, "r1", "foo:cq1", 3, "bar1");
testAndCallNext(dc, "r1", "foo:cq2", 3, "bar2");
assertFalse(dc.hasTop());
assertFalse(ski1.hasTop());
if (interrupt)
dc.seek(new Range(), LocalityGroupUtil.EMPTY_CF_SET, false);
}
use of org.apache.accumulo.tserver.InMemoryMap.MemoryIterator in project accumulo by apache.
the class InMemoryMapTest method testSeekBackWards.
@Test
public void testSeekBackWards() throws Exception {
InMemoryMap imm = newInMemoryMap(false, tempFolder.newFolder().getAbsolutePath());
mutate(imm, "r1", "foo:cq1", 3, "bar1");
mutate(imm, "r1", "foo:cq2", 3, "bar2");
mutate(imm, "r1", "foo:cq3", 3, "bar3");
mutate(imm, "r1", "foo:cq4", 3, "bar4");
MemoryIterator skvi1 = imm.skvIterator(null);
skvi1.seek(new Range(newKey("r1", "foo:cq3", 3), null), LocalityGroupUtil.EMPTY_CF_SET, false);
testAndCallNext(skvi1, "r1", "foo:cq3", 3, "bar3");
skvi1.seek(new Range(newKey("r1", "foo:cq1", 3), null), LocalityGroupUtil.EMPTY_CF_SET, false);
testAndCallNext(skvi1, "r1", "foo:cq1", 3, "bar1");
}
use of org.apache.accumulo.tserver.InMemoryMap.MemoryIterator in project accumulo by apache.
the class InMemoryMapTest method test6.
@Test
public void test6() throws Exception {
InMemoryMap imm = newInMemoryMap(false, tempFolder.newFolder().getAbsolutePath());
mutate(imm, "r1", "foo:cq1", 3, "bar1");
mutate(imm, "r1", "foo:cq2", 3, "bar2");
mutate(imm, "r1", "foo:cq3", 3, "bar3");
mutate(imm, "r1", "foo:cq4", 3, "bar4");
MemoryIterator ski1 = imm.skvIterator(null);
mutate(imm, "r1", "foo:cq5", 3, "bar5");
SortedKeyValueIterator<Key, Value> dc = ski1.deepCopy(new SampleIE());
ski1.seek(new Range(newKey("r1", "foo:cq1", 3), null), LocalityGroupUtil.EMPTY_CF_SET, false);
testAndCallNext(ski1, "r1", "foo:cq1", 3, "bar1");
dc.seek(new Range(newKey("r1", "foo:cq2", 3), null), LocalityGroupUtil.EMPTY_CF_SET, false);
testAndCallNext(dc, "r1", "foo:cq2", 3, "bar2");
imm.delete(0);
testAndCallNext(ski1, "r1", "foo:cq2", 3, "bar2");
testAndCallNext(dc, "r1", "foo:cq3", 3, "bar3");
testAndCallNext(ski1, "r1", "foo:cq3", 3, "bar3");
testAndCallNext(dc, "r1", "foo:cq4", 3, "bar4");
testAndCallNext(ski1, "r1", "foo:cq4", 3, "bar4");
assertFalse(ski1.hasTop());
assertFalse(dc.hasTop());
ski1.seek(new Range(newKey("r1", "foo:cq3", 3), null), LocalityGroupUtil.EMPTY_CF_SET, false);
dc.seek(new Range(newKey("r1", "foo:cq4", 3), null), LocalityGroupUtil.EMPTY_CF_SET, false);
testAndCallNext(dc, "r1", "foo:cq4", 3, "bar4");
assertFalse(dc.hasTop());
testAndCallNext(ski1, "r1", "foo:cq3", 3, "bar3");
testAndCallNext(ski1, "r1", "foo:cq4", 3, "bar4");
assertFalse(ski1.hasTop());
assertFalse(dc.hasTop());
ski1.close();
}
Aggregations