Search in sources :

Example 11 with TabletMutator

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

the class MetadataTableUtil method updateTabletDataFile.

public static Map<StoredTabletFile, DataFileValue> updateTabletDataFile(long tid, KeyExtent extent, Map<TabletFile, DataFileValue> estSizes, MetadataTime time, ServerContext context, ServiceLock zooLock) {
    TabletMutator tablet = context.getAmple().mutateTablet(extent);
    tablet.putTime(time);
    Map<StoredTabletFile, DataFileValue> newFiles = new HashMap<>(estSizes.size());
    estSizes.forEach((tf, dfv) -> {
        tablet.putFile(tf, dfv);
        tablet.putBulkFile(tf, tid);
        newFiles.put(tf.insert(), dfv);
    });
    tablet.putZooLock(zooLock);
    tablet.mutate();
    return newFiles;
}
Also used : DataFileValue(org.apache.accumulo.core.metadata.schema.DataFileValue) HashMap(java.util.HashMap) TabletMutator(org.apache.accumulo.core.metadata.schema.Ample.TabletMutator) StoredTabletFile(org.apache.accumulo.core.metadata.StoredTabletFile)

Example 12 with TabletMutator

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

the class MetadataTableUtil method removeScanFiles.

public static void removeScanFiles(KeyExtent extent, Set<StoredTabletFile> scanFiles, ServerContext context, ServiceLock zooLock) {
    TabletMutator tablet = context.getAmple().mutateTablet(extent);
    scanFiles.forEach(tablet::deleteScan);
    tablet.putZooLock(zooLock);
    tablet.mutate();
}
Also used : TabletMutator(org.apache.accumulo.core.metadata.schema.Ample.TabletMutator)

Example 13 with TabletMutator

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

the class MetadataTableUtil method chopped.

public static void chopped(ServerContext context, KeyExtent extent, ServiceLock zooLock) {
    TabletMutator tablet = context.getAmple().mutateTablet(extent);
    tablet.putChopped();
    tablet.putZooLock(zooLock);
    tablet.mutate();
}
Also used : TabletMutator(org.apache.accumulo.core.metadata.schema.Ample.TabletMutator)

Example 14 with TabletMutator

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

the class MetadataTableUtil method removeUnusedWALEntries.

public static void removeUnusedWALEntries(ServerContext context, KeyExtent extent, final List<LogEntry> entries, ServiceLock zooLock) {
    TabletMutator tablet = context.getAmple().mutateTablet(extent);
    entries.forEach(tablet::deleteWal);
    tablet.putZooLock(zooLock);
    tablet.mutate();
}
Also used : TabletMutator(org.apache.accumulo.core.metadata.schema.Ample.TabletMutator)

Example 15 with TabletMutator

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

the class ManagerMetadataUtil method updateTabletDataFile.

/**
 * Update tablet file data from flush. Returns a StoredTabletFile if there are data entries.
 */
public static Optional<StoredTabletFile> updateTabletDataFile(ServerContext context, KeyExtent extent, TabletFile newDatafile, DataFileValue dfv, MetadataTime time, String address, ServiceLock zooLock, Set<String> unusedWalLogs, TServerInstance lastLocation, long flushId) {
    TabletMutator tablet = context.getAmple().mutateTablet(extent);
    // if there are no entries, the path doesn't get stored in metadata table, only the flush ID
    Optional<StoredTabletFile> newFile = Optional.empty();
    // if entries are present, write to path to metadata table
    if (dfv.getNumEntries() > 0) {
        tablet.putFile(newDatafile, dfv);
        tablet.putTime(time);
        newFile = Optional.of(newDatafile.insert());
        TServerInstance self = getTServerInstance(address, zooLock);
        tablet.putLocation(self, LocationType.LAST);
        // remove the old location
        if (lastLocation != null && !lastLocation.equals(self)) {
            tablet.deleteLocation(lastLocation, LocationType.LAST);
        }
    }
    tablet.putFlushId(flushId);
    unusedWalLogs.forEach(tablet::deleteWal);
    tablet.putZooLock(zooLock);
    tablet.mutate();
    return newFile;
}
Also used : TabletMutator(org.apache.accumulo.core.metadata.schema.Ample.TabletMutator) StoredTabletFile(org.apache.accumulo.core.metadata.StoredTabletFile) TServerInstance(org.apache.accumulo.core.metadata.TServerInstance)

Aggregations

TabletMutator (org.apache.accumulo.core.metadata.schema.Ample.TabletMutator)18 StoredTabletFile (org.apache.accumulo.core.metadata.StoredTabletFile)4 TServerInstance (org.apache.accumulo.core.metadata.TServerInstance)4 TabletLocationState (org.apache.accumulo.core.metadata.TabletLocationState)3 KeyExtent (org.apache.accumulo.core.dataImpl.KeyExtent)2 TabletFile (org.apache.accumulo.core.metadata.TabletFile)2 DataFileValue (org.apache.accumulo.core.metadata.schema.DataFileValue)2 MetadataTime (org.apache.accumulo.core.metadata.schema.MetadataTime)2 LogEntry (org.apache.accumulo.core.tabletserver.log.LogEntry)2 Path (org.apache.hadoop.fs.Path)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 List (java.util.List)1 TreeMap (java.util.TreeMap)1 TreeSet (java.util.TreeSet)1 AccumuloClient (org.apache.accumulo.core.client.AccumuloClient)1 NewTableConfiguration (org.apache.accumulo.core.client.admin.NewTableConfiguration)1 ClientContext (org.apache.accumulo.core.clientImpl.ClientContext)1 TableId (org.apache.accumulo.core.data.TableId)1