protected static TabletStateStore getStoreForTablet(KeyExtent extent, ServerContext context) { if (extent.isRootTablet()) { return new ZooTabletStateStore(context); } else if (extent.isMeta()) { return new RootTabletStateStore(context); } else { return new MetaDataStateStore(context); } } }
@Override public void setFutureLocations(Collection<Assignment> assignments) throws DistributedStoreException { BatchWriter writer = createBatchWriter(); try { for (Assignment assignment : assignments) { Mutation m = new Mutation(assignment.tablet.getMetadataEntry()); SuspendingTServer.clearSuspension(m); assignment.server.putFutureLocation(m); writer.addMutation(m); } } catch (Exception ex) { throw new DistributedStoreException(ex); } finally { try { writer.close(); } catch (MutationsRejectedException e) { throw new DistributedStoreException(e); } } }
/** * Creates a new GC WAL object. * * @param context * the collection server's context * @param fs * volume manager to use * @param useTrash * true to move files to trash rather than delete them */ GarbageCollectWriteAheadLogs(final ServerContext context, VolumeManager fs, boolean useTrash) { this.context = context; this.fs = fs; this.useTrash = useTrash; this.liveServers = new LiveTServerSet(context, (current, deleted, added) -> { log.debug("New tablet servers noticed: {}", added); log.debug("Tablet servers removed: {}", deleted); }); liveServers.startListeningForTabletServerChanges(); this.walMarker = new WalStateManager(context); this.store = () -> Iterators.concat(new RootTabletStateStore(context).iterator(), new MetaDataStateStore(context).iterator()); }
MetaDataStateStore metaDataStateStore = new MetaDataStateStore(context, state); int count = 0; for (TabletLocationState tss : metaDataStateStore) { update(connector, m); metaDataStateStore .setLocations(Collections.singletonList(new Assignment(tablet, state.someTServer))); metaDataStateStore.unassign( Collections.singletonList( new TabletLocationState(tablet, null, state.someTServer, null, null, walogs, false)),
MetaDataStateStore store = new MetaDataStateStore(context); store.setLocations(assignments);
private void waitForCleanStore(MetaDataStateStore store) { while (true) { try (ClosableIterator<TabletLocationState> iter = store.iterator()) { Iterators.size(iter); } catch (Exception ex) { System.out.println(ex); UtilWaitThread.sleep(250); continue; } break; } }
@Override public void unassign(Collection<TabletLocationState> tablets, Map<TServerInstance,List<Path>> logsForDeadServers) throws DistributedStoreException { suspend(tablets, logsForDeadServers, -1); }
@Override public void unassign(Collection<TabletLocationState> tablets, Map<TServerInstance,List<Path>> logsForDeadServers) throws DistributedStoreException { suspend(tablets, logsForDeadServers, -1); }
watchers.add(new TabletGroupWatcher(this, new MetaDataStateStore(context, this), null) { @Override boolean canSuspendTablets() {
@Override public Iterator<TabletLocationState> iterator() { return Iterators.concat(new RootTabletStateStore(context).iterator(), new MetaDataStateStore(context).iterator()); } };
@Override public void unsuspend(Collection<TabletLocationState> tablets) throws DistributedStoreException { BatchWriter writer = createBatchWriter(); try { for (TabletLocationState tls : tablets) { if (tls.suspend != null) { continue; } Mutation m = new Mutation(tls.extent.getMetadataEntry()); SuspendingTServer.clearSuspension(m); writer.addMutation(m); } } catch (Exception ex) { throw new DistributedStoreException(ex); } finally { try { writer.close(); } catch (MutationsRejectedException e) { throw new DistributedStoreException(e); } } }
public static void unassign(TabletLocationState tls) throws DistributedStoreException { TabletStateStore store; if (tls.extent.isRootTablet()) { store = new ZooTabletStateStore(); } else { store = new MetaDataStateStore(); } store.unassign(Collections.singletonList(tls)); }
@Override public void setLocations(Collection<Assignment> assignments) throws DistributedStoreException { BatchWriter writer = createBatchWriter(); try { for (Assignment assignment : assignments) { Mutation m = new Mutation(assignment.tablet.getMetadataEntry()); assignment.server.putLocation(m); assignment.server.clearFutureLocation(m); SuspendingTServer.clearSuspension(m); writer.addMutation(m); } } catch (Exception ex) { throw new DistributedStoreException(ex); } finally { try { writer.close(); } catch (MutationsRejectedException e) { throw new DistributedStoreException(e); } } }
public static void setLocation(Assignment assignment) throws DistributedStoreException { TabletStateStore store; if (assignment.tablet.isRootTablet()) { store = new ZooTabletStateStore(); } else { store = new MetaDataStateStore(); } store.setLocations(Collections.singletonList(assignment)); }
Map<TServerInstance,List<Path>> logsForDeadServers, long suspensionTimestamp) throws DistributedStoreException { BatchWriter writer = createBatchWriter(); try { for (TabletLocationState tls : tablets) {
protected static TabletStateStore getStoreForTablet(KeyExtent extent, AccumuloServerContext context) throws DistributedStoreException { if (extent.isRootTablet()) { return new ZooTabletStateStore(); } else if (extent.isMeta()) { return new RootTabletStateStore(context); } else { return new MetaDataStateStore(context); } } }
@Override public void unsuspend(Collection<TabletLocationState> tablets) throws DistributedStoreException { BatchWriter writer = createBatchWriter(); try { for (TabletLocationState tls : tablets) { if (tls.suspend != null) { continue; } Mutation m = new Mutation(tls.extent.getMetadataEntry()); SuspendingTServer.clearSuspension(m); writer.addMutation(m); } } catch (Exception ex) { throw new DistributedStoreException(ex); } finally { try { writer.close(); } catch (MutationsRejectedException e) { throw new DistributedStoreException(e); } } }
MetaDataStateStore store = new MetaDataStateStore(context, null); while (states.size() < 2) { UtilWaitThread.sleep(250);
@Override public void setFutureLocations(Collection<Assignment> assignments) throws DistributedStoreException { BatchWriter writer = createBatchWriter(); try { for (Assignment assignment : assignments) { Mutation m = new Mutation(assignment.tablet.getMetadataEntry()); SuspendingTServer.clearSuspension(m); assignment.server.putFutureLocation(m); writer.addMutation(m); } } catch (Exception ex) { throw new DistributedStoreException(ex); } finally { try { writer.close(); } catch (MutationsRejectedException e) { throw new DistributedStoreException(e); } } }
final TabletStateStore stores[] = {new ZooTabletStateStore(new ZooStore(zroot)), new RootTabletStateStore(instance, systemAuths, null), new MetaDataStateStore(instance, systemAuths, null)}; watchers.add(new TabletGroupWatcher(stores[2], null)); watchers.add(new TabletGroupWatcher(stores[1], watchers.get(0)));