TabletLocation tabLoc = TabletLocator.getLocator(context, tableId).locateTablet(context, new Text(m.getRow()), false, true); } catch (NotServingTabletException e) { log.trace("Not serving tablet, server = {}", parsedLocation); TabletLocator.getLocator(context, tableId).invalidateCache(tabLoc.tablet_extent); } catch (ConstraintViolationException cve) { log.error("error sending update to {}", parsedLocation, cve); TabletLocator.getLocator(context, tableId).invalidateCache(tabLoc.tablet_extent); throw cve; } catch (TException e) { log.error("error sending update to {}", parsedLocation, e); TabletLocator.getLocator(context, tableId).invalidateCache(tabLoc.tablet_extent);
@Override public List<Range> binRanges(ClientContext context, List<Range> ranges, Map<String,Map<KeyExtent,List<Range>>> binnedRanges) throws AccumuloException, AccumuloSecurityException, TableNotFoundException { return syncLocator().binRanges(context, ranges, binnedRanges); }
static synchronized void disable() { clearLocators(); enabled = false; }
@Override public void clearLocatorCache(String tableName) throws TableNotFoundException { checkArgument(tableName != null, "tableName is null"); TabletLocator tabLocator = TabletLocator.getLocator(context, Tables.getTableId(context, tableName)); tabLocator.invalidateCache(); }
Map<String,Map<KeyExtent,List<Range>>> binnedRanges = new HashMap<>(); Table.ID tableId = Tables.getTableId(context, tableName); TabletLocator tl = TabletLocator.getLocator(context, tableId); tl.invalidateCache(); while (!tl.binRanges(context, Collections.singletonList(range), binnedRanges).isEmpty()) { if (!Tables.exists(context, tableId)) throw new TableDeletedException(tableId.canonicalID()); tl.invalidateCache();
@Override public void invalidateCache(ClientContext context, String server) { syncLocator().invalidateCache(context, server); } }
tl.invalidateCache(); while (!tl.binRanges(clientContext, ranges, binnedRanges).isEmpty()) { String tableIdStr = tableId.canonicalID(); if (!Tables.exists(clientContext, tableId)) tl.invalidateCache();
public SyncingTabletLocator(final ClientContext context, final Table.ID tableId) { this(() -> TabletLocator.getLocator(context, tableId)); }
@Override public TabletLocation locateTablet(ClientContext context, Text row, boolean skipRow, boolean retry) throws AccumuloException, AccumuloSecurityException, TableNotFoundException { return syncLocator().locateTablet(context, row, skipRow, retry); }
@Override public <T extends Mutation> void binMutations(ClientContext context, List<T> mutations, Map<String,TabletServerMutations<T>> binnedMutations, List<T> failures) throws AccumuloException, AccumuloSecurityException, TableNotFoundException { syncLocator().binMutations(context, mutations, binnedMutations, failures); }
@Override public void disable() { TabletLocator.disable(); } });
@Override public boolean isEnabled() { return TabletLocator.isEnabled(); }
@Override public void enable() { TabletLocator.enable(); }
TabletLocator locator = TabletLocator.getLocator(context, tableId); locator.invalidateCache(); .createRetry(); while (!locator.binRanges(context, rangeList, binnedRanges).isEmpty()) { locator.invalidateCache();
@Override public void invalidateCache() { syncLocator().invalidateCache(); }
final TabletLocator locator = TabletLocator.getLocator(context, Table.ID.of(tableId)); while (assignmentFailures.size() > 0) { sleepTime = Math.min(sleepTime * 2, 60 * 1000); locator.invalidateCache();
tl.invalidateCache(); while (!tl.binRanges(context, ranges, binnedRanges).isEmpty()) { String tableIdStr = tableId.canonicalID(); if (!Tables.exists(context, tableId)) tl.invalidateCache();
public static synchronized TabletLocator getLocator(ClientContext context, Table.ID tableId) { Preconditions.checkState(enabled, "The Accumulo singleton that that tracks tablet locations is " + "disabled. This is likely caused by all AccumuloClients being closed or garbage collected" + "."); LocatorKey key = new LocatorKey(context.getInstanceID(), tableId); TabletLocator tl = locators.get(key); if (tl == null) { MetadataLocationObtainer mlo = new MetadataLocationObtainer(); if (RootTable.ID.equals(tableId)) { tl = new RootTabletLocator(new ZookeeperLockChecker(context)); } else if (MetadataTable.ID.equals(tableId)) { tl = new TabletLocatorImpl(MetadataTable.ID, getLocator(context, RootTable.ID), mlo, new ZookeeperLockChecker(context)); } else { tl = new TabletLocatorImpl(tableId, getLocator(context, MetadataTable.ID), mlo, new ZookeeperLockChecker(context)); } locators.put(key, tl); } return tl; }
TabletLocation tabletLocation = locator.locateTablet(context, row, false, true);
private void queue(List<QCMutation> mutations) { List<QCMutation> failures = new ArrayList<>(); Map<String,TabletServerMutations<QCMutation>> binnedMutations = new HashMap<>(); try { locator.binMutations(context, mutations, binnedMutations, failures); if (failures.size() == mutations.size()) if (!Tables.exists(context, tableId)) throw new TableDeletedException(tableId.canonicalID()); else if (Tables.getTableState(context, tableId) == TableState.OFFLINE) throw new TableOfflineException(Tables.getTableOfflineMsg(context, tableId)); } catch (Exception e) { for (QCMutation qcm : mutations) qcm.queueResult(new Result(e, qcm, null)); // do not want to queue anything that was put in before binMutations() failed failures.clear(); binnedMutations.clear(); } if (failures.size() > 0) queueRetry(failures, null); for (Entry<String,TabletServerMutations<QCMutation>> entry : binnedMutations.entrySet()) { queue(entry.getKey(), entry.getValue()); } }