Skip to content

Revert "KAFKA-16154" and mark MV 3.8-IV0 as the latest production#16400

Merged
jlprat merged 11 commits intoapache:3.8from
jlprat:MINOR-revert-KAFKA-16154
Jul 2, 2024
Merged

Revert "KAFKA-16154" and mark MV 3.8-IV0 as the latest production#16400
jlprat merged 11 commits intoapache:3.8from
jlprat:MINOR-revert-KAFKA-16154

Conversation

@jlprat
Copy link
Copy Markdown
Contributor

@jlprat jlprat commented Jun 20, 2024

This reverts commit 55a6d30
As described in #16347 (comment)

More detailed description of your change,
if necessary. The PR title and PR message become
the squashed commit message, so use a separate
comment to ping reviewers.

Summary of testing strategy (including rationale)
for the feature or bug fix. Unit and/or integration
tests are expected for any behaviour change and
system tests should be considered for larger changes.

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@jlprat
Copy link
Copy Markdown
Contributor Author

jlprat commented Jun 20, 2024

@cmccabe If you have time, this should be the revert of commit 55a6d30 on the 3.8 branch.
A generated revert was not possible as there were merge conflicts.

Comment on lines -1314 to -1335
} else if (targetTimestamp == ListOffsetsRequest.LATEST_TIERED_TIMESTAMP) {
if (remoteLogEnabled()) {
val curHighestRemoteOffset = highestOffsetInRemoteStorage()

val epochResult: Optional[Integer] =
if (leaderEpochCache.isDefined) {
val epochOpt = leaderEpochCache.get.epochForOffset(curHighestRemoteOffset)
if (epochOpt.isPresent) {
Optional.of(epochOpt.getAsInt)
} else if (curHighestRemoteOffset == -1) {
Optional.of(RecordBatch.NO_PARTITION_LEADER_EPOCH)
} else {
Optional.empty()
}
} else {
Optional.empty()
}

Some(new TimestampAndOffset(RecordBatch.NO_TIMESTAMP, curHighestRemoteOffset, epochResult))
} else {
Some(new TimestampAndOffset(RecordBatch.NO_TIMESTAMP, -1L, Optional.of(-1)))
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These and the 8 lines prior were the ones with a conflict when reverting.

@jlprat
Copy link
Copy Markdown
Contributor Author

jlprat commented Jun 20, 2024

Build failure contained:

14:54:56 hudson.remoting.Channel$OrderlyShutdown: Command Close created at ...

I triggered another build

Copy link
Copy Markdown
Contributor

@junrao junrao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jlprat : Thanks for the PR. Added a few comments.

* IT CANNOT BE CHANGED.</strong>
*/
public static final MetadataVersion LATEST_PRODUCTION = IBP_3_7_IV4;
public static final MetadataVersion LATEST_PRODUCTION = IBP_3_8_IV0;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 3.8_IV0 is no longer controlling ELR. We need to change the following comment according to https://github.com/apache/kafka/pull/16347/files#diff-abe728e9704c4c6709c4c3f6fd3908d51219cda55791ac7f103e6042c1d6c298.
    // Add ELR related supports (KIP-966).
    IBP_3_8_IV0(20, "3.8", "IV0", true),

Also, quite a few tests (e.g. PartitionChangeBuilderTest.java) still reference 3.8_IV0 with the assumption that it's associated with ELR. @cmccabe: Should we bring IBP_3_9_IV0, the new MV associated with ELR to the 3.8 branch or change all those tests related to ELR?

  1. There are a few tests referring to IBP_3_7_IV4, the previous latest production version. They all need to be changed to the new latest production version IBP_3_8_IV0.

ApiVersionsRequestTest.scala

FeatureCommandTest.java

  1. We need to add a comment above the following line that 3.8.0 is the latest production version in 3.8 line.

https://github.com/apache/kafka/blob/3.8/server-common/src/test/java/org/apache/kafka/server/common/MetadataVersionTest.java#L187

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied feedback, except for "Should we bring IBP_3_9_IV0, the new MV associated with ELR to the 3.8 branch or change all those tests related to ELR?". I'm waiting for @cmccabe's feedback on this one.

Comment on lines +26 to +27
// TEST_2 released right before MV 4.0-IV0 was released, and it depends on this metadata version
TEST_2(2, MetadataVersion.IBP_4_0_IV0, Collections.singletonMap(MetadataVersion.FEATURE_NAME, MetadataVersion.IBP_4_0_IV0.featureLevel()));
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jolshan I need help understanding this test setup. As far as I could understand, this TEST_2 feature was meant to be released in a future release, given we 3.8 is the current one, I moved it to 4.0. But I think this is not a robust test. Probably I'm missing something else.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I plan to update this in a future PR. Sorry it is not easy to understand now. If you can push it to 4.0, that would be good for now.

// Change expected message to reflect latest MetadataVersion (SupportedMaxVersion increases when adding a new version)
assertEquals("Feature: metadata.version\tSupportedMinVersion: 3.0-IV1\t" +
"SupportedMaxVersion: 4.0-IV0\tFinalizedVersionLevel: 3.7-IV4\t", outputWithoutEpoch(features.get(1)));
"SupportedMaxVersion: 4.0-IV0\tFinalizedVersionLevel: 3.8-IV0\t", outputWithoutEpoch(features.get(1)));
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needed to change as well as we changed the parameter of the test to 3.8-IV0

@jlprat jlprat added the Blocker This pull request is identified as solving a blocker for a release. label Jun 24, 2024
@jlprat
Copy link
Copy Markdown
Contributor Author

jlprat commented Jun 26, 2024

Build failed with an exception on "streams:upgrade-system-tests-34:test". Rerunning the build

@junrao
Copy link
Copy Markdown
Contributor

junrao commented Jun 28, 2024

@jlprat : The PR now has conflicts after #16478. Could you rebase? Thanks.

@jlprat jlprat force-pushed the MINOR-revert-KAFKA-16154 branch from 0058068 to 87d0761 Compare June 30, 2024 15:39
@jlprat
Copy link
Copy Markdown
Contributor Author

jlprat commented Jun 30, 2024

@junrao Rebased
@jolshan I would highly appreciate your review for "marking IBP_3_8_V0 as latest production". There are couple of changes I needed to do to make the tests pass.

@jlprat
Copy link
Copy Markdown
Contributor Author

jlprat commented Jul 1, 2024

Something seems wrong after rebasing. Build hangs and the job gets terminated.
Apparently ReplicationQuotasTest > shouldBootstrapTwoBrokersWithLeaderThrottle(String) > "shouldBootstrapTwoBrokersWithLeaderThrottle(String).quorum=kraft" never terminates.

Copy link
Copy Markdown
Contributor

@junrao junrao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jlprat : Thanks for the updated PR. Left a comment.

// Please move this comment when updating the LATEST_PRODUCTION constant.
//

// Introduce version 1 of the GroupVersion feature (KIP-848).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, we removed GroupVersion in 3.8 #16478. Why are we adding it back? The hanging ReplicationQuotasTest is related to this since registerBroker() needs to set MaxSupportedVersion to the latest MV, which is 4.0 now. See a similar change in trunk https://github.com/apache/kafka/pull/16347/files#diff-4f8200cb972ea4c0d08bcfc45e9e4e6295c37a4414b9acd59cc4bb248bc25a1c

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good pointer, I think this might be the problem. This was probably a wrong conflict resolution during rebasing.
Why this existed and was used in this PR is because due to the test setup for FeaturesTest.
TEST_2 needs to be configured to 4.0 like this https://github.com/apache/kafka/pull/16400/files#diff-10fd2b01213aa0cc1f879b06eb7eaae357e3dbcf8a270660b0eb4fcc78e7a5a1R27
Otherwise these tests fail:

:server-common:test > Gradle Test Executor 4 > FeaturesTest > testDefaultTestVersion(MetadataVersion) > "testDefaultTestVersion(MetadataVersion).metadataVersion=3.8-IV0" FAILED
    org.opentest4j.AssertionFailedError: expected: <1> but was: <2>
        at app//org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
        at app//org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
        at app//org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
        at app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:134)
        at app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:129)
        at app//org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:329)
        at app//org.apache.kafka.server.common.FeaturesTest.testDefaultTestVersion(FeaturesTest.java:120)
Gradle Test Run :server-common:test > Gradle Test Executor 4 > FeaturesTest > testUnstableTestVersion() FAILED
    org.opentest4j.AssertionFailedError: Expected java.lang.IllegalArgumentException to be thrown, but nothing was thrown.
        at app//org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:152)
        at app//org.junit.jupiter.api.AssertThrows.assertThrows(AssertThrows.java:73)
        at app//org.junit.jupiter.api.AssertThrows.assertThrows(AssertThrows.java:35)
        at app//org.junit.jupiter.api.Assertions.assertThrows(Assertions.java:3115)
        at app//org.apache.kafka.server.common.FeaturesTest.testUnstableTestVersion(FeaturesTest.java:125)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll remove it, and try to find out how to fix the tests that seem to expect MV 3.8-IV0 to not be the production one.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if you need an unstable version, you can just use 4.0 (or 3.9)

Copy link
Copy Markdown
Contributor Author

@jlprat jlprat Jul 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jolshan Isn't this what is being done in this PR? So if I add the 4.0, the other tests work, but then ReplicationQuotasTest hangs.
This area is not one that I'm really familiar with.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. I'm not sure I follow how the tests are related. I can pull your branch if that helps.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jolshan https://github.com/apache/kafka/pull/16400/files#diff-10fd2b01213aa0cc1f879b06eb7eaae357e3dbcf8a270660b0eb4fcc78e7a5a1R27 needs to be configured as 4.0 (or 3.9 for that matter) so the FeaturesTest works. But if I add 4.0 in MetadaVersion then ReplicationQuotasTest.shouldBootstrapTwoBrokersWithLeaderThrottle hangs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I found a way. I'll push shortly

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's ok to introduce an unstable 4.0 MV for the TestFeature. We just need to (1) make sure the comment associated with the new MV is correct; (2) change all tests that depend on the latest testing MV. In #16347, we tried to change all relevant tests to use MetadataVersion.latestTesting() so that we don't have to manually change the MV when new unstable MV is added in the future. You can search for all tests that have changed from MetadataVersion.IBP_4_0_IV0 to MetadataVersion.latestTesting() in #16347 and apply them here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did this now for all the changes I belive

@junrao
Copy link
Copy Markdown
Contributor

junrao commented Jul 1, 2024

Since this PR also marks MV 3.8-IV0 as the latest production, it would be useful to update the description of the PR accordingly.

@jlprat jlprat changed the title Revert "KAFKA-16154: Broker returns offset for LATEST_TIERED_TIMESTAM… Revert "KAFKA-16154" and mark MV 3.8-IV0 as the latest production Jul 1, 2024
Comment thread server-common/src/main/java/org/apache/kafka/server/common/MetadataVersion.java Outdated
.setName(MetadataVersion.FEATURE_NAME)
.setMinSupportedVersion(MetadataVersion.IBP_3_0_IV1.featureLevel())
.setMaxSupportedVersion(MetadataVersion.IBP_3_8_IV0.featureLevel()))
.setMaxSupportedVersion(MetadataVersion.latestTesting().featureLevel()))
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes the test pass as it disregards the latest version as per #16347

controlEnv.activeController().registerBroker(ANONYMOUS_CONTEXT,
new BrokerRegistrationRequestData().
setFeatures(brokerFeatures(MetadataVersion.IBP_3_0_IV1, MetadataVersion.IBP_4_0_IV0)).
setFeatures(brokerFeatures(MetadataVersion.IBP_3_0_IV1, MetadataVersion.latestTesting())).
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per #16347


// Introduce version 1 of the GroupVersion feature (KIP-848).
IBP_4_0_IV0(21, "4.0", "IV0", false);
IBP_3_9_IV0(21, "3.9", "IV0", false);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taking changes from #16347

Copy link
Copy Markdown
Contributor

@junrao junrao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jlprat : Thanks for the updated PR. Left one more comment.

// If users attempt to use an unstable MetadataVersion, they will get an error.
// Please move this comment when updating the LATEST_PRODUCTION constant.
//
IBP_3_9_IV0(21, "3.9", "IV0", false);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. The following comment needs to be moved to IBP_3_9_IV0.

// Add ELR related supports (KIP-966).

  1. We need to change isElrSupported() to use IBP_3_9_IV0.
  2. We need to bring all tests referencing IBP_3_9_IV1 for ELR in KAFKA-16968: Make 3.8-IV0 a stable MetadataVersion and create 3.9-IV0 #16347 here.
  3. We need to bring in the changes in the following tests in KAFKA-16968: Make 3.8-IV0 a stable MetadataVersion and create 3.9-IV0 #16347 for testing latestTesting MV.
    ClusterTestExtensionsTest.java
    ZkMigrationIntegrationTest.scala
    ApiVersionsRequestTest.scala
  4. We need to add IBP_3_9_IV0 to all tests in MetadataVersionTest.java where 4.0-IV0 is used in trunk.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @junrao
Would we need to add IBP_3_9_IV1 as well? Or just use the tests for IBP_3_9_IV1 using the IBP_3_9_IV0 enum value?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just use the IBP_3_9_IV0 enum value for tests using IBP_3_9_IV1 in trunk since BP_3_9_IV0 is associated with ELR in 3.8.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I brought all necessary changes now

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ELR changed metadata records.


@ClusterTemplate("testApiVersionsRequestIncludesUnreleasedApisTemplate")
@ClusterTest(types = Array(Type.KRAFT, Type.CO_KRAFT), serverProperties = Array(
@ClusterTest(types = Array(Type.KRAFT, Type.CO_KRAFT), metadataVersion = MetadataVersion.IBP_3_9_IV0, serverProperties = Array(
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ClusterTest in trunk has IBP_3_9_IV0 as default value instead of IBP_3_8_IV0. This took me a while to detect as I didn't understand why this test was failing.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, ClusterTest.metadataVersion() should default to latest testing MV, which is IBP_3_9_IV0. Could we change that and remove setting metadataVersion in this test and the one above?

Copy link
Copy Markdown
Member

@jolshan jolshan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm as long as the tests look good.

Copy link
Copy Markdown
Contributor

@junrao junrao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jlprat : Thanks for the updated PR. A few more comments.

// If users attempt to use an unstable MetadataVersion, they will get an error.
// Please move this comment when updating the LATEST_PRODUCTION constant.
//
IBP_3_9_IV0(21, "3.9", "IV0", false);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ELR changed metadata records.

setClusterId(active.clusterId()).
setIncarnationId(Uuid.fromString("kxAT73dKQsitIedpiPtwBA")).
setFeatures(brokerFeatures(MetadataVersion.IBP_3_0_IV1, MetadataVersion.IBP_3_8_IV0)).
setFeatures(brokerFeatures(MetadataVersion.IBP_3_0_IV1, MetadataVersion.latestTesting())).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testUncleanShutdownBroker() is based on ELR. So we need to change the 4 instances of IBP_3_8_IV0 in it to IBP_3_9_IV0. See #16347

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, this test was failing. I missed this change.


@ClusterTemplate("testApiVersionsRequestIncludesUnreleasedApisTemplate")
@ClusterTest(types = Array(Type.KRAFT, Type.CO_KRAFT), serverProperties = Array(
@ClusterTest(types = Array(Type.KRAFT, Type.CO_KRAFT), metadataVersion = MetadataVersion.IBP_3_9_IV0, serverProperties = Array(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, ClusterTest.metadataVersion() should default to latest testing MV, which is IBP_3_9_IV0. Could we change that and remove setting metadataVersion in this test and the one above?

@cmccabe
Copy link
Copy Markdown
Contributor

cmccabe commented Jul 1, 2024

To respond to some of the questions above, overall,

  • 3.8-IV0 in the 3.8 branch needs to be correct and completely in line with trunk

  • 3.9-IV0 and 3.9-IV1 in the 3.8 branch can be whatever (it doesn't matter, since they are not usable / stable in 3.8)

  • As you've probably noticed, the tests which use @ClusterTest often need to be manually updated when the latest MV changes. I do think this is a problem (with @ClusterTest). I don't have any quick solution right now other than doing the edits. This isn't an issue with the tests using TestKit directly, since they can just set MetadataVersion.latestTesting. Maybe we need to rethink the @ClusterTest stuff.

Let me know if you need me specifically to review

@jlprat
Copy link
Copy Markdown
Contributor Author

jlprat commented Jul 2, 2024

Thanks for the review @junrao. Feedback is now applied

@jlprat
Copy link
Copy Markdown
Contributor Author

jlprat commented Jul 2, 2024

Failing tests shouldn't be related to the changes (all tests passed locally)

Copy link
Copy Markdown
Contributor

@junrao junrao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jlprat : Thanks for the updated PR. LGTM

Copy link
Copy Markdown
Member

@jolshan jolshan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reapproving with the latest changes! Thanks Josep.

setClusterId(active.clusterId()).
setIncarnationId(Uuid.fromString("kxAT73dKQsitIedpiPtwBA")).
setFeatures(brokerFeatures(MetadataVersion.IBP_3_0_IV1, MetadataVersion.IBP_3_8_IV0)).
setFeatures(brokerFeatures(MetadataVersion.IBP_3_0_IV1, MetadataVersion.IBP_3_9_IV0)).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that ideally, we should use MetadataVersion.latestTesting() here. However, explicitly using IBP_3_9_IV0 works too since it's the latest MV.

@jlprat jlprat merged commit b20a735 into apache:3.8 Jul 2, 2024
@jlprat jlprat deleted the MINOR-revert-KAFKA-16154 branch July 2, 2024 17:22
@jlprat
Copy link
Copy Markdown
Contributor Author

jlprat commented Jul 2, 2024

Merged! Thanks for the reviews!

soarez added a commit to soarez/kafka that referenced this pull request Jul 5, 2024
LATEST_PRODUCTION version in MetadataVersion.java was updated in
both apache#16347 and apache#16400, but it was left unchanged in the system
tests.
soarez added a commit that referenced this pull request Jul 5, 2024
…16533)

LATEST_PRODUCTION version in MetadataVersion.java was updated in
both #16347 and #16400, but it was left unchanged in the system
tests.

Reviewers: Josep Prat <josep.prat@aiven.io>
soarez added a commit that referenced this pull request Jul 5, 2024
…16533)

LATEST_PRODUCTION version in MetadataVersion.java was updated in
both #16347 and #16400, but it was left unchanged in the system
tests.

Reviewers: Josep Prat <josep.prat@aiven.io>
abhi-ksolves pushed a commit to ksolves/kafka that referenced this pull request Jul 31, 2024
…pache#16533)

LATEST_PRODUCTION version in MetadataVersion.java was updated in
both apache#16347 and apache#16400, but it was left unchanged in the system
tests.

Reviewers: Josep Prat <josep.prat@aiven.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Blocker This pull request is identified as solving a blocker for a release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants