scanner.setRange(MetadataSchema.DeletesSection.getRange());
@Override public boolean getCandidates(String continuePoint, List<String> result) throws TableNotFoundException { // want to ensure GC makes progress... if the 1st N deletes are stable and we keep processing // them, // then will never inspect deletes after N Range range = MetadataSchema.DeletesSection.getRange(); if (continuePoint != null && !continuePoint.isEmpty()) { String continueRow = MetadataSchema.DeletesSection.getRowPrefix() + continuePoint; range = new Range(new Key(continueRow).followingKey(PartialKey.ROW), true, range.getEndKey(), range.isEndKeyInclusive()); } Scanner scanner = getClient().createScanner(tableName, Authorizations.EMPTY); scanner.setRange(range); result.clear(); // find candidates for deletion; chop off the prefix for (Entry<Key,Value> entry : scanner) { String cand = entry.getKey().getRow().toString() .substring(MetadataSchema.DeletesSection.getRowPrefix().length()); result.add(cand); if (almostOutOfMemory(Runtime.getRuntime())) { log.info("List of delete candidates has exceeded the memory" + " threshold. Attempting to delete what has been gathered so far."); return true; } } return false; }
public static void moveMetaDeleteMarkersFrom14(ServerContext context) { // new KeyExtent is only added to force update to write to the metadata table, not the root // table KeyExtent notMetadata = new KeyExtent(Table.ID.of("anythingNotMetadata"), null, null); // move delete markers from the normal delete keyspace to the root tablet delete keyspace if the // files are for the !METADATA table try (Scanner scanner = new ScannerImpl(context, MetadataTable.ID, Authorizations.EMPTY)) { scanner.setRange(MetadataSchema.DeletesSection.getRange()); for (Entry<Key,Value> entry : scanner) { String row = entry.getKey().getRow().toString(); if (row.startsWith(MetadataSchema.DeletesSection.getRowPrefix() + "/" + MetadataTable.ID)) { moveDeleteEntry(context, notMetadata, entry, row, MetadataSchema.DeletesSection.getRowPrefix()); } else { break; } } } }
scanner.setRange(MetadataSchema.DeletesSection.getRange());
scanner.setRange(MetadataSchema.DeletesSection.getRange()); for (Entry<Key,Value> entry : scanner) { String row = entry.getKey().getRow().toString();
@Override public boolean getCandidates(String continuePoint, List<String> result) throws TableNotFoundException, AccumuloException, AccumuloSecurityException { // want to ensure GC makes progress... if the 1st N deletes are stable and we keep processing // them, // then will never inspect deletes after N Range range = MetadataSchema.DeletesSection.getRange(); if (continuePoint != null && !continuePoint.isEmpty()) { String continueRow = MetadataSchema.DeletesSection.getRowPrefix() + continuePoint; range = new Range(new Key(continueRow).followingKey(PartialKey.ROW), true, range.getEndKey(), range.isEndKeyInclusive()); } Scanner scanner = getConnector().createScanner(tableName, Authorizations.EMPTY); scanner.setRange(range); result.clear(); // find candidates for deletion; chop off the prefix for (Entry<Key,Value> entry : scanner) { String cand = entry.getKey().getRow().toString() .substring(MetadataSchema.DeletesSection.getRowPrefix().length()); result.add(cand); if (almostOutOfMemory(Runtime.getRuntime())) { log.info("List of delete candidates has exceeded the memory" + " threshold. Attempting to delete what has been gathered so far."); return true; } } return false; }
public static void moveMetaDeleteMarkersFrom14(ClientContext context) { // new KeyExtent is only added to force update to write to the metadata table, not the root // table KeyExtent notMetadata = new KeyExtent("anythingNotMetadata", null, null); // move delete markers from the normal delete keyspace to the root tablet delete keyspace if the // files are for the !METADATA table try (Scanner scanner = new ScannerImpl(context, MetadataTable.ID, Authorizations.EMPTY)) { scanner.setRange(MetadataSchema.DeletesSection.getRange()); for (Entry<Key,Value> entry : scanner) { String row = entry.getKey().getRow().toString(); if (row.startsWith(MetadataSchema.DeletesSection.getRowPrefix() + "/" + MetadataTable.ID)) { moveDeleteEntry(context, notMetadata, entry, row, MetadataSchema.DeletesSection.getRowPrefix()); } else { break; } } } }
@Test public void mergeMeta() throws Exception { Connector c = getConnector(); String[] names = getUniqueNames(5); SortedSet<Text> splits = new TreeSet<>(); for (String id : "1 2 3 4 5".split(" ")) { splits.add(new Text(id)); } c.tableOperations().addSplits(MetadataTable.NAME, splits); for (String tableName : names) { c.tableOperations().create(tableName); } c.tableOperations().merge(MetadataTable.NAME, null, null); Scanner s = c.createScanner(RootTable.NAME, Authorizations.EMPTY); s.setRange(MetadataSchema.DeletesSection.getRange()); while (Iterators.size(s.iterator()) == 0) { sleepUninterruptibly(100, TimeUnit.MILLISECONDS); } assertEquals(0, c.tableOperations().listSplits(MetadataTable.NAME).size()); }