use of org.apache.accumulo.core.spi.balancer.data.TabletStatistics in project accumulo by apache.
the class HostRegexTableLoadBalancerTest method getOnlineTabletsForTable.
@Override
public List<TabletStatistics> getOnlineTabletsForTable(TabletServerId tserver, TableId tableId) {
// Report incorrect information so that balance will create an assignment
List<TabletStatistics> tablets = new ArrayList<>();
if (tableId.equals(BAR.getId()) && tserver.getHost().equals("192.168.0.1")) {
// Report that we have a bar tablet on this server
TKeyExtent tke = new TKeyExtent();
tke.setTable(BAR.getId().canonical().getBytes(UTF_8));
tke.setEndRow("11".getBytes());
tke.setPrevEndRow("10".getBytes());
TabletStats tstats = new TabletStats();
tstats.setExtent(tke);
TabletStatistics ts = new TabletStatisticsImpl(tstats);
tablets.add(ts);
} else if (tableId.equals(FOO.getId()) && tserver.getHost().equals("192.168.0.6")) {
// Report that we have a foo tablet on this server
TKeyExtent tke = new TKeyExtent();
tke.setTable(FOO.getId().canonical().getBytes(UTF_8));
tke.setEndRow("1".getBytes());
tke.setPrevEndRow("0".getBytes());
TabletStats tstats = new TabletStats();
tstats.setExtent(tke);
TabletStatistics ts = new TabletStatisticsImpl(tstats);
tablets.add(ts);
}
return tablets;
}
use of org.apache.accumulo.core.spi.balancer.data.TabletStatistics in project accumulo by apache.
the class TableLoadBalancerTest method generateFakeTablets.
static List<TabletStatistics> generateFakeTablets(TabletServerId tserver, TableId tableId) {
List<TabletStatistics> result = new ArrayList<>();
TServerStatus tableInfo = state.get(tserver);
// generate some fake tablets
for (int i = 0; i < tableInfo.getTableMap().get(tableId.canonical()).getOnlineTabletCount(); i++) {
TabletStats stats = new TabletStats();
stats.extent = new KeyExtent(tableId, new Text(tserver.getHost() + String.format("%03d", i + 1)), new Text(tserver.getHost() + String.format("%03d", i))).toThrift();
result.add(new TabletStatisticsImpl(stats));
}
return result;
}
Aggregations