swaminathanmanish commented on code in PR #18583:
URL: https://github.com/apache/pinot/pull/18583#discussion_r3349262253
##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/lineage/DefaultLineageManager.java:
##########
@@ -122,24 +121,17 @@ public void updateLineageForRetention(TableConfig
tableConfig, SegmentLineage li
/**
* Helper function to decide whether we should delete segmentsFrom (replaced
segments) given a lineage entry.
*
- * The replaced segments are safe to delete if either:
- * 1) The table is not "REFRESH" (e.g. "APPEND"), in which case they are
deleted immediately, or
- * 2) The lineage entry has been in "COMPLETED" state for longer than {@code
replacedSegmentsRetentionMs}
- * (configurable via {@code replacedSegmentsRetentionPeriod} in table
config, defaulting to 1 day).
+ * The replaced segments are safe to delete once the lineage entry has been
in "COMPLETED" state for longer
+ * than {@code replacedSegmentsRetentionMs} (configurable via {@code
replacedSegmentsRetentionPeriod} in
+ * table config, defaulting to 1 day). The retention period applies
uniformly to all batch ingestion
+ * types — any replacement protocol (REFRESH-table snapshot replace,
APPEND-table minion-driven replace,
+ * segment-group merge) gets the same configurable grace window before its
replaced segments are dropped.
*
- * @param tableConfig a table config
* @param lineageEntry lineage entry
* @param replacedSegmentsRetentionMs configured retention in ms for
replaced segments
* @return True if we can safely delete the replaced segments. False
otherwise.
*/
- private boolean shouldDeleteReplacedSegments(TableConfig tableConfig,
LineageEntry lineageEntry,
- long replacedSegmentsRetentionMs) {
- // TODO: Currently, we preserve the replaced segments for REFRESH tables
only. Once we support
- // data rollback for APPEND tables, we should remove this check.
- String batchSegmentIngestionType =
IngestionConfigUtils.getBatchSegmentIngestionType(tableConfig);
- if (!batchSegmentIngestionType.equalsIgnoreCase("REFRESH")) {
- return true;
- }
+ private boolean shouldDeleteReplacedSegments(LineageEntry lineageEntry, long
replacedSegmentsRetentionMs) {
// Strict < means a 0ms retention won't delete on the exact same
millisecond; this is intentional to
// avoid edge-case races and is consistent with the existing behavior for
non-zero retention values.
return lineageEntry.getTimestamp() < (System.currentTimeMillis() -
replacedSegmentsRetentionMs);
Review Comment:
Thanks Krishan for catching the query issue. Can we make this default for
append tables stricter (1 hr instead of 4 hrs) to make it closer to existing
behavior, since we have introduce a param as well now ?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]