Skip to content

PHOENIX-7863 Add replication consistency point guard to compaction#2489

Open
Himanshu-g81 wants to merge 6 commits into
apache:PHOENIX-7562-feature-newfrom
Himanshu-g81:PHOENIX-7863
Open

PHOENIX-7863 Add replication consistency point guard to compaction#2489
Himanshu-g81 wants to merge 6 commits into
apache:PHOENIX-7562-feature-newfrom
Himanshu-g81:PHOENIX-7863

Conversation

@Himanshu-g81
Copy link
Copy Markdown
Contributor

On standby clusters, compaction can prematurely purge delete markers that have timestamps newer than the replication consistency point. This causes permanent stale data because when replay eventually catches up, the delete markers that should have been applied are already gone.

This PR adds a compaction guard that floors maxLookbackWindowStart to the minimum consistency point across all HA groups, ensuring delete markers newer than the consistency point are retained until replay has processed them.

The guard is controlled by phoenix.replication.compaction.guard.enabled (default true). It activates automatically when phoenix.replication.replay.enabled=true — no additional configuration needed on standby clusters. The separate flag allows operators to disable the guard independently if needed without turning off replay entirely.

Himanshu Gwalani added 6 commits May 27, 2026 19:19
On standby clusters, compaction can prematurely drop delete markers newer
than the replication consistency point, causing permanent stale data.
This adds a guard that floors maxLookbackWindowStart to the minimum
consistency point across all HA groups when replication replay is enabled.

Enabled via phoenix.replication.compaction.guard.enabled (default true),
active only when phoenix.replication.replay.enabled is also true. Falls
back to retaining all delete markers if the consistency point is
unavailable.
Move applyReplicationConsistencyGuard and adjustMaxLookbackWindowStart
from CompactionScanner to ReplicationLogReplayService where the
consistency point logic belongs. Relocate unit test to
replication.reader package accordingly.
Now that the guard logic lives in the same class, public access is no
longer needed. Tests are in the same package and can still access it.
Co-locate REPLICATION_COMPACTION_GUARD_ENABLED and its default with
the other replication config constants in ReplicationLogReplayService,
removing them from QueryServices/QueryServicesOptions.
- Remove incorrect @VisibleForTesting from applyReplicationConsistencyGuard
  (it is genuinely public, called from CompactionScanner)
- Reduce adjustMaxLookbackWindowStart to package-private
- Fix newHashMapWithExpectedSize(4) to 5 in both IT classes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant