Search in sources :

Example 6 with TabletMutator

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

the class MetadataTableUtil method addTablet.

public static void addTablet(KeyExtent extent, String path, ServerContext context, TimeType timeType, ServiceLock zooLock) {
    TabletMutator tablet = context.getAmple().mutateTablet(extent);
    tablet.putPrevEndRow(extent.prevEndRow());
    tablet.putDirName(path);
    tablet.putTime(new MetadataTime(0, timeType));
    tablet.putZooLock(zooLock);
    tablet.mutate();
}
Also used : TabletMutator(org.apache.accumulo.core.metadata.schema.Ample.TabletMutator) MetadataTime(org.apache.accumulo.core.metadata.schema.MetadataTime)

Example 7 with TabletMutator

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

the class MetadataTableUtil method updateTabletFlushID.

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

Example 8 with TabletMutator

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

the class MetadataTableUtil method updateTabletCompactID.

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

Example 9 with TabletMutator

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

the class MetadataTableUtil method updateTabletVolumes.

public static void updateTabletVolumes(KeyExtent extent, List<LogEntry> logsToRemove, List<LogEntry> logsToAdd, List<StoredTabletFile> filesToRemove, SortedMap<TabletFile, DataFileValue> filesToAdd, ServiceLock zooLock, ServerContext context) {
    TabletMutator tabletMutator = context.getAmple().mutateTablet(extent);
    logsToRemove.forEach(tabletMutator::deleteWal);
    logsToAdd.forEach(tabletMutator::putWal);
    filesToRemove.forEach(tabletMutator::deleteFile);
    filesToAdd.forEach(tabletMutator::putFile);
    tabletMutator.putZooLock(zooLock);
    tabletMutator.mutate();
}
Also used : TabletMutator(org.apache.accumulo.core.metadata.schema.Ample.TabletMutator)

Example 10 with TabletMutator

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

the class MetaDataStateStore method unassign.

private void unassign(Collection<TabletLocationState> tablets, Map<TServerInstance, List<Path>> logsForDeadServers, long suspensionTimestamp) throws DistributedStoreException {
    try (var tabletsMutator = ample.mutateTablets()) {
        for (TabletLocationState tls : tablets) {
            TabletMutator tabletMutator = tabletsMutator.mutateTablet(tls.extent);
            if (tls.current != null) {
                tabletMutator.deleteLocation(tls.current, LocationType.CURRENT);
                if (logsForDeadServers != null) {
                    List<Path> logs = logsForDeadServers.get(tls.current);
                    if (logs != null) {
                        for (Path log : logs) {
                            LogEntry entry = new LogEntry(tls.extent, 0, log.toString());
                            tabletMutator.putWal(entry);
                        }
                    }
                }
                if (suspensionTimestamp >= 0) {
                    tabletMutator.putSuspension(tls.current, suspensionTimestamp);
                }
            }
            if (tls.suspend != null && suspensionTimestamp < 0) {
                tabletMutator.deleteSuspension();
            }
            if (tls.future != null) {
                tabletMutator.deleteLocation(tls.future, LocationType.FUTURE);
            }
            tabletMutator.mutate();
        }
    } catch (RuntimeException ex) {
        throw new DistributedStoreException(ex);
    }
}
Also used : Path(org.apache.hadoop.fs.Path) TabletLocationState(org.apache.accumulo.core.metadata.TabletLocationState) TabletMutator(org.apache.accumulo.core.metadata.schema.Ample.TabletMutator) LogEntry(org.apache.accumulo.core.tabletserver.log.LogEntry)

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