zhtaoxiang commented on code in PR #12522: URL: https://github.com/apache/pinot/pull/12522#discussion_r1511624796
########## 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: If the 1st or 2nd line throws an exception, 1. that means the old consumer is still running, may be it can still be used for consuming data? 2. the error is not really about creating consumer, in this case, maybe we don't want to increase the metric, WDYT? -- 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