]> source.dussan.org Git - jgit.git/commit
Simplify ReftableCompactor 81/156281/6
authorHan-Wen Nienhuys <hanwen@google.com>
Tue, 21 Jan 2020 18:06:30 +0000 (19:06 +0100)
committerMatthias Sohn <matthias.sohn@sap.com>
Wed, 12 Feb 2020 22:08:20 +0000 (23:08 +0100)
commit753fbaf11a5567915d9eaaa9e07ee1a93674c44e
tree0cf00bdb35cac120e15ad5f7e0f205580d17893e
parent5fd922dfd4361e2ec87e6824633188c027e92898
Simplify ReftableCompactor

The ReftableCompactor supported a byteLimit, but this is currently
unused. The FileReftableStack has a more sophisticated strategy that
amortizes compaction costs.

Rename min/maxUpdateIndex to reflogExpire{Min,Max}UpdateIndex to
reflect their purpose  more accurately.

Since reflogs are generally pruned chronologically (oldest entries are
expired first), one can only prune entries on full compaction, so they
should not be set by default.

Rephrase the function Reader#minUpdateIndex and maxUpdateIndex. These
vars are documented to affect log entries, but semantically, they are
about ref entries. Since ref entries have their timestamps
delta-compressed, it is important for the min/maxUpdateIndex values to
be coherent between different tables.

The logical timestamps for log entries do not have to be coherent in
different tables, as the timestamps of a log entry is part of the key.
For example, a table written at update index 20 may contain a tombstone
log entry at timestamp 1.

Therefore, we set ReftableWriter's min/maxUpdateIndex from the merged
tables we are compacting, rather than from the compaction settings
(which should only control reflog expiry.)

The previous behavior could drop log entries erroneously, especially
in the presence of tombstone log entries. Unfortunately, testing this
properly requires both an API for adding log tombstones, and a more
refined API for controlling automatic compaction. Hence, no test.

Change-Id: I2f4eb7866f607fddd0629809e8e61f0b9097717f
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableCompactorTest.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileReftableStack.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/MergedReftable.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/Reftable.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableCompactor.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableReader.java