Skip to content

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

Open
Himanshu-g81 wants to merge 13 commits into
apache:PHOENIX-7562-feature-newfrom
Himanshu-g81:consistency-point-1
Open

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

Conversation

@Himanshu-g81

Copy link
Copy Markdown
Contributor

[Do Not Merge]

Himanshu Gwalani added 13 commits June 23, 2026 23:47
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
- Move guard enforcement from store-level to RowContext.setTTL() to fix
  TTL window bypass (Math.min cap after Math.max with ttlWindowStart)
- Add Guava memoized cache (30s TTL) for consistency point to reduce
  NameNode RPCs during compaction bursts
- Gate guard on major compactions only (no effect during flush/minor)
- Make constructor private, replace mock injection with test factory
  (setConsistencyPointForTesting)
- Demote per-compaction logging from INFO to DEBUG
- Keep guard config flag for operational flexibility
Verify that resolveConsistencyPoint uses cached value from Guava
memoized supplier and does not re-fetch on every call within TTL.
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