Skip to content

Commit

Permalink
Fix apache#1043 Support stable ~del split points includes recommended…
Browse files Browse the repository at this point in the history
… changes
  • Loading branch information
hkeebler committed Sep 17, 2019
1 parent 0d563a8 commit 44a1d15
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
Expand Up @@ -37,8 +37,6 @@
public class MetadataSchema {

public static final String RESERVED_PREFIX = "~";
public static final int ENCODED_PREFIX_LENGTH =
MetadataSchema.DeletesSection.getRowPrefix().length() + SortSkew.SORTSKEW_LENGTH;

/**
* Used for storing information about tablets
Expand Down Expand Up @@ -257,20 +255,19 @@ public static class DeletesSection {
private static final Section section =
new Section(RESERVED_PREFIX + "del", true, RESERVED_PREFIX + "dem", false);

private static final int encoded_prefix_length =
section.getRowPrefix().length() + SortSkew.SORTSKEW_LENGTH;

public static Range getRange() {
return section.getRange();
}

public static String getRowPrefix() {
return section.getRowPrefix();
}

public static String encodeRow(String value) {
return getRowPrefix() + SortSkew.getCode(value) + value;
return section.getRowPrefix() + SortSkew.getCode(value) + value;
}

public static String decodeRow(String row) {
return row.substring(ENCODED_PREFIX_LENGTH);
return row.substring(encoded_prefix_length);
}

}
Expand Down
Expand Up @@ -79,11 +79,11 @@ private static void listZookeeper(ServerContext context) throws Exception {

}

private static void listTable(Ample.DataLevel name, ServerContext context) throws Exception {
private static void listTable(Ample.DataLevel level, ServerContext context) throws Exception {

System.out.println("Listing volumes referenced in " + name + " tablets section");
System.out.println("Listing volumes referenced in " + level + " tablets section");

Scanner scanner = context.createScanner(name.metaTable(), Authorizations.EMPTY);
Scanner scanner = context.createScanner(level.metaTable(), Authorizations.EMPTY);

scanner.setRange(MetadataSchema.TabletsSection.getRange());
scanner.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
Expand All @@ -110,19 +110,19 @@ private static void listTable(Ample.DataLevel name, ServerContext context) throw
System.out.println("\tVolume : " + volume);
}

System.out.println("Listing volumes referenced in " + name
System.out.println("Listing volumes referenced in " + level
+ " deletes section (volume replacement occurrs at deletion time)");
volumes.clear();

Iterator<String> delPaths = context.getAmple().getGcCandidates(name, "");
Iterator<String> delPaths = context.getAmple().getGcCandidates(level, "");
while (delPaths.hasNext()) {
volumes.add(getTableURI(delPaths.next()));
}
for (String volume : volumes) {
System.out.println("\tVolume : " + volume);
}

System.out.println("Listing volumes referenced in " + name + " current logs");
System.out.println("Listing volumes referenced in " + level + " current logs");
volumes.clear();

WalStateManager wals = new WalStateManager(context);
Expand Down

0 comments on commit 44a1d15

Please sign in to comment.