jeffkbkim commented on code in PR #14849:
URL: https://github.com/apache/kafka/pull/14849#discussion_r1408532337


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/runtime/CoordinatorRuntime.java:
##########
@@ -543,8 +543,14 @@ private void transitionTo(
 
                 case ACTIVE:
                     state = CoordinatorState.ACTIVE;
-                    snapshotRegistry.getOrCreateSnapshot(0);
                     partitionWriter.registerListener(tp, 
highWatermarklistener);
+
+                    // If the partition did not contain any records, we would 
not have generated a snapshot
+                    // while loading.
+                    if (lastWrittenOffset == -1L) {
+                        updateLastWrittenOffset(0);
+                        updateLastCommittedOffset(0);
+                    }

Review Comment:
   i reverted this and instead created a snapshot at epoch 0 when transitioning 
to LOADING state. it doesn't make sense to create a snapshot at epoch 0 after 
loading.
   
   i also changed the exception conditions to be `>` and not `>=` since we do 
expect lastCommittedOffset and lastWrittenOffset to sometimes be updated to the 
same value.



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to