[GitHub] [kafka] cmccabe commented on a change in pull request #11084: KAFKA-13100: Create a snapshot during leadership promotion
cmccabe commented on a change in pull request #11084: URL: https://github.com/apache/kafka/pull/11084#discussion_r672715848 ## File path: metadata/src/main/java/org/apache/kafka/controller/QuorumController.java ## @@ -755,11 +766,22 @@ public void handleLeaderChange(LeaderAndEpoch newLeader) { newEpoch + ", but we never renounced controller epoch " + curEpoch); } -log.warn("Becoming active at controller epoch {}.", newEpoch); +log.info( Review comment: This can fit in two lines... let's try to avoid "exploded" function calls that look like function bodies. ## File path: metadata/src/main/java/org/apache/kafka/controller/QuorumController.java ## @@ -755,11 +766,22 @@ public void handleLeaderChange(LeaderAndEpoch newLeader) { newEpoch + ", but we never renounced controller epoch " + curEpoch); } -log.warn("Becoming active at controller epoch {}.", newEpoch); +log.info( Review comment: This can fit in two or three lines... let's try to avoid "exploded" function calls that look like function bodies. ## File path: metadata/src/main/java/org/apache/kafka/timeline/SnapshotRegistry.java ## @@ -178,14 +178,18 @@ public Snapshot getSnapshot(long epoch) { /** * Creates a new snapshot at the given epoch. * + * If {@code epoch} already exists and it is the last snapshot then just return that snapshot. Review comment: With this modification, the function should be renamed something like `getOrCreateSnapshot`, right? ## File path: metadata/src/main/java/org/apache/kafka/controller/QuorumController.java ## @@ -651,20 +661,21 @@ public void handleCommit(BatchReader reader) { // If we are writing a new snapshot, then we need to keep that around; // otherwise, we should delete up to the current committed offset. snapshotRegistry.deleteSnapshotsUpTo( -Math.min(offset, snapshotGeneratorManager.snapshotLastOffsetFromLog())); + snapshotGeneratorManager.snapshotLastOffsetFromLog().orElse(offset) Review comment: newline not needed here ## File path: metadata/src/main/java/org/apache/kafka/controller/QuorumController.java ## @@ -651,20 +661,21 @@ public void handleCommit(BatchReader reader) { // If we are writing a new snapshot, then we need to keep that around; // otherwise, we should delete up to the current committed offset. snapshotRegistry.deleteSnapshotsUpTo( -Math.min(offset, snapshotGeneratorManager.snapshotLastOffsetFromLog())); + snapshotGeneratorManager.snapshotLastOffsetFromLog().orElse(offset) Review comment: extra newline not needed here -- 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
[GitHub] [kafka] cmccabe commented on a change in pull request #11084: KAFKA-13100: Create a snapshot during leadership promotion
cmccabe commented on a change in pull request #11084: URL: https://github.com/apache/kafka/pull/11084#discussion_r672715848 ## File path: metadata/src/main/java/org/apache/kafka/controller/QuorumController.java ## @@ -755,11 +766,22 @@ public void handleLeaderChange(LeaderAndEpoch newLeader) { newEpoch + ", but we never renounced controller epoch " + curEpoch); } -log.warn("Becoming active at controller epoch {}.", newEpoch); +log.info( Review comment: This can fit in two lines... let's try to avoid "exploded" function calls that look like function bodies. ## File path: metadata/src/main/java/org/apache/kafka/controller/QuorumController.java ## @@ -755,11 +766,22 @@ public void handleLeaderChange(LeaderAndEpoch newLeader) { newEpoch + ", but we never renounced controller epoch " + curEpoch); } -log.warn("Becoming active at controller epoch {}.", newEpoch); +log.info( Review comment: This can fit in two or three lines... let's try to avoid "exploded" function calls that look like function bodies. ## File path: metadata/src/main/java/org/apache/kafka/timeline/SnapshotRegistry.java ## @@ -178,14 +178,18 @@ public Snapshot getSnapshot(long epoch) { /** * Creates a new snapshot at the given epoch. * + * If {@code epoch} already exists and it is the last snapshot then just return that snapshot. Review comment: With this modification, the function should be renamed something like `getOrCreateSnapshot`, right? ## File path: metadata/src/main/java/org/apache/kafka/controller/QuorumController.java ## @@ -651,20 +661,21 @@ public void handleCommit(BatchReader reader) { // If we are writing a new snapshot, then we need to keep that around; // otherwise, we should delete up to the current committed offset. snapshotRegistry.deleteSnapshotsUpTo( -Math.min(offset, snapshotGeneratorManager.snapshotLastOffsetFromLog())); + snapshotGeneratorManager.snapshotLastOffsetFromLog().orElse(offset) Review comment: newline not needed here ## File path: metadata/src/main/java/org/apache/kafka/controller/QuorumController.java ## @@ -651,20 +661,21 @@ public void handleCommit(BatchReader reader) { // If we are writing a new snapshot, then we need to keep that around; // otherwise, we should delete up to the current committed offset. snapshotRegistry.deleteSnapshotsUpTo( -Math.min(offset, snapshotGeneratorManager.snapshotLastOffsetFromLog())); + snapshotGeneratorManager.snapshotLastOffsetFromLog().orElse(offset) Review comment: extra newline not needed here -- 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
[GitHub] [kafka] cmccabe commented on a change in pull request #11084: KAFKA-13100: Create a snapshot during leadership promotion
cmccabe commented on a change in pull request #11084: URL: https://github.com/apache/kafka/pull/11084#discussion_r672716954 ## File path: metadata/src/main/java/org/apache/kafka/controller/QuorumController.java ## @@ -651,20 +661,21 @@ public void handleCommit(BatchReader reader) { // If we are writing a new snapshot, then we need to keep that around; // otherwise, we should delete up to the current committed offset. snapshotRegistry.deleteSnapshotsUpTo( -Math.min(offset, snapshotGeneratorManager.snapshotLastOffsetFromLog())); + snapshotGeneratorManager.snapshotLastOffsetFromLog().orElse(offset) Review comment: newline not needed here ## File path: metadata/src/main/java/org/apache/kafka/controller/QuorumController.java ## @@ -651,20 +661,21 @@ public void handleCommit(BatchReader reader) { // If we are writing a new snapshot, then we need to keep that around; // otherwise, we should delete up to the current committed offset. snapshotRegistry.deleteSnapshotsUpTo( -Math.min(offset, snapshotGeneratorManager.snapshotLastOffsetFromLog())); + snapshotGeneratorManager.snapshotLastOffsetFromLog().orElse(offset) Review comment: extra newline not needed here -- 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
[GitHub] [kafka] cmccabe commented on a change in pull request #11084: KAFKA-13100: Create a snapshot during leadership promotion
cmccabe commented on a change in pull request #11084: URL: https://github.com/apache/kafka/pull/11084#discussion_r672716671 ## File path: metadata/src/main/java/org/apache/kafka/timeline/SnapshotRegistry.java ## @@ -178,14 +178,18 @@ public Snapshot getSnapshot(long epoch) { /** * Creates a new snapshot at the given epoch. * + * If {@code epoch} already exists and it is the last snapshot then just return that snapshot. Review comment: With this modification, the function should be renamed something like `getOrCreateSnapshot`, right? -- 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
[GitHub] [kafka] cmccabe commented on a change in pull request #11084: KAFKA-13100: Create a snapshot during leadership promotion
cmccabe commented on a change in pull request #11084: URL: https://github.com/apache/kafka/pull/11084#discussion_r672715848 ## File path: metadata/src/main/java/org/apache/kafka/controller/QuorumController.java ## @@ -755,11 +766,22 @@ public void handleLeaderChange(LeaderAndEpoch newLeader) { newEpoch + ", but we never renounced controller epoch " + curEpoch); } -log.warn("Becoming active at controller epoch {}.", newEpoch); +log.info( Review comment: This can fit in two lines... let's try to avoid "exploded" function calls that look like function bodies. ## File path: metadata/src/main/java/org/apache/kafka/controller/QuorumController.java ## @@ -755,11 +766,22 @@ public void handleLeaderChange(LeaderAndEpoch newLeader) { newEpoch + ", but we never renounced controller epoch " + curEpoch); } -log.warn("Becoming active at controller epoch {}.", newEpoch); +log.info( Review comment: This can fit in two or three lines... let's try to avoid "exploded" function calls that look like function bodies. -- 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