xiangfu0 commented on code in PR #17071:
URL: https://github.com/apache/pinot/pull/17071#discussion_r2644846903


##########
pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/RealtimeSegmentDataManager.java:
##########
@@ -630,13 +634,22 @@ private boolean processStreamEvents(MessageBatch 
messageBatch, long idlePipeSlee
       StreamPartitionMsgOffset nextOffset = metadata.getNextOffset();
       int rowSizeInBytes = metadata.getRecordSerializedSize();
       if (decodedRow.getException() != null) {
-        // TODO: based on a config, decide whether the record should be 
silently dropped or stop further consumption on
-        // decode error
-        realtimeRowsDroppedMeter =
-            _serverMetrics.addMeteredTableValue(_clientId, 
ServerMeter.INVALID_REALTIME_ROWS_DROPPED, 1,
-                realtimeRowsDroppedMeter);
-        _numRowsErrored++;
-        _numBytesDropped += rowSizeInBytes;
+        boolean stopOnDecodeError = _streamConfig.getStreamConfigsMap()
+            .getOrDefault("stopOnDecodeError", 
"false").equalsIgnoreCase("true");
+        if (stopOnDecodeError) {
+          String errorMessage = "Stopping consumption due to decode error at 
offset: " + offset;
+          _segmentLogger.error(errorMessage, decodedRow.getException());
+          _realtimeTableDataManager.addSegmentError(_segmentNameStr,
+                  new SegmentErrorInfo(now(), errorMessage, 
decodedRow.getException()));
+          throw new RuntimeException("Stopping consumption due to decode 
error", decodedRow.getException());
+        } else {
+          // Silently drop the row with error

Review Comment:
   I would prefer to print one line of error then swallow all the errors after.



##########
pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/RealtimeSegmentDataManager.java:
##########
@@ -630,13 +634,22 @@ private boolean processStreamEvents(MessageBatch 
messageBatch, long idlePipeSlee
       StreamPartitionMsgOffset nextOffset = metadata.getNextOffset();
       int rowSizeInBytes = metadata.getRecordSerializedSize();
       if (decodedRow.getException() != null) {
-        // TODO: based on a config, decide whether the record should be 
silently dropped or stop further consumption on
-        // decode error
-        realtimeRowsDroppedMeter =
-            _serverMetrics.addMeteredTableValue(_clientId, 
ServerMeter.INVALID_REALTIME_ROWS_DROPPED, 1,
-                realtimeRowsDroppedMeter);
-        _numRowsErrored++;
-        _numBytesDropped += rowSizeInBytes;
+        boolean stopOnDecodeError = _streamConfig.getStreamConfigsMap()
+            .getOrDefault("stopOnDecodeError", 
"false").equalsIgnoreCase("true");
+        if (stopOnDecodeError) {
+          String errorMessage = "Stopping consumption due to decode error at 
offset: " + offset;
+          _segmentLogger.error(errorMessage, decodedRow.getException());
+          _realtimeTableDataManager.addSegmentError(_segmentNameStr,
+                  new SegmentErrorInfo(now(), errorMessage, 
decodedRow.getException()));
+          throw new RuntimeException("Stopping consumption due to decode 
error", decodedRow.getException());
+        } else {
+          // Silently drop the row with error

Review Comment:
   I would prefer to print the first error then swallow all the errors after.



-- 
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]

Reply via email to