MINOR: Prevent creating partition.metadata until ID can be written#10041
MINOR: Prevent creating partition.metadata until ID can be written#10041junrao merged 7 commits intoapache:trunkfrom
Conversation
603a074 to
58ee278
Compare
| logDirFailureChannel: LogDirFailureChannel, | ||
| private val hadCleanShutdown: Boolean = true) extends Logging with KafkaMetricsGroup { | ||
| private val hadCleanShutdown: Boolean = true, | ||
| val keepPartitionMetadataFile: Boolean = true) extends Logging with KafkaMetricsGroup { |
There was a problem hiding this comment.
Could we add the new param to the javadoc? In the javadoc, it would be useful to explain a bit how this helps with re-upgrade.
There was a problem hiding this comment.
Something like this work for an explanation?
* boolean flag to indicate whether the partition.metadata file should be kept in the
* log directory. A partition.metadata file is only created when the controller's
* inter-broker protocol version is at least 2.8. This file will persist the topic ID on
* the broker. If inter-broker protocol is downgraded below 2.8, a topic ID may be lost
* and a new ID generated upon re-upgrade. If the inter-broker protocol version is below
* 2.8, partition.metadata will be deleted to avoid ID conflicts upon re-upgrade.
|
Yes. I will want this on the 2.8 branch. I'll check the failed tests. I've also had trouble with building at least one of the three JDKs, but it seems like it is not the same one each time. |
|
|
|
@jolshan : Thanks. For those transient failures, could you file a jira if it's not tracked already? Are the JDK 8 failures also transient? |
|
I had 2 JDK 11 failures previously. I also noticed JDK failures on other PRs. I'll check JIRA for these issues |
|
Looks like one was already created. |
|
@jolshan : Thanks. Were the JDK 8 tests ok too? |
|
@junrao On the previous commit JDK8 built and only MirrorConnectorsIntegrationSSLTest.testOneWayReplicationWithAutoOffsetSync() failed. (The only difference between this commit and the most recent was the javadoc change. Before that, all JDK8 tests passed. |
|
@jolshan Could you rebase the PR for trunk? Also, I am not sure if the PR ports to 2.8 cleanly, if not, could you submit a separate PR for 2.8? Thanks. |
|
@jolshan : Do you have any benchmark results that you want to share? |
|
Sure. Using the LeaderAndIsrBenchmark (and the async profiler) LISRbench.zip I took a look at the flame graph for these tests and the file I/O impact seemed to be very minimal This was trunk before the changes: |
|
@jolshan : It seems this PR can't be applied cleanly in 2.8. Could you submit a separate PR for 2.8? Thanks. |
…e-allocations-lz4 * apache-github/trunk: (118 commits) KAFKA-12327: Remove MethodHandle usage in CompressionType (apache#10123) KAFKA-12297: Make MockProducer return RecordMetadata with values as per contract MINOR: Update zstd and use classes with no finalizers (apache#10120) KAFKA-12326: Corrected regresion in MirrorMaker 2 executable introduced with KAFKA-10021 (apache#10122) KAFKA-12321 the comparison function for uuid type should be 'equals' rather than '==' (apache#10098) MINOR: Add FetchSnapshot API doc in KafkaRaftClient (apache#10097) MINOR: KIP-631 KafkaConfig fixes and improvements (apache#10114) KAFKA-12272: Fix commit-interval metrics (apache#10102) MINOR: Improve confusing admin client shutdown logging (apache#10107) MINOR: Add BrokerMetadataListener (apache#10111) MINOR: Support Raft-based metadata quorums in system tests (apache#10093) MINOR: add the MetaLogListener, LocalLogManager, and Controller interface. (apache#10106) MINOR: Introduce the KIP-500 Broker lifecycle manager (apache#10095) MINOR: Remove always-passing validation in TestRecordTest#testProducerRecord (apache#9930) KAFKA-5235: GetOffsetShell: Support for multiple topics and consumer configuration override (KIP-635) (apache#9430) MINOR: Prevent creating partition.metadata until ID can be written (apache#10041) MINOR: Add RaftReplicaManager (apache#10069) MINOR: Add ClientQuotaMetadataManager for processing QuotaRecord (apache#10101) MINOR: Rename DecommissionBrokers to UnregisterBrokers (apache#10084) MINOR: KafkaBroker.brokerState should be volatile instead of AtomicReference (apache#10080) ... clients/src/main/java/org/apache/kafka/common/record/CompressionType.java core/src/test/scala/unit/kafka/coordinator/group/GroupMetadataManagerTest.scala
Currently the partition.metadata file is created when the log is created. However, clusters with older inter-broker protocols will never use this file. This PR moves the creation of the file to when we write to the file.
This PR also deletes the partition.metadata file on startup if the IBP version is lower than 2.8.
I will be looking at benchmarks to see how these changes affect LISR request processing.
Committer Checklist (excluded from commit message)