apurtell commented on code in PR #2489:
URL: https://github.com/apache/phoenix/pull/2489#discussion_r3352499553
##########
phoenix-core-server/src/main/java/org/apache/phoenix/replication/reader/ReplicationLogReplayService.java:
##########
@@ -229,6 +251,37 @@ protected long getConsistencyPoint() throws IOException,
SQLException {
return consistencyPoint;
}
+ /**
+ * Applies the replication replay consistency point as a floor on
maxLookbackWindowStart. On
+ * standby clusters, this prevents compaction from dropping delete markers
that have timestamps
+ * newer than the consistency point.
+ */
+ public static long applyReplicationConsistencyGuard(long
currentMaxLookbackWindowStart,
+ Configuration conf, String tableName, String columnFamilyName) {
+ try {
+ long consistencyPoint = getInstance(conf).getConsistencyPoint();
+ return adjustMaxLookbackWindowStart(currentMaxLookbackWindowStart,
consistencyPoint,
+ tableName, columnFamilyName);
+ } catch (Exception e) {
+ LOG.warn("Replication guard enabled but consistency point unavailable
for table={} store={}."
+ + " Retaining all delete markers.", tableName, columnFamilyName, e);
+ return 0L;
+ }
+ }
+
+ @VisibleForTesting
+ static long adjustMaxLookbackWindowStart(long currentMaxLookbackWindowStart,
+ long consistencyPoint, String tableName, String columnFamilyName) {
+ long adjusted = Math.min(currentMaxLookbackWindowStart, consistencyPoint);
+ if (adjusted < currentMaxLookbackWindowStart) {
+ LOG.info(
+ "Replication guard: table={} store={} maxLookbackWindowStart adjusted
from {} to {}"
+ + " (consistencyPoint={})",
+ tableName, columnFamilyName, currentMaxLookbackWindowStart, adjusted,
consistencyPoint);
Review Comment:
Fix this!!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]