You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by kh...@apache.org on 2025/03/30 19:27:51 UTC

(pinot) branch master updated: Fix concern with uploaded segments leading to API failure (#15409)

This is an automated email from the ASF dual-hosted git repository.

kharekartik pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new c451c67913 Fix concern with uploaded segments leading to API failure (#15409)
c451c67913 is described below

commit c451c67913fc56bfa03f695c6488231a99cb672d
Author: 9aman <35...@users.noreply.github.com>
AuthorDate: Mon Mar 31 00:57:45 2025 +0530

    Fix concern with uploaded segments leading to API failure (#15409)
    
    * Fix concern with uploaded segments leading to API failure
    
    * Minor fix
---
 .../api/resources/PinotSegmentRestletResource.java      | 17 ++++++++++++++---
 .../api/resources/PinotSegmentRestletResourceTest.java  |  5 +++++
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotSegmentRestletResource.java b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotSegmentRestletResource.java
index a317391766..aff32d0ec4 100644
--- a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotSegmentRestletResource.java
+++ b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotSegmentRestletResource.java
@@ -1274,11 +1274,19 @@ public class PinotSegmentRestletResource {
     Map<Integer, Set<String>> partitionToSegmentsToDelete = new HashMap<>();
 
     for (String segmentName : idealStateSegmentsSet) {
-      LLCSegmentName llcSegmentName = new LLCSegmentName(segmentName);
+      LLCSegmentName llcSegmentName = LLCSegmentName.of(segmentName);
+      if (llcSegmentName == null) {
+        LOGGER.info("Skip segment: {} not in low-level consumer format", segmentName);
+        continue;
+      }
       int partitionId = llcSegmentName.getPartitionGroupId();
 
       LLCSegmentName oldestSegment = partitionToOldestSegment.get(partitionId);
-      if (oldestSegment != null && oldestSegment.getSequenceNumber() <= llcSegmentName.getSequenceNumber()) {
+      if (oldestSegment == null) {
+        continue;
+      }
+
+      if (oldestSegment.getSequenceNumber() <= llcSegmentName.getSequenceNumber()) {
         partitionToSegmentsToDelete
             .computeIfAbsent(partitionId, k -> new HashSet<>())
             .add(segmentName);
@@ -1300,7 +1308,10 @@ public class PinotSegmentRestletResource {
 
     for (String segment : segments) {
       LLCSegmentName llcSegmentName = LLCSegmentName.of(segment);
-      Preconditions.checkState(llcSegmentName != null, "Invalid LLC segment: " + segment);
+      if (llcSegmentName == null) {
+        LOGGER.warn("Skip segment: {} not in low-level consumer format", segment);
+        continue;
+      }
 
       // ignore segments that are not present in the ideal state
       if (!idealStateSegmentsSet.contains(segment)) {
diff --git a/pinot-controller/src/test/java/org/apache/pinot/controller/api/resources/PinotSegmentRestletResourceTest.java b/pinot-controller/src/test/java/org/apache/pinot/controller/api/resources/PinotSegmentRestletResourceTest.java
index a54cb3d884..d7350a17ed 100644
--- a/pinot-controller/src/test/java/org/apache/pinot/controller/api/resources/PinotSegmentRestletResourceTest.java
+++ b/pinot-controller/src/test/java/org/apache/pinot/controller/api/resources/PinotSegmentRestletResourceTest.java
@@ -110,6 +110,11 @@ public class PinotSegmentRestletResourceTest {
       segmentsToInstanceState.put(segment, null);
     }
 
+    // Add segments for partition 2. None of the segments of this partition should be deleted.
+    for (String segment : getSegmentForPartition(tableName, 2, 0, 10, currentTime)) {
+      segmentsToInstanceState.put(segment, null);
+    }
+
     // Mock response for fetching segment to instance state map
     when(idealState.getRecord()).thenReturn(znRecord);
     when(znRecord.getMapFields()).thenReturn(segmentsToInstanceState);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org