.substring(MetadataSchema.DeletesSection.getRowPrefix().length()); volumes.add(getTableURI(delPath));
private static void moveDeleteEntry(ServerContext context, KeyExtent oldExtent, Entry<Key,Value> entry, String rowID, String prefix) { String filename = rowID.substring(prefix.length()); // add the new entry first log.info("Moving {} marker in {}", filename, RootTable.NAME); Mutation m = new Mutation(MetadataSchema.DeletesSection.getRowPrefix() + filename); m.put(EMPTY_BYTES, EMPTY_BYTES, EMPTY_BYTES); update(context, m, RootTable.EXTENT); // then remove the old entry m = new Mutation(entry.getKey().getRow()); m.putDelete(EMPTY_BYTES, EMPTY_BYTES); update(context, m, oldExtent); }
@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; }
.substring(MetadataSchema.DeletesSection.getRowPrefix().length()); volumes.add(getTableURI(delPath));
@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; } } } }
public static void addEntries(Connector conn, BatchWriterOpts bwOpts) throws Exception { conn.securityOperations().grantTablePermission(conn.whoami(), MetadataTable.NAME, TablePermission.WRITE); BatchWriter bw = conn.createBatchWriter(MetadataTable.NAME, bwOpts.getBatchWriterConfig()); for (int i = 0; i < 100000; ++i) { final Text emptyText = new Text(""); Text row = new Text(String.format("%s/%020d/%s", MetadataSchema.DeletesSection.getRowPrefix(), i, "aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeee" + "ffffffffffgggggggggghhhhhhhhhhiiiiiiiiiijjjjjjjjjj")); Mutation delFlag = new Mutation(row); delFlag.put(emptyText, emptyText, new Value(new byte[] {})); bw.addMutation(delFlag); } bw.close(); } }
public static Mutation createDeleteMutation(String tableId, String pathToRemove) throws IOException { Path path = VolumeManagerImpl.get().getFullPath(tableId, pathToRemove); Mutation delFlag = new Mutation( new Text(MetadataSchema.DeletesSection.getRowPrefix() + path.toString())); delFlag.put(EMPTY_TEXT, EMPTY_TEXT, new Value(new byte[] {})); return delFlag; }
private static void moveDeleteEntry(ClientContext context, KeyExtent oldExtent, Entry<Key,Value> entry, String rowID, String prefix) { String filename = rowID.substring(prefix.length()); // add the new entry first log.info("Moving " + filename + " marker in " + RootTable.NAME); Mutation m = new Mutation(MetadataSchema.DeletesSection.getRowPrefix() + filename); m.put(EMPTY_BYTES, EMPTY_BYTES, EMPTY_BYTES); update(context, m, RootTable.EXTENT); // then remove the old entry m = new Mutation(entry.getKey().getRow()); m.putDelete(EMPTY_BYTES, EMPTY_BYTES); update(context, m, oldExtent); }
private Mutation createDelMutation(String path, String cf, String cq, String val) { Text row = new Text(MetadataSchema.DeletesSection.getRowPrefix() + path); Mutation delFlag = new Mutation(row); delFlag.put(cf, cq, val); return delFlag; }
private static void putMarkerDeleteMutation(final String delete, final BatchWriter writer) throws MutationsRejectedException { Mutation m = new Mutation(MetadataSchema.DeletesSection.getRowPrefix() + delete); m.putDelete(EMPTY_TEXT, EMPTY_TEXT); writer.addMutation(m); }
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; } } } }
private static void putMarkerDeleteMutation(final String delete, final BatchWriter writer) throws MutationsRejectedException { Mutation m = new Mutation(MetadataSchema.DeletesSection.getRowPrefix() + delete); m.putDelete(EMPTY_TEXT, EMPTY_TEXT); writer.addMutation(m); }
public static Mutation createDeleteMutation(ServerContext context, Table.ID tableId, String pathToRemove) { Path path = context.getVolumeManager().getFullPath(tableId, pathToRemove); Mutation delFlag = new Mutation(new Text(MetadataSchema.DeletesSection.getRowPrefix() + path)); delFlag.put(EMPTY_TEXT, EMPTY_TEXT, new Value(new byte[] {})); return delFlag; }