You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by jl...@apache.org on 2021/11/11 22:44:14 UTC
[pinot] 01/01: Handle null segment lineage ZNRecord for
getSelectedSegments API
This is an automated email from the ASF dual-hosted git repository.
jlli pushed a commit to branch handle-null-segment-lineage
in repository https://gitbox.apache.org/repos/asf/pinot.git
commit 31fe0984bfdeec4277e61ad1c0d64c593e50defc
Author: Jack Li(Analytics Engineering) <jl...@jlli-mn1.linkedin.biz>
AuthorDate: Thu Nov 11 14:43:05 2021 -0800
Handle null segment lineage ZNRecord for getSelectedSegments API
---
.../controller/helix/core/PinotHelixResourceManager.java | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java b/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
index 71d3ede..5d1282b 100644
--- a/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
+++ b/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
@@ -620,10 +620,14 @@ public class PinotHelixResourceManager {
// Fetch the segment lineage metadata, and filter segments based on segment lineage.
ZNRecord segmentLineageZNRecord =
SegmentLineageAccessHelper.getSegmentLineageZNRecord(_propertyStore, tableNameWithType);
- SegmentLineage segmentLineage = SegmentLineage.fromZNRecord(segmentLineageZNRecord);
- Set<String> selectedSegmentSet = new HashSet<>(selectedSegments);
- SegmentLineageUtils.filterSegmentsBasedOnLineageInPlace(selectedSegmentSet, segmentLineage);
- return new ArrayList<>(selectedSegmentSet);
+ if (segmentLineageZNRecord == null) {
+ return selectedSegments;
+ } else {
+ SegmentLineage segmentLineage = SegmentLineage.fromZNRecord(segmentLineageZNRecord);
+ Set<String> selectedSegmentSet = new HashSet<>(selectedSegments);
+ SegmentLineageUtils.filterSegmentsBasedOnLineageInPlace(selectedSegmentSet, segmentLineage);
+ return new ArrayList<>(selectedSegmentSet);
+ }
}
/**
@@ -3049,7 +3053,7 @@ public class PinotHelixResourceManager {
}
return hosts;
}
-
+
/*
* Uncomment and use for testing on a real cluster
public static void main(String[] args) throws Exception {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org