suddendust commented on code in PR #12522:
URL: https://github.com/apache/pinot/pull/12522#discussion_r1511662491
##########
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:
>that means the old consumer is still running, may be it can still be used
for consuming data?
I am not sure of the control flow here, if it can be re-used. If it can be
reused, then yes, we shouldn't bump the metric. If it can't, then we should.
But look at it this way: We want to be alerted in both cases because the
control tried creating a new consumer and hoped using that, but it couldn't for
some reason. We def want to look into why we couldn't even close the old
consumer.
--
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]