Search in sources :

Example 1 with TabletStatisticsImpl

use of org.apache.accumulo.core.manager.balancer.TabletStatisticsImpl in project accumulo by apache.

the class HostRegexTableLoadBalancerReconfigurationTest method getOnlineTabletsForTable.

@Override
public List<TabletStatistics> getOnlineTabletsForTable(TabletServerId tserver, TableId tableId) {
    List<TabletStatistics> tablets = new ArrayList<>();
    // Report assignment information
    for (Entry<TabletId, TabletServerId> e : this.assignments.entrySet()) {
        if (e.getValue().equals(tserver) && e.getKey().getTable().equals(tableId)) {
            TabletStats ts = new TabletStats();
            TabletId tid = e.getKey();
            ts.setExtent(new KeyExtent(tid.getTable(), tid.getEndRow(), tid.getPrevEndRow()).toThrift());
            tablets.add(new TabletStatisticsImpl(ts));
        }
    }
    return tablets;
}
Also used : TabletServerId(org.apache.accumulo.core.spi.balancer.data.TabletServerId) TabletStats(org.apache.accumulo.core.tabletserver.thrift.TabletStats) ArrayList(java.util.ArrayList) TabletStatistics(org.apache.accumulo.core.spi.balancer.data.TabletStatistics) TabletId(org.apache.accumulo.core.data.TabletId) KeyExtent(org.apache.accumulo.core.dataImpl.KeyExtent) TabletStatisticsImpl(org.apache.accumulo.core.manager.balancer.TabletStatisticsImpl)

Example 2 with TabletStatisticsImpl

use of org.apache.accumulo.core.manager.balancer.TabletStatisticsImpl 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 3 with TabletStatisticsImpl

use of org.apache.accumulo.core.manager.balancer.TabletStatisticsImpl 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

ArrayList (java.util.ArrayList)3 TabletStatisticsImpl (org.apache.accumulo.core.manager.balancer.TabletStatisticsImpl)3 TabletStatistics (org.apache.accumulo.core.spi.balancer.data.TabletStatistics)3 TabletStats (org.apache.accumulo.core.tabletserver.thrift.TabletStats)3 KeyExtent (org.apache.accumulo.core.dataImpl.KeyExtent)2 TabletId (org.apache.accumulo.core.data.TabletId)1 TKeyExtent (org.apache.accumulo.core.dataImpl.thrift.TKeyExtent)1 TServerStatus (org.apache.accumulo.core.spi.balancer.data.TServerStatus)1 TabletServerId (org.apache.accumulo.core.spi.balancer.data.TabletServerId)1 Text (org.apache.hadoop.io.Text)1