Browse Source

Remove ReftableNumbersNotIncreasingException

In a distributed setting, one can have multiple datacenters use
reftables for serving, while the ground truth for the Ref database is
administered centrally. In this setting, replication delays combined
with compaction can cause update-index ranges to overlap.

Such a setting is used at Google, and the JGit code already handles
this correctly (modulo a bugfix that applied in change I8f8215b99a).

Remove the restriction that was applied at FileReftableDatabase.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Change-Id: I6f9ed0fbd7fbc5220083ab808b22a909215f13a9
tags/v5.11.1.202105131744-r
Han-Wen Nienhuys 3 years ago
parent
commit
540b29bf42

+ 0
- 37
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileReftableStack.java View File

@@ -128,33 +128,6 @@ public class FileReftableStack implements AutoCloseable {
return stats;
}

/** Thrown if the update indices in the stack are not monotonic */
public static class ReftableNumbersNotIncreasingException
extends RuntimeException {
private static final long serialVersionUID = 1L;

String name;

long lastMax;

long min;

ReftableNumbersNotIncreasingException(String name, long lastMax,
long min) {
this.name = name;
this.lastMax = lastMax;
this.min = min;
}

@SuppressWarnings({ "nls", "boxing" })
@Override
public String toString() {
return String.format(
"ReftableNumbersNotIncreasingException %s: min %d, lastMax %d",
name, min, lastMax);
}
}

/**
* Reloads the stack, potentially reusing opened reftableReaders.
*
@@ -173,7 +146,6 @@ public class FileReftableStack implements AutoCloseable {
List<ReftableReader> newTables = new ArrayList<>();
List<StackEntry> newStack = new ArrayList<>(stack.size() + 1);
try {
ReftableReader last = null;
for (String name : names) {
StackEntry entry = new StackEntry();
entry.name = name;
@@ -191,15 +163,6 @@ public class FileReftableStack implements AutoCloseable {
newTables.add(t);
}

if (last != null) {
// TODO: move this to MergedReftable
if (last.maxUpdateIndex() >= t.minUpdateIndex()) {
throw new ReftableNumbersNotIncreasingException(name,
last.maxUpdateIndex(), t.minUpdateIndex());
}
}
last = t;

entry.reftableReader = t;
newStack.add(entry);
}

Loading…
Cancel
Save