Skip to content

Commit 27d690d

Browse files
authored
allow skip proactive cleaning segment lineages (#8240)
Also refine the logic for lineage cleanup
1 parent 9536aa5 commit 27d690d

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2878,13 +2878,13 @@ public String startReplaceSegments(String tableNameWithType, List<String> segmen
28782878
// By here, the lineage entry is either 'IN_PROGRESS' or 'COMPLETED'.
28792879

28802880
// When 'forceCleanup' is enabled, we need to proactively clean up at the following cases:
2881-
// 1. Revert the lineage entry when we find the lineage entry with the same 'segmentFrom' values. This is
2881+
// 1. Revert the lineage entry when we find the lineage entry with overlapped 'segmentFrom' values. This is
28822882
// used to un-block the segment replacement protocol if the previous attempt failed in the middle.
28832883
// 2. Proactively delete the oldest data snapshot to make sure that we only keep at most 2 data snapshots
28842884
// at any time in case of REFRESH use case.
28852885
if (forceCleanup) {
2886-
if (lineageEntry.getState() == LineageEntryState.IN_PROGRESS && CollectionUtils
2887-
.isEqualCollection(segmentsFrom, lineageEntry.getSegmentsFrom())) {
2886+
if (lineageEntry.getState() == LineageEntryState.IN_PROGRESS && !Collections
2887+
.disjoint(segmentsFrom, lineageEntry.getSegmentsFrom())) {
28882888
LOGGER.info(
28892889
"Detected the incomplete lineage entry with the same 'segmentsFrom'. Reverting the lineage "
28902890
+ "entry to unblock the new segment protocol. tableNameWithType={}, entryId={}, segmentsFrom={}, "

pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/SegmentConversionUtils.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,18 @@ public static void uploadSegment(Map<String, String> configs, List<Header> httpH
125125
public static String startSegmentReplace(String tableNameWithType, String uploadURL,
126126
StartReplaceSegmentsRequest startReplaceSegmentsRequest, @Nullable String authToken)
127127
throws Exception {
128+
return startSegmentReplace(tableNameWithType, uploadURL, startReplaceSegmentsRequest, authToken, true);
129+
}
130+
131+
public static String startSegmentReplace(String tableNameWithType, String uploadURL,
132+
StartReplaceSegmentsRequest startReplaceSegmentsRequest, @Nullable String authToken, boolean forceCleanup)
133+
throws Exception {
128134
String rawTableName = TableNameBuilder.extractRawTableName(tableNameWithType);
129135
TableType tableType = TableNameBuilder.getTableTypeFromTableName(tableNameWithType);
130136
SSLContext sslContext = MinionContext.getInstance().getSSLContext();
131137
try (FileUploadDownloadClient fileUploadDownloadClient = new FileUploadDownloadClient(sslContext)) {
132-
URI uri =
133-
FileUploadDownloadClient.getStartReplaceSegmentsURI(new URI(uploadURL), rawTableName, tableType.name(), true);
138+
URI uri = FileUploadDownloadClient
139+
.getStartReplaceSegmentsURI(new URI(uploadURL), rawTableName, tableType.name(), forceCleanup);
134140
SimpleHttpResponse response =
135141
fileUploadDownloadClient.startReplaceSegments(uri, startReplaceSegmentsRequest, authToken);
136142
String responseString = response.getResponse();

0 commit comments

Comments
 (0)