Search in sources :

Example 6 with TabletStatistics

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;
}
Also used : TabletStats(org.apache.accumulo.core.tabletserver.thrift.TabletStats) ArrayList(java.util.ArrayList) TabletStatistics(org.apache.accumulo.core.spi.balancer.data.TabletStatistics) TKeyExtent(org.apache.accumulo.core.dataImpl.thrift.TKeyExtent) TabletStatisticsImpl(org.apache.accumulo.core.manager.balancer.TabletStatisticsImpl)

Example 7 with TabletStatistics

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;
}
Also used : TabletStats(org.apache.accumulo.core.tabletserver.thrift.TabletStats) ArrayList(java.util.ArrayList) TServerStatus(org.apache.accumulo.core.spi.balancer.data.TServerStatus) TabletStatistics(org.apache.accumulo.core.spi.balancer.data.TabletStatistics) Text(org.apache.hadoop.io.Text) KeyExtent(org.apache.accumulo.core.dataImpl.KeyExtent) TabletStatisticsImpl(org.apache.accumulo.core.manager.balancer.TabletStatisticsImpl)

Aggregations

TabletStatistics (org.apache.accumulo.core.spi.balancer.data.TabletStatistics)7 ArrayList (java.util.ArrayList)6 TabletId (org.apache.accumulo.core.data.TabletId)4 AccumuloException (org.apache.accumulo.core.client.AccumuloException)3 AccumuloSecurityException (org.apache.accumulo.core.client.AccumuloSecurityException)3 TableId (org.apache.accumulo.core.data.TableId)3 TabletStatisticsImpl (org.apache.accumulo.core.manager.balancer.TabletStatisticsImpl)3 TServerStatus (org.apache.accumulo.core.spi.balancer.data.TServerStatus)3 TabletMigration (org.apache.accumulo.core.spi.balancer.data.TabletMigration)3 TabletServerId (org.apache.accumulo.core.spi.balancer.data.TabletServerId)3 TabletStats (org.apache.accumulo.core.tabletserver.thrift.TabletStats)3 HashMap (java.util.HashMap)2 KeyExtent (org.apache.accumulo.core.dataImpl.KeyExtent)2 Map (java.util.Map)1 SortedMap (java.util.SortedMap)1 TreeMap (java.util.TreeMap)1 TKeyExtent (org.apache.accumulo.core.dataImpl.thrift.TKeyExtent)1 BalanceParamsImpl (org.apache.accumulo.core.manager.balancer.BalanceParamsImpl)1 TServerStatusImpl (org.apache.accumulo.core.manager.balancer.TServerStatusImpl)1 TableStatisticsImpl (org.apache.accumulo.core.manager.balancer.TableStatisticsImpl)1