ccding commented on a change in pull request #10405:
URL: https://github.com/apache/kafka/pull/10405#discussion_r606040867
##########
File path: clients/src/main/java/org/apache/kafka/common/record/FileRecords.java
##########
@@ -424,21 +439,22 @@ public static FileRecords open(File file,
boolean mutable,
boolean fileAlreadyExists,
int initFileSize,
- boolean preallocate) throws IOException {
+ boolean preallocate,
+ boolean hadCleanShutdown) throws
IOException {
FileChannel channel = openChannel(file, mutable, fileAlreadyExists,
initFileSize, preallocate);
int end = (!fileAlreadyExists && preallocate) ? 0 : Integer.MAX_VALUE;
- return new FileRecords(file, channel, 0, end, false);
+ return new FileRecords(file, channel, 0, end, false, mutable &&
!hadCleanShutdown);
}
public static FileRecords open(File file,
boolean fileAlreadyExists,
int initFileSize,
- boolean preallocate) throws IOException {
- return open(file, true, fileAlreadyExists, initFileSize, preallocate);
+ boolean preallocate, boolean
hadCleanShutdown) throws IOException {
Review comment:
Fixed.
##########
File path: core/src/main/scala/kafka/log/Log.scala
##########
@@ -320,7 +320,7 @@ class Log(@volatile private var _dir: File,
initializeLeaderEpochCache()
initializePartitionMetadata()
- val nextOffset = loadSegments()
+ val nextOffset = loadSegments(hadCleanShutdown)
Review comment:
fixed.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]