suddendust commented on code in PR #12522: URL: https://github.com/apache/pinot/pull/12522#discussion_r1511610005
########## pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/RealtimeSegmentDataManager.java: ########## @@ -1661,22 +1666,35 @@ private void makeStreamConsumer(String reason) { closePartitionGroupConsumer(); } _segmentLogger.info("Creating new stream consumer for topic partition {} , reason: {}", _clientId, reason); - _partitionGroupConsumer = - _streamConsumerFactory.createPartitionGroupConsumer(_clientId, _partitionGroupConsumptionStatus); - _partitionGroupConsumer.start(_currentOffset); + try { + _partitionGroupConsumer = + _streamConsumerFactory.createPartitionGroupConsumer(_clientId, _partitionGroupConsumptionStatus); + _partitionGroupConsumer.start(_currentOffset); + } catch (Exception e) { + _segmentLogger.error("Faced exception while trying to recreate stream consumer for topic partition {} reason {}", + _clientId, reason, e); + _serverMetrics.addMeteredTableValue(_clientId, ServerMeter.STREAM_CONSUMER_CREATE_EXCEPTIONS, 1L); + throw e; + } } /** * Checkpoints existing consumer before creating a new consumer instance * Assumes there is a valid instance of {@link PartitionGroupConsumer} */ private void recreateStreamConsumer(String reason) { - _segmentLogger.info("Recreating stream consumer for topic partition {}, reason: {}", _clientId, reason); - _currentOffset = _partitionGroupConsumer.checkpoint(_currentOffset); - closePartitionGroupConsumer(); - _partitionGroupConsumer = - _streamConsumerFactory.createPartitionGroupConsumer(_clientId, _partitionGroupConsumptionStatus); - _partitionGroupConsumer.start(_currentOffset); + try { + _segmentLogger.info("Recreating stream consumer for topic partition {}, reason: {}", _clientId, reason); + _currentOffset = _partitionGroupConsumer.checkpoint(_currentOffset); + closePartitionGroupConsumer(); Review Comment: In ``` 1. _currentOffset = _partitionGroupConsumer.checkpoint(_currentOffset); 2. closePartitionGroupConsumer(); 3. _partitionGroupConsumer = _streamConsumerFactory.createPartitionGroupConsumer(_clientId, _partitionGroupConsumptionStatus); _partitionGroupConsumer.start(_currentOffset); ``` If 1st or 2nd throws an exception, 3rd won't be executed - This is a valid case of incrementing this metric, no? >then the exception is not related to consumer creation. This metric tracks if a consumer cannot be created for any reason. In this case as well, the consumer isn't created. Please correct me if I am wrong. -- 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: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org