Skip to content

MINOR: Avoid using strings directly for the auto.offset.reset configuration of ConsumerConfig#12077

Merged
showuon merged 47 commits into
apache:trunkfrom
RivenSun2:minor-OffsetResetStrategy
Apr 24, 2022
Merged

MINOR: Avoid using strings directly for the auto.offset.reset configuration of ConsumerConfig#12077
showuon merged 47 commits into
apache:trunkfrom
RivenSun2:minor-OffsetResetStrategy

Conversation

@RivenSun2

Copy link
Copy Markdown
Contributor

Avoid using strings directly for the auto.offset.reset configuration of ConsumerConfig

Committer Checklist (excluded from commit message)

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

RivenSun2 and others added 30 commits September 19, 2021 17:59
… cpu and traffic on the broker side increase sharply

JIRA link : https://issues.apache.org/jira/browse/KAFKA-13310

Author: RivenSun2 <riven.sun@zoom.us>

Reviewers: Luke Chen <showuon@gmail.com>
…sets method

JIRA link : https://issues.apache.org/jira/browse/KAFKA-13310

Author: RivenSun2 <riven.sun@zoom.us>

Reviewers: Luke Chen <showuon@gmail.com>
2. Optimize the import of package

Author: RivenSun2 <riven.sun@zoom.us>

Reviewers: Luke Chen <showuon@gmail.com>
Author: RivenSun2 <riven.sun@zoom.us>

Reviewers: Luke Chen <showuon@gmail.com>
Author: RivenSun2 <riven.sun@zoom.us>

Reviewers: Luke Chen <showuon@gmail.com>
Author: RivenSun2 <riven.sun@zoom.us>

Reviewers: Luke Chen <showuon@gmail.com>
Author: RivenSun2 <riven.sun@zoom.us>

Reviewers: Luke Chen <showuon@gmail.com>
add test Method "testForceMetadataDeleteForPatternSubscriptionDuringRebalance()"

Author: RivenSun2 <riven.sun@zoom.us>

Reviewers: Luke Chen <showuon@gmail.com>
Author: RivenSun2 <riven.sun@zoom.us>

Reviewers: Luke Chen <showuon@gmail.com>
Author: RivenSun2 riven.sun@zoom.us
� Conflicts:
�	clients/src/test/java/org/apache/kafka/clients/consumer/KafkaConsumerTest.java
@RivenSun2

Copy link
Copy Markdown
Contributor Author

Hi @showuon
Could you help to review this PR?
Thanks.

@RivenSun2

Copy link
Copy Markdown
Contributor Author

Hi @showuon @guozhangwang
Could you help to review this PR?
Thanks.

@RivenSun2

Copy link
Copy Markdown
Contributor Author

Hi @showuon @guozhangwang
could you help to review this PR?
Thanks.


@Override
public String toString() {
return super.toString().toLowerCase(Locale.ROOT);

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 am wondering if this could have an impact when using non-english locale, e.g. there may be places in the code which perform a comparison of the enum with string "latest" but in a different locale this comparison may fail.

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.

Quoting the comment above Locale.ROOT

This is regarded as the base locale of all locales, and is used as the language/country neutral locale for the locale sensitive operations.

I think this is better than if we use toLowerCase(Locale.ENGLISH)

At the same time, the same method is used for isolation.level in ConsumerConfig.

                                .define(ISOLATION_LEVEL_CONFIG,
                                        Type.STRING,
                                        DEFAULT_ISOLATION_LEVEL,
                                        in(IsolationLevel.READ_COMMITTED.toString().toLowerCase(Locale.ROOT), IsolationLevel.READ_UNCOMMITTED.toString().toLowerCase(Locale.ROOT)),
                                        Importance.MEDIUM,
                                        ISOLATION_LEVEL_DOC)

@showuon showuon left a comment

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.

LGTM! Thanks.

Failed tests:

    Build / JDK 17 and Scala 2.13 / kafka.admin.LeaderElectionCommandTest.[1] Type=Raft, Name=testElectionResultOutput, Security=PLAINTEXT
    Build / JDK 17 and Scala 2.13 / kafka.admin.TopicCommandIntegrationTest.testDescribeUnderMinIsrPartitionsMixed(String).quorum=zk
    Build / JDK 11 and Scala 2.13 / org.apache.kafka.connect.mirror.integration.MirrorConnectorsIntegrationSSLTest.testReplication()
    Build / JDK 11 and Scala 2.13 / org.apache.kafka.connect.mirror.integration.MirrorConnectorsIntegrationTest.testOneWayReplicationWithAutoOffsetSync()
    Build / JDK 11 and Scala 2.13 / org.apache.kafka.connect.integration.BlockingConnectorTest.testWorkerRestartWithBlockInConnectorStart
    Build / JDK 11 and Scala 2.13 / org.apache.kafka.connect.integration.BlockingConnectorTest.testBlockInSourceTaskStop
    Build / JDK 11 and Scala 2.13 / org.apache.kafka.connect.integration.ConnectWorkerIntegrationTest.testTaskStatuses
    Build / JDK 8 and Scala 2.12 / org.apache.kafka.connect.mirror.integration.MirrorConnectorsIntegrationTest.testReplicationWithEmptyPartition()
    Build / JDK 8 and Scala 2.12 / kafka.api.PlaintextConsumerTest.testCoordinatorFailover()
    Build / JDK 8 and Scala 2.12 / kafka.server.KRaftClusterTest.testSetLog4jConfigurations()
    Build / JDK 8 and Scala 2.12 / kafka.server.KRaftClusterTest.testLegacyAlterConfigs()
    Build / JDK 8 and Scala 2.12 / kafka.server.KRaftClusterTest.testCreateClusterAndPerformReassignment()

Triggering another build to make sure they are flaky: https://ci-builds.apache.org/job/Kafka/job/kafka-pr/job/PR-12077/2/

@RivenSun2

Copy link
Copy Markdown
Contributor Author

@showuon testCase shoud be ok now.
Thanks.

@showuon

showuon commented Apr 24, 2022

Copy link
Copy Markdown
Member

Failed tests are not related:

    Build / JDK 8 and Scala 2.12 / kafka.server.KRaftClusterTest.testIncrementalAlterConfigs()
    Build / JDK 8 and Scala 2.12 / kafka.server.KRaftClusterTest.testSetLog4jConfigurations()
    Build / JDK 8 and Scala 2.12 / kafka.server.KRaftClusterTest.testLegacyAlterConfigs()
    Build / JDK 8 and Scala 2.12 / kafka.server.KRaftClusterTest.testCreateClusterAndPerformReassignment()
    Build / JDK 8 and Scala 2.12 / org.apache.kafka.streams.integration.FineGrainedAutoResetIntegrationTest.shouldThrowStreamsExceptionNoResetSpecified

@showuon showuon merged commit 2b64f1a into apache:trunk Apr 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants