Miroslav Smiljanic created OAK-12357:
----------------------------------------
Summary: CheckpointCompactor: concurrent checkpoints make
compaction retry cycles re-traverse the whole repository
Key: OAK-12357
URL: https://issues.apache.org/jira/browse/OAK-12357
Project: Jackrabbit Oak
Issue Type: Bug
Components: segment-tar
Affects Versions: 2.4.0
Reporter: Miroslav Smiljanic
Assignee: Miroslav Smiljanic
When new checkpoints are created while compaction runs (async indexing does
this constantly), the CheckpointCompactor's retry cycles diff the current
repository against the previously *compacted* state. That compacted state is in
a different GC generation, and since Oak decides what changed by comparing
record ids, nothing matches across generations - so the diff re-reads and
re-writes the whole tree every cycle, no matter how little actually changed. On
large repositories the retry cycles never catch up, the forced final step times
out, nothing is reclaimed, and the segment store keeps growing.
The fix diffs each retry cycle against the previous *uncompacted* root instead,
which is in the same generation as the live state, so record ids match and only
the real changes are processed; the compacted result is still used, but only as
the state the changes are applied onto (as the legacy compactor already does).
This is a follow-up to OAK-12134, which fixed the same checkpoint-triggered
problem for the first state processed but left the retry cycles diffing against
the compacted state. New tests change a few children under a wide node and
verify a retry compacts only those, not the whole tree.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)