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;
}
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();
}
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();
}
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();
}
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;
}
Aggregations