You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2022/04/20 18:05:57 UTC
[GitHub] [pinot] Jackie-Jiang commented on a diff in pull request #8564: Invoke checkpoint before closing partition group consumer
Jackie-Jiang commented on code in PR #8564:
URL: https://github.com/apache/pinot/pull/8564#discussion_r854416554
##########
pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/LLRealtimeSegmentDataManager.java:
##########
@@ -1333,12 +1334,12 @@ public LLRealtimeSegmentDataManager(SegmentZKMetadata segmentZKMetadata, TableCo
}
try {
+ _startOffset = _streamPartitionMsgOffsetFactory.create(_segmentZKMetadata.getStartOffset());
Review Comment:
Can be simplified to `_partitionGroupConsumptionStatus.getStartOffset()`
##########
pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/LLRealtimeSegmentDataManager.java:
##########
@@ -1457,7 +1458,16 @@ private void makeStreamConsumer(String reason) {
_segmentLogger.info("Creating new stream consumer for topic partition {} , reason: {}", _clientId, reason);
_partitionGroupConsumer =
_streamConsumerFactory.createPartitionGroupConsumer(_clientId, _partitionGroupConsumptionStatus);
- _partitionGroupConsumer.start(_partitionGroupConsumptionStatus.getStartOffset());
+ _partitionGroupConsumer.start(_currentOffset);
+ }
+ /**
+ * Checkpoints existing consumer before creating a new consumer instance
+ */
+ private void recreateStreamConsumer(String reason) {
+ if (_partitionGroupConsumer != null) {
+ _currentOffset = _partitionGroupConsumer.checkpoint(_currentOffset);
+ }
+ makeStreamConsumer(reason);
Review Comment:
Let's not reuse the `makeStreamConsumer()` for clear separation of the handling
```suggestion
_segmentLogger.warn("Recreating stream consumer for topic partition: {}, reason: {}", _clientId, reason);
_currentOffset = _partitionGroupConsumer.checkpoint(_currentOffset);
closePartitionGroupConsumer();
_partitionGroupConsumer =
_streamConsumerFactory.createPartitionGroupConsumer(_clientId, _partitionGroupConsumptionStatus);
_partitionGroupConsumer.start(_currentOffset);
```
##########
pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/LLRealtimeSegmentDataManager.java:
##########
@@ -1457,7 +1458,16 @@ private void makeStreamConsumer(String reason) {
_segmentLogger.info("Creating new stream consumer for topic partition {} , reason: {}", _clientId, reason);
_partitionGroupConsumer =
_streamConsumerFactory.createPartitionGroupConsumer(_clientId, _partitionGroupConsumptionStatus);
- _partitionGroupConsumer.start(_partitionGroupConsumptionStatus.getStartOffset());
+ _partitionGroupConsumer.start(_currentOffset);
+ }
Review Comment:
(minor) Add a new line
##########
pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/LLRealtimeSegmentDataManager.java:
##########
@@ -978,6 +978,7 @@ private void closeStreamConsumers() {
private void closePartitionGroupConsumer() {
try {
+// _currentOffset = _partitionGroupConsumer.checkpoint(_currentOffset);
Review Comment:
(minor) remove
--
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-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org