From 540b29bf4266f3ec974cdf230faca32ab712843b Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 1 Mar 2021 12:17:54 +0100 Subject: [PATCH] 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 Change-Id: I6f9ed0fbd7fbc5220083ab808b22a909215f13a9 --- .../storage/file/FileReftableStack.java | 37 ------------------- 1 file changed, 37 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileReftableStack.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileReftableStack.java index bc2039c56..71130f0f3 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileReftableStack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileReftableStack.java @@ -128,33 +128,6 @@ CompactionStats getStats() { 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 @@ private void reloadOnce(List names) List newTables = new ArrayList<>(); List 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 @@ private void reloadOnce(List names) 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); }