use of org.apache.accumulo.core.data.impl.KeyExtent in project accumulo by apache.
the class HostRegexTableLoadBalancerReconfigurationTest method getOnlineTabletsForTable.
@Override
public List<TabletStats> getOnlineTabletsForTable(TServerInstance tserver, Table.ID tableId) throws ThriftSecurityException, TException {
List<TabletStats> tablets = new ArrayList<>();
// Report assignment information
for (Entry<KeyExtent, TServerInstance> e : this.assignments.entrySet()) {
if (e.getValue().equals(tserver) && e.getKey().getTableId().equals(tableId)) {
TabletStats ts = new TabletStats();
ts.setExtent(e.getKey().toThrift());
tablets.add(ts);
}
}
return tablets;
}
use of org.apache.accumulo.core.data.impl.KeyExtent in project accumulo by apache.
the class TableLoadBalancerTest method generateFakeTablets.
static List<TabletStats> generateFakeTablets(TServerInstance tserver, Table.ID tableId) {
List<TabletStats> result = new ArrayList<>();
TabletServerStatus tableInfo = state.get(tserver);
// generate some fake tablets
for (int i = 0; i < tableInfo.tableMap.get(tableId.canonicalID()).onlineTablets; i++) {
TabletStats stats = new TabletStats();
stats.extent = new KeyExtent(tableId, new Text(tserver.host() + String.format("%03d", i + 1)), new Text(tserver.host() + String.format("%03d", i))).toThrift();
result.add(stats);
}
return result;
}
use of org.apache.accumulo.core.data.impl.KeyExtent in project accumulo by apache.
the class MergeInfoTest method testOverlaps_ExtentsOverlap.
@Test
public void testOverlaps_ExtentsOverlap() {
KeyExtent keyExtent2 = createMock(KeyExtent.class);
expect(keyExtent.overlaps(keyExtent2)).andReturn(true);
replay(keyExtent);
mi = new MergeInfo(keyExtent, MergeInfo.Operation.MERGE);
assertTrue(mi.overlaps(keyExtent2));
}
use of org.apache.accumulo.core.data.impl.KeyExtent in project accumulo by apache.
the class MergeInfoTest method testOverlaps_NeedsChopping.
@Test
public void testOverlaps_NeedsChopping() {
KeyExtent keyExtent2 = createMock(KeyExtent.class);
expect(keyExtent.overlaps(keyExtent2)).andReturn(false);
expect(keyExtent.getTableId()).andReturn(Table.ID.of("table1"));
expect(keyExtent.getEndRow()).andReturn(new Text("prev"));
replay(keyExtent);
expect(keyExtent2.getTableId()).andReturn(Table.ID.of("table1"));
expect(keyExtent2.getPrevEndRow()).andReturn(new Text("prev"));
expectLastCall().anyTimes();
replay(keyExtent2);
mi = new MergeInfo(keyExtent, MergeInfo.Operation.DELETE);
assertTrue(mi.overlaps(keyExtent2));
}
use of org.apache.accumulo.core.data.impl.KeyExtent in project accumulo by apache.
the class MergeInfoTest method testNeedsToBeChopped_Delete.
private void testNeedsToBeChopped_Delete(String prevEndRow, boolean expected) {
expect(keyExtent.getTableId()).andReturn(Table.ID.of("table1"));
expect(keyExtent.getEndRow()).andReturn(new Text("prev"));
replay(keyExtent);
KeyExtent keyExtent2 = createMock(KeyExtent.class);
expect(keyExtent2.getTableId()).andReturn(Table.ID.of("table1"));
expect(keyExtent2.getPrevEndRow()).andReturn(prevEndRow != null ? new Text(prevEndRow) : null);
expectLastCall().anyTimes();
replay(keyExtent2);
mi = new MergeInfo(keyExtent, MergeInfo.Operation.DELETE);
assertEquals(expected, mi.needsToBeChopped(keyExtent2));
}
Aggregations