use of org.apache.accumulo.core.dataImpl.KeyExtent in project accumulo by apache.
the class ConcurrentKeyExtentCacheTest method setupSplits.
@BeforeAll
public static void setupSplits() {
Text prev = null;
for (int i = 1; i < 255; i++) {
Text endRow = new Text(String.format("%02x", i));
extents.add(new KeyExtent(TableId.of("1"), endRow, prev));
prev = endRow;
}
extents.add(new KeyExtent(TableId.of("1"), null, prev));
extentsSet.addAll(extents);
}
use of org.apache.accumulo.core.dataImpl.KeyExtent in project accumulo by apache.
the class ConcurrentKeyExtentCacheTest method testLookup.
private void testLookup(TestCache tc, Text lookupRow) {
KeyExtent extent = tc.lookup(lookupRow);
assertTrue(extent.contains(lookupRow));
assertTrue(extentsSet.contains(extent));
}
use of org.apache.accumulo.core.dataImpl.KeyExtent in project accumulo by apache.
the class TabletLocatorImplTest method testBinMutations1.
@Test
public void testBinMutations1() throws Exception {
// one tablet table
KeyExtent ke1 = nke("foo", null, null);
TabletLocatorImpl metaCache = createLocators("foo", ke1, "l1");
List<Mutation> ml = nml(nm("a", "cf1:cq1=v1", "cf1:cq2=v2"), nm("c", "cf1:cq1=v3", "cf1:cq2=v4"));
Map<String, Map<KeyExtent, List<String>>> emb = cemb(nol("a", "l1", ke1), nol("c", "l1", ke1));
runTest(metaCache, ml, emb);
ml = nml(nm("a", "cf1:cq1=v1", "cf1:cq2=v2"));
emb = cemb(nol("a", "l1", ke1));
runTest(metaCache, ml, emb);
ml = nml(nm("a", "cf1:cq1=v1", "cf1:cq2=v2"), nm("a", "cf1:cq3=v3"));
emb = cemb(nol("a", "l1", ke1), nol("a", "l1", ke1));
runTest(metaCache, ml, emb);
}
use of org.apache.accumulo.core.dataImpl.KeyExtent in project accumulo by apache.
the class TabletLocatorImplTest method testBinSplit.
@Test
public void testBinSplit() throws Exception {
for (int i = 0; i < 3; i++) {
// when i == 0 only test binning mutations
// when i == 1 only test binning ranges
// when i == 2 test both
KeyExtent ke1 = nke("foo", null, null);
TServers tservers = new TServers();
TabletLocatorImpl metaCache = createLocators(tservers, "tserver1", "tserver2", "foo", ke1, "l1");
List<Mutation> ml = nml(nm("a", "cf1:cq1=v1", "cf1:cq2=v2"), nm("m", "cf1:cq1=v3", "cf1:cq2=v4"), nm("z", "cf1:cq1=v5"));
Map<String, Map<KeyExtent, List<String>>> emb = cemb(nol("a", "l1", ke1), nol("m", "l1", ke1), nol("z", "l1", ke1));
if (i == 0 || i == 2)
runTest(metaCache, ml, emb);
List<Range> ranges = nrl(new Range(new Text("a")), new Range(new Text("m")), new Range(new Text("z")));
Map<String, Map<KeyExtent, List<Range>>> expected1 = createExpectedBinnings("l1", nol(nke("foo", null, null), ranges));
if (i == 1 || i == 2)
runTest(ranges, metaCache, expected1);
KeyExtent ke11 = nke("foo", "n", null);
KeyExtent ke12 = nke("foo", null, "n");
setLocation(tservers, "tserver2", MTE, ke12, "l2");
metaCache.invalidateCache(ke1);
emb = cemb(nol("z", "l2", ke12));
if (i == 0 || i == 2)
runTest(metaCache, ml, emb, "a", "m");
Map<String, Map<KeyExtent, List<Range>>> expected2 = createExpectedBinnings("l2", nol(nke("foo", null, "n"), nrl(new Range(new Text("z")))));
if (i == 1 || i == 2)
runTest(ranges, metaCache, expected2, nrl(new Range(new Text("a")), new Range(new Text("m"))));
setLocation(tservers, "tserver2", MTE, ke11, "l3");
emb = cemb(nol("a", "l3", ke11), nol("m", "l3", ke11), nol("z", "l2", ke12));
if (i == 0 || i == 2)
runTest(metaCache, ml, emb);
Map<String, Map<KeyExtent, List<Range>>> expected3 = createExpectedBinnings("l2", nol(nke("foo", null, "n"), nrl(new Range(new Text("z")))), "l3", nol(nke("foo", "n", null), nrl(new Range(new Text("a")), new Range(new Text("m")))));
if (i == 1 || i == 2)
runTest(ranges, metaCache, expected3);
}
}
use of org.apache.accumulo.core.dataImpl.KeyExtent in project accumulo by apache.
the class TabletLocatorImplTest method createExpectedBinnings.
@SuppressWarnings("unchecked")
static Map<String, Map<KeyExtent, List<Range>>> createExpectedBinnings(Object... data) {
Map<String, Map<KeyExtent, List<Range>>> expBinnedRanges = new HashMap<>();
for (int i = 0; i < data.length; i += 2) {
String loc = (String) data[i];
Object[] binData = (Object[]) data[i + 1];
HashMap<KeyExtent, List<Range>> binnedKE = new HashMap<>();
expBinnedRanges.put(loc, binnedKE);
for (int j = 0; j < binData.length; j += 2) {
KeyExtent ke = (KeyExtent) binData[j];
List<Range> ranges = (List<Range>) binData[j + 1];
binnedKE.put(ke, ranges);
}
}
return expBinnedRanges;
}
Aggregations