Search in sources :

Example 11 with MetadataTime

use of org.apache.accumulo.core.metadata.schema.MetadataTime in project accumulo by apache.

the class PopulateMetadata method writeSplitsToMetadataTable.

private void writeSplitsToMetadataTable(ServerContext context, TableId tableId, SortedSet<Text> splits, Map<Text, Text> data, TimeType timeType, ServiceLock lock, BatchWriter bw) throws MutationsRejectedException {
    Text prevSplit = null;
    Value dirValue;
    for (Text split : Iterables.concat(splits, Collections.singleton(null))) {
        Mutation mut = TabletColumnFamily.createPrevRowMutation(new KeyExtent(tableId, split, prevSplit));
        dirValue = (split == null) ? new Value(ServerColumnFamily.DEFAULT_TABLET_DIR_NAME) : new Value(data.get(split));
        ServerColumnFamily.DIRECTORY_COLUMN.put(mut, dirValue);
        ServerColumnFamily.TIME_COLUMN.put(mut, new Value(new MetadataTime(0, timeType).encode()));
        MetadataTableUtil.putLockID(context, lock, mut);
        prevSplit = split;
        bw.addMutation(mut);
    }
}
Also used : Value(org.apache.accumulo.core.data.Value) Text(org.apache.hadoop.io.Text) Mutation(org.apache.accumulo.core.data.Mutation) KeyExtent(org.apache.accumulo.core.dataImpl.KeyExtent) MetadataTime(org.apache.accumulo.core.metadata.schema.MetadataTime)

Example 12 with MetadataTime

use of org.apache.accumulo.core.metadata.schema.MetadataTime in project accumulo by apache.

the class TabletTimeTest method testGetInstance_Millis.

@Test
public void testGetInstance_Millis() {
    TabletTime t = TabletTime.getInstance(new MetadataTime(1234, TimeType.MILLIS));
    assertEquals(MillisTime.class, t.getClass());
    assertEquals("M1234", t.getMetadataTime().encode());
}
Also used : MetadataTime(org.apache.accumulo.core.metadata.schema.MetadataTime) Test(org.junit.Test)

Example 13 with MetadataTime

use of org.apache.accumulo.core.metadata.schema.MetadataTime in project accumulo by apache.

the class TabletTimeTest method testGetInstance_Logical.

@Test
public void testGetInstance_Logical() {
    TabletTime t = TabletTime.getInstance(new MetadataTime(1234, TimeType.LOGICAL));
    assertEquals(LogicalTime.class, t.getClass());
    assertEquals("L1234", t.getMetadataTime().encode());
}
Also used : MetadataTime(org.apache.accumulo.core.metadata.schema.MetadataTime) Test(org.junit.Test)

Aggregations

MetadataTime (org.apache.accumulo.core.metadata.schema.MetadataTime)13 KeyExtent (org.apache.accumulo.core.dataImpl.KeyExtent)6 Text (org.apache.hadoop.io.Text)6 Value (org.apache.accumulo.core.data.Value)4 DataFileValue (org.apache.accumulo.core.metadata.schema.DataFileValue)4 IOException (java.io.IOException)3 TreeMap (java.util.TreeMap)3 Mutation (org.apache.accumulo.core.data.Mutation)3 StoredTabletFile (org.apache.accumulo.core.metadata.StoredTabletFile)3 TabletFile (org.apache.accumulo.core.metadata.TabletFile)3 Test (org.junit.Test)3 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 AccumuloClient (org.apache.accumulo.core.client.AccumuloClient)2 AccumuloException (org.apache.accumulo.core.client.AccumuloException)2 BatchWriter (org.apache.accumulo.core.client.BatchWriter)2 Scanner (org.apache.accumulo.core.client.Scanner)2 TableNotFoundException (org.apache.accumulo.core.client.TableNotFoundException)2 Key (org.apache.accumulo.core.data.Key)2 PartialKey (org.apache.accumulo.core.data.PartialKey)2