use of org.apache.accumulo.core.metadata.schema.Ample.TabletMutator in project accumulo by apache.
the class ZooTabletStateStore method unassign.
@Override
public void unassign(Collection<TabletLocationState> tablets, Map<TServerInstance, List<Path>> logsForDeadServers) throws DistributedStoreException {
if (tablets.size() != 1)
throw new IllegalArgumentException("There is only one root tablet");
TabletLocationState tls = tablets.iterator().next();
if (tls.extent.compareTo(RootTable.EXTENT) != 0)
throw new IllegalArgumentException("You can only store the root tablet location");
TabletMutator tabletMutator = ample.mutateTablet(tls.extent);
tabletMutator.deleteLocation(tls.futureOrCurrent(), LocationType.FUTURE);
tabletMutator.deleteLocation(tls.futureOrCurrent(), LocationType.CURRENT);
if (logsForDeadServers != null) {
List<Path> logs = logsForDeadServers.get(tls.futureOrCurrent());
if (logs != null) {
for (Path entry : logs) {
LogEntry logEntry = new LogEntry(RootTable.EXTENT, System.currentTimeMillis(), entry.toString());
tabletMutator.putWal(logEntry);
}
}
}
tabletMutator.mutate();
log.debug("unassign root tablet location");
}
use of org.apache.accumulo.core.metadata.schema.Ample.TabletMutator in project accumulo by apache.
the class ZooTabletStateStore method setFutureLocations.
@Override
public void setFutureLocations(Collection<Assignment> assignments) throws DistributedStoreException {
if (assignments.size() != 1)
throw new IllegalArgumentException("There is only one root tablet");
Assignment assignment = assignments.iterator().next();
if (assignment.tablet.compareTo(RootTable.EXTENT) != 0)
throw new IllegalArgumentException("You can only store the root tablet location");
TabletMutator tabletMutator = ample.mutateTablet(assignment.tablet);
tabletMutator.putLocation(assignment.server, LocationType.FUTURE);
tabletMutator.mutate();
}
use of org.apache.accumulo.core.metadata.schema.Ample.TabletMutator in project accumulo by apache.
the class ZooTabletStateStore method setLocations.
@Override
public void setLocations(Collection<Assignment> assignments) throws DistributedStoreException {
if (assignments.size() != 1)
throw new IllegalArgumentException("There is only one root tablet");
Assignment assignment = assignments.iterator().next();
if (assignment.tablet.compareTo(RootTable.EXTENT) != 0)
throw new IllegalArgumentException("You can only store the root tablet location");
TabletMutator tabletMutator = ample.mutateTablet(assignment.tablet);
tabletMutator.putLocation(assignment.server, LocationType.CURRENT);
tabletMutator.deleteLocation(assignment.server, LocationType.FUTURE);
tabletMutator.mutate();
}
use of org.apache.accumulo.core.metadata.schema.Ample.TabletMutator in project accumulo by apache.
the class ManagerMetadataUtil method addNewTablet.
public static void addNewTablet(ServerContext context, KeyExtent extent, String dirName, TServerInstance location, Map<StoredTabletFile, DataFileValue> datafileSizes, Map<Long, ? extends Collection<TabletFile>> bulkLoadedFiles, MetadataTime time, long lastFlushID, long lastCompactID, ServiceLock zooLock) {
TabletMutator tablet = context.getAmple().mutateTablet(extent);
tablet.putPrevEndRow(extent.prevEndRow());
tablet.putZooLock(zooLock);
tablet.putDirName(dirName);
tablet.putTime(time);
if (lastFlushID > 0)
tablet.putFlushId(lastFlushID);
if (lastCompactID > 0)
tablet.putCompactionId(lastCompactID);
if (location != null) {
tablet.putLocation(location, LocationType.CURRENT);
tablet.deleteLocation(location, LocationType.FUTURE);
}
datafileSizes.forEach(tablet::putFile);
for (Entry<Long, ? extends Collection<TabletFile>> entry : bulkLoadedFiles.entrySet()) {
for (TabletFile ref : entry.getValue()) {
tablet.putBulkFile(ref, entry.getKey());
}
}
tablet.mutate();
}
use of org.apache.accumulo.core.metadata.schema.Ample.TabletMutator in project accumulo by apache.
the class MetadataTableUtil method updateTabletDir.
public static void updateTabletDir(KeyExtent extent, String newDir, ServerContext context, ServiceLock zooLock) {
TabletMutator tablet = context.getAmple().mutateTablet(extent);
tablet.putDirName(newDir);
tablet.putZooLock(zooLock);
tablet.mutate();
}
Aggregations