-
Notifications
You must be signed in to change notification settings - Fork 15.2k
KAFKA-19648; Cluster metadata bootstrapping with kraft checkpoint #20707
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
a9c79a3
2a6f663
752a79e
026da2b
7e303b9
584fe3d
9852262
9cb5318
ff3c050
f5763d0
f3a3e41
0ab8e02
1f76fa9
4de55ce
56435b3
29affeb
533033b
f35e992
1c4528e
625acfb
cb2ad18
3c809c1
1908b2c
7226af0
029aa6b
6dbef44
cc3f0b4
7ad1342
135c126
383045a
b474770
721fb5c
cb4803d
6a46cf7
adb1548
a839631
96bc7f3
4823d30
082d469
dae3bd9
8ebfdaf
5ba0c9b
a7450e0
dcd1b0b
67ad6c4
0a78d0d
de4da73
eb4ba90
1d1e7ba
dc27d7c
8469809
2e0c8f0
a182b12
0da0919
fd3adf6
3d589e6
56dae1b
b3feaa6
03eafae
7e8d2e6
7a9404f
9f82078
ff60272
e05dcf2
f0cbc8b
031c0fc
f0b35af
56422a5
3614162
5698e93
d4e3b84
9380605
0e3c626
df3108b
f9ad128
76146ad
2ad3c53
473ac38
da05d3f
7d078b8
b27e7fc
b82a873
711a347
02c9b79
de8bb36
da46fb7
4993aaa
a7edcd0
6601e69
3b4aeb6
7896f12
207ca7c
9ee9f3d
9b668cb
645a08a
8d44f43
3a57241
4c7d5f6
ce5faf6
b83d676
f8df406
d1a8ea7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -437,14 +437,11 @@ void doFormat(BootstrapMetadata bootstrapMetadata) throws Exception { | |||||||||||
| directoryTypes.get(writeLogDir).description(), writeLogDir, | ||||||||||||
| MetadataVersion.FEATURE_NAME, releaseVersion); | ||||||||||||
| Files.createDirectories(Paths.get(writeLogDir)); | ||||||||||||
| BootstrapDirectory bootstrapDirectory = new BootstrapDirectory(writeLogDir); | ||||||||||||
| bootstrapDirectory.writeBinaryFile(bootstrapMetadata); | ||||||||||||
| if (directoryTypes.get(writeLogDir).isDynamicMetadataDirectory()) { | ||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we keep the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we should change this check to
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kevin-wu24 Yes, your approach is much better and more precise. We will file a patch tomorrow if there is no objection.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks @chia7712 and @kevin-wu24 . Let's make sure we have a test that covers this case.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for catching this and for the discussion. I opened a PR to address this issue: #22418 |
||||||||||||
| writeDynamicQuorumSnapshot(writeLogDir, | ||||||||||||
| initialControllers.get(), | ||||||||||||
| featureLevels.get(KRaftVersion.FEATURE_NAME), | ||||||||||||
| controllerListenerName); | ||||||||||||
| } | ||||||||||||
| writeBoostrapSnapshot(writeLogDir, | ||||||||||||
| bootstrapMetadata, | ||||||||||||
| initialControllers.get(), | ||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to pass the optional for |
||||||||||||
| featureLevels.get(KRaftVersion.FEATURE_NAME), | ||||||||||||
| controllerListenerName); | ||||||||||||
| }); | ||||||||||||
| copier.setWriteErrorHandler((errorLogDir, e) -> { | ||||||||||||
| throw new FormatterException("Error while writing meta.properties file " + | ||||||||||||
|
|
@@ -492,8 +489,9 @@ static DirectoryType calculate( | |||||||||||
| } | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| static void writeDynamicQuorumSnapshot( | ||||||||||||
| static void writeBoostrapSnapshot( | ||||||||||||
| String writeLogDir, | ||||||||||||
| BootstrapMetadata bootstrapMetadata, | ||||||||||||
| DynamicVoters initialControllers, | ||||||||||||
| short kraftVersion, | ||||||||||||
| String controllerListenerName | ||||||||||||
|
|
@@ -511,8 +509,9 @@ static void writeDynamicQuorumSnapshot( | |||||||||||
| Snapshots.BOOTSTRAP_SNAPSHOT_ID)). | ||||||||||||
| setKraftVersion(KRaftVersion.fromFeatureLevel(kraftVersion)). | ||||||||||||
| setVoterSet(Optional.of(voterSet)); | ||||||||||||
| try (RecordsSnapshotWriter<ApiMessageAndVersion> writer = builder.build(new MetadataRecordSerde())) { | ||||||||||||
| try (RecordsSnapshotWriter<ApiMessageAndVersion> writer = builder.build(new MetadataRecordSerde(), Optional.of(bootstrapMetadata.records()))) { | ||||||||||||
| writer.freeze(); | ||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wouldn't this write the bootstrap records after the control records, since in
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It doesn't matter what order we write them in because KRaft only reads the control records, and the metadata module will only read the "data" records. When we read the 0-0.checkpoint back into memory, we only deal with either its control records or its data records, not both in the same code. |
||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| } | ||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a clearer way to make these changes. This method is what writes the |
||||||||||||
| } | ||||||||||||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be able to remove this. This applies to other instances where we build the RecordsSnapshotWriter.