You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by xi...@apache.org on 2025/02/03 11:40:24 UTC

(pinot) branch master updated: Releases partitionGroupConsumerSemaphore incase of Errors (#14974)

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

xiangfu 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 891f7d19f0 Releases partitionGroupConsumerSemaphore incase of Errors (#14974)
891f7d19f0 is described below

commit 891f7d19f0684381ebbe140dd012869fb4149f2e
Author: NOOB <43...@users.noreply.github.com>
AuthorDate: Mon Feb 3 17:10:19 2025 +0530

    Releases partitionGroupConsumerSemaphore incase of Errors (#14974)
    
    * Releases partitionGroupConsumerSemaphore incase of Errors
    
    * add missing flag check
---
 .../apache/pinot/common/restlet/resources/SegmentErrorInfo.java  | 2 +-
 .../core/data/manager/realtime/RealtimeSegmentDataManager.java   | 9 +++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/pinot-common/src/main/java/org/apache/pinot/common/restlet/resources/SegmentErrorInfo.java b/pinot-common/src/main/java/org/apache/pinot/common/restlet/resources/SegmentErrorInfo.java
index 5819e5c798..0c1b49b873 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/restlet/resources/SegmentErrorInfo.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/restlet/resources/SegmentErrorInfo.java
@@ -60,7 +60,7 @@ public class SegmentErrorInfo {
    * @param errorMessage Error message
    * @param exception Exception
    */
-  public SegmentErrorInfo(long timestampMs, String errorMessage, Exception exception) {
+  public SegmentErrorInfo(long timestampMs, String errorMessage, Throwable exception) {
     _timestamp = DateTimeUtils.epochToDefaultDateFormat(timestampMs);
     _errorMessage = errorMessage;
     _stackTrace = (exception != null) ? ExceptionUtils.getStackTrace(exception) : null;
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/RealtimeSegmentDataManager.java b/pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/RealtimeSegmentDataManager.java
index 4d92624512..a06965f16f 100644
--- a/pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/RealtimeSegmentDataManager.java
+++ b/pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/RealtimeSegmentDataManager.java
@@ -1686,17 +1686,18 @@ public class RealtimeSegmentDataManager extends SegmentDataManager {
               _segmentMaxRowCount, new DateTime(_consumeEndTime, DateTimeZone.UTC));
       _allowConsumptionDuringCommit = !_realtimeTableDataManager.isPartialUpsertEnabled() ? true
           : _tableConfig.getUpsertConfig().isAllowPartialUpsertConsumptionDuringCommit();
-    } catch (Exception e) {
+    } catch (Throwable t) {
       // In case of exception thrown here, segment goes to ERROR state. Then any attempt to reset the segment from
       // ERROR -> OFFLINE -> CONSUMING via Helix Admin fails because the semaphore is acquired, but not released.
       // Hence releasing the semaphore here to unblock reset operation via Helix Admin.
       _partitionGroupConsumerSemaphore.release();
+      _acquiredConsumerSemaphore.set(false);
       _realtimeTableDataManager.addSegmentError(_segmentNameStr, new SegmentErrorInfo(now(),
-          "Failed to initialize segment data manager", e));
+          "Failed to initialize segment data manager", t));
       _segmentLogger.warn(
           "Scheduling task to call controller to mark the segment as OFFLINE in Ideal State due"
            + " to initialization error: '{}'",
-          e.getMessage());
+          t.getMessage());
       // Since we are going to throw exception from this thread (helix execution thread), the externalview
       // entry for this segment will be ERROR. We allow time for Helix to make this transition, and then
       // invoke controller API mark it OFFLINE in the idealstate.
@@ -1714,7 +1715,7 @@ public class RealtimeSegmentDataManager extends SegmentDataManager {
           return;
         }
       }).start();
-      throw e;
+      throw t;
     }
   }
 


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