Skip to content

KAFKA-9950: Construct new ConfigDef for MirrorTaskConfig before defining new properties#8608

Merged
kkonstantine merged 2 commits intoapache:trunkfrom
C0urante:kafka-9950
May 21, 2020
Merged

KAFKA-9950: Construct new ConfigDef for MirrorTaskConfig before defining new properties#8608
kkonstantine merged 2 commits intoapache:trunkfrom
C0urante:kafka-9950

Conversation

@C0urante
Copy link
Copy Markdown
Contributor

@C0urante C0urante commented May 4, 2020

Jira

MM2 is currently sharing the same ConfigDef object for all its connectors and tasks, which would be fine if that object were used as-is. However, the MirrorTaskConfig class mutates the ConfigDef by defining additional properties, which leads to a potential ConcurrentModificationException during worker configuration validation and unintended inclusion of those new properties in the ConfigDef for the connectors which in turn is then visible via the REST API's /connectors/{name}/config/validate endpoint.

The fix here is a one-liner that just creates a copy of the ConfigDef before defining new properties.

A unit test is added that fails without this fix and passes with it.

Committer Checklist (excluded from commit message)

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

@C0urante
Copy link
Copy Markdown
Contributor Author

C0urante commented May 4, 2020

@ryannedolan based on your experience MM2, would you be willing to take a look at this?

Copy link
Copy Markdown
Contributor

@ryannedolan ryannedolan left a comment

Choose a reason for hiding this comment

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

looks great, thanks!

@C0urante
Copy link
Copy Markdown
Contributor Author

C0urante commented May 4, 2020

Thanks Ryanne!

@rhauch, @kkonstantine could one of you take a look at this when you have a chance?

@kkonstantine
Copy link
Copy Markdown
Contributor

ok to test

@kkonstantine
Copy link
Copy Markdown
Contributor

jdk8: single failure on known flaky test: org.apache.kafka.streams.integration.EosBetaUpgradeIntegrationTest.shouldUpgradeFromEosAlphaToEosBeta[true]
jdk11: single failure on known flaky test: org.apache.kafka.streams.integration.EosBetaUpgradeIntegrationTest.shouldUpgradeFromEosAlphaToEosBeta[false]
jdk14: success

Copy link
Copy Markdown
Contributor

@kkonstantine kkonstantine left a comment

Choose a reason for hiding this comment

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

LGTM

Yet, to be precise, the new unit test does not reproduce the original issue. It just adds a safeguard around the fix.

@kkonstantine kkonstantine merged commit ab4b4d7 into apache:trunk May 21, 2020
kkonstantine pushed a commit that referenced this pull request May 21, 2020
…ing new properties (#8608)

`MirrorTaskConfig` class mutates the `ConfigDef` by defining additional properties, which leads to a potential `ConcurrentModificationException` during worker configuration validation and unintended inclusion of those new properties in the `ConfigDef` for the connectors which in turn is then visible via the REST API's `/connectors/{name}/config/validate` endpoint.

The fix here is a one-liner that just creates a copy of the `ConfigDef` before defining new properties.

Reviewers: Ryanne Dolan <ryannedolan@gmail.com>, Konstantine Karantasis <konstantine@confluent.io>
kkonstantine pushed a commit that referenced this pull request May 21, 2020
…ing new properties (#8608)

`MirrorTaskConfig` class mutates the `ConfigDef` by defining additional properties, which leads to a potential `ConcurrentModificationException` during worker configuration validation and unintended inclusion of those new properties in the `ConfigDef` for the connectors which in turn is then visible via the REST API's `/connectors/{name}/config/validate` endpoint.

The fix here is a one-liner that just creates a copy of the `ConfigDef` before defining new properties.

Reviewers: Ryanne Dolan <ryannedolan@gmail.com>, Konstantine Karantasis <konstantine@confluent.io>
Kvicii pushed a commit to Kvicii/kafka that referenced this pull request May 22, 2020
* 'trunk' of github.com:apache/kafka:
  KAFKA-9980: Fix bug where alterClientQuotas could not set default client quotas (apache#8658)
  KAFKA-9780: Deprecate commit records without record metadata (apache#8379)
  MINOR: Deploy VerifiableClient in constructor to avoid test timeouts (apache#8651)
  MINOR: Added unit tests for ConnectionQuotas (apache#8650)
  MINOR: Correct MirrorMaker2 integration test configs for Connect internal topics (apache#8653)
  KAFKA-9855 - return cached Structs for Schemas with no fields (apache#8472)
  KAFKA-9950: Construct new ConfigDef for MirrorTaskConfig before defining new properties (apache#8608)
  KAFKA-8869: Remove task configs for deleted connectors from config snapshot (apache#8444)
  KAFKA-9409: Supplement immutability of ClusterConfigState class in Connect (apache#7942)
@C0urante C0urante deleted the kafka-9950 branch February 27, 2022 03:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants