Search in sources :

Example 1 with TabletResourceManager

use of org.apache.accumulo.tserver.TabletServerResourceManager.TabletResourceManager in project accumulo by apache.

the class TabletServer method splitTablet.

private TreeMap<KeyExtent, TabletData> splitTablet(Tablet tablet, byte[] splitPoint) throws IOException {
    long t1 = System.currentTimeMillis();
    TreeMap<KeyExtent, TabletData> tabletInfo = tablet.split(splitPoint);
    if (tabletInfo == null) {
        return null;
    }
    log.info("Starting split: {}", tablet.getExtent());
    statsKeeper.incrementStatusSplit();
    long start = System.currentTimeMillis();
    Tablet[] newTablets = new Tablet[2];
    Entry<KeyExtent, TabletData> first = tabletInfo.firstEntry();
    TabletResourceManager newTrm0 = resourceManager.createTabletResourceManager(first.getKey(), getTableConfiguration(first.getKey()));
    newTablets[0] = new Tablet(TabletServer.this, first.getKey(), newTrm0, first.getValue());
    Entry<KeyExtent, TabletData> last = tabletInfo.lastEntry();
    TabletResourceManager newTrm1 = resourceManager.createTabletResourceManager(last.getKey(), getTableConfiguration(last.getKey()));
    newTablets[1] = new Tablet(TabletServer.this, last.getKey(), newTrm1, last.getValue());
    // roll tablet stats over into tablet server's statsKeeper object as
    // historical data
    statsKeeper.saveMajorMinorTimes(tablet.getTabletStats());
    // lose the reference to the old tablet and open two new ones
    synchronized (onlineTablets) {
        onlineTablets.remove(tablet.getExtent());
        onlineTablets.put(newTablets[0].getExtent(), newTablets[0]);
        onlineTablets.put(newTablets[1].getExtent(), newTablets[1]);
    }
    // tell the master
    enqueueMasterMessage(new SplitReportMessage(tablet.getExtent(), newTablets[0].getExtent(), new Text("/" + newTablets[0].getLocation().getName()), newTablets[1].getExtent(), new Text("/" + newTablets[1].getLocation().getName())));
    statsKeeper.updateTime(Operation.SPLIT, start, 0, false);
    long t2 = System.currentTimeMillis();
    log.info("Tablet split: {} size0 {} size1 {} time {}ms", tablet.getExtent(), newTablets[0].estimateTabletSize(), newTablets[1].estimateTabletSize(), (t2 - t1));
    return tabletInfo;
}
Also used : TabletResourceManager(org.apache.accumulo.tserver.TabletServerResourceManager.TabletResourceManager) TabletData(org.apache.accumulo.tserver.tablet.TabletData) SplitReportMessage(org.apache.accumulo.tserver.mastermessage.SplitReportMessage) Tablet(org.apache.accumulo.tserver.tablet.Tablet) Text(org.apache.hadoop.io.Text) TKeyExtent(org.apache.accumulo.core.data.thrift.TKeyExtent) KeyExtent(org.apache.accumulo.core.data.impl.KeyExtent)

Example 2 with TabletResourceManager

use of org.apache.accumulo.tserver.TabletServerResourceManager.TabletResourceManager in project accumulo by apache.

the class TabletResourceManagerTest method setUp.

@Before
public void setUp() throws Exception {
    tsrm = createMock(TabletServerResourceManager.class);
    extent = createMock(KeyExtent.class);
    conf = createMock(TableConfiguration.class);
    trm = tsrm.new TabletResourceManager(extent, conf);
}
Also used : TabletResourceManager(org.apache.accumulo.tserver.TabletServerResourceManager.TabletResourceManager) KeyExtent(org.apache.accumulo.core.data.impl.KeyExtent) TableConfiguration(org.apache.accumulo.server.conf.TableConfiguration) Before(org.junit.Before)

Example 3 with TabletResourceManager

use of org.apache.accumulo.tserver.TabletServerResourceManager.TabletResourceManager in project accumulo by apache.

the class TabletTest method correctValuesSetForProperties.

@Test
public void correctValuesSetForProperties() {
    TableConfiguration tableConf = EasyMock.createMock(TableConfiguration.class);
    CompactionPlan plan = EasyMock.createMock(CompactionPlan.class);
    WriteParameters writeParams = EasyMock.createMock(WriteParameters.class);
    plan.writeParameters = writeParams;
    DatafileManager dfm = EasyMock.createMock(DatafileManager.class);
    TabletTime time = EasyMock.createMock(TabletTime.class);
    TabletServer tserver = EasyMock.createMock(TabletServer.class);
    TabletResourceManager tserverResourceManager = EasyMock.createMock(TabletResourceManager.class);
    TabletMemory tabletMemory = EasyMock.createMock(TabletMemory.class);
    KeyExtent extent = EasyMock.createMock(KeyExtent.class);
    ConfigurationObserver obs = EasyMock.createMock(ConfigurationObserver.class);
    Tablet tablet = new Tablet(time, "", 0, new Path("/foo"), dfm, tserver, tserverResourceManager, tabletMemory, tableConf, extent, obs);
    long hdfsBlockSize = 10000l, blockSize = 5000l, indexBlockSize = 500l;
    int replication = 5;
    String compressType = "snappy";
    EasyMock.expect(tableConf.iterator()).andReturn(Collections.emptyIterator());
    EasyMock.expect(writeParams.getHdfsBlockSize()).andReturn(hdfsBlockSize).times(2);
    EasyMock.expect(writeParams.getBlockSize()).andReturn(blockSize).times(2);
    EasyMock.expect(writeParams.getIndexBlockSize()).andReturn(indexBlockSize).times(2);
    EasyMock.expect(writeParams.getCompressType()).andReturn(compressType).times(2);
    EasyMock.expect(writeParams.getReplication()).andReturn(replication).times(2);
    EasyMock.replay(tableConf, plan, writeParams);
    AccumuloConfiguration aConf = tablet.createTableConfiguration(tableConf, plan);
    EasyMock.verify(tableConf, plan, writeParams);
    Assert.assertEquals(hdfsBlockSize, Long.parseLong(aConf.get(Property.TABLE_FILE_BLOCK_SIZE)));
    Assert.assertEquals(blockSize, Long.parseLong(aConf.get(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE)));
    Assert.assertEquals(indexBlockSize, Long.parseLong(aConf.get(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE_INDEX)));
    Assert.assertEquals(compressType, aConf.get(Property.TABLE_FILE_COMPRESSION_TYPE));
    Assert.assertEquals(replication, Integer.parseInt(aConf.get(Property.TABLE_FILE_REPLICATION)));
}
Also used : TabletResourceManager(org.apache.accumulo.tserver.TabletServerResourceManager.TabletResourceManager) Path(org.apache.hadoop.fs.Path) CompactionPlan(org.apache.accumulo.tserver.compaction.CompactionPlan) ConfigurationObserver(org.apache.accumulo.core.conf.ConfigurationObserver) TabletTime(org.apache.accumulo.server.tablets.TabletTime) KeyExtent(org.apache.accumulo.core.data.impl.KeyExtent) TabletServer(org.apache.accumulo.tserver.TabletServer) WriteParameters(org.apache.accumulo.tserver.compaction.WriteParameters) TableConfiguration(org.apache.accumulo.server.conf.TableConfiguration) AccumuloConfiguration(org.apache.accumulo.core.conf.AccumuloConfiguration) Test(org.junit.Test)

Aggregations

KeyExtent (org.apache.accumulo.core.data.impl.KeyExtent)3 TabletResourceManager (org.apache.accumulo.tserver.TabletServerResourceManager.TabletResourceManager)3 TableConfiguration (org.apache.accumulo.server.conf.TableConfiguration)2 AccumuloConfiguration (org.apache.accumulo.core.conf.AccumuloConfiguration)1 ConfigurationObserver (org.apache.accumulo.core.conf.ConfigurationObserver)1 TKeyExtent (org.apache.accumulo.core.data.thrift.TKeyExtent)1 TabletTime (org.apache.accumulo.server.tablets.TabletTime)1 TabletServer (org.apache.accumulo.tserver.TabletServer)1 CompactionPlan (org.apache.accumulo.tserver.compaction.CompactionPlan)1 WriteParameters (org.apache.accumulo.tserver.compaction.WriteParameters)1 SplitReportMessage (org.apache.accumulo.tserver.mastermessage.SplitReportMessage)1 Tablet (org.apache.accumulo.tserver.tablet.Tablet)1 TabletData (org.apache.accumulo.tserver.tablet.TabletData)1 Path (org.apache.hadoop.fs.Path)1 Text (org.apache.hadoop.io.Text)1 Before (org.junit.Before)1 Test (org.junit.Test)1