Merge "reftable: add random suffix to table names"

This commit is contained in:
Matthias Sohn 2021-02-05 19:43:42 -05:00 committed by Gerrit Code Review @ Eclipse.org
commit c2990810e9
1 changed files with 6 additions and 2 deletions

View File

@ -21,6 +21,7 @@
import java.io.InputStreamReader;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
@ -65,6 +66,8 @@ private static class StackEntry {
private final Runnable onChange;
private final SecureRandom random = new SecureRandom();
private final Supplier<Config> configSupplier;
// Used for stats & testing.
@ -365,8 +368,9 @@ private long nextUpdateIndex() throws IOException {
}
private String filename(long low, long high) {
return String.format("%012x-%012x", //$NON-NLS-1$
Long.valueOf(low), Long.valueOf(high));
return String.format("%012x-%012x-%08x", //$NON-NLS-1$
Long.valueOf(low), Long.valueOf(high),
random.nextInt());
}
/**