Skip to content

KAFKA-9329. KafkaController::replicasAreValid should return error#7865

Merged
hachikuji merged 6 commits intoapache:trunkfrom
soondenana:KAFKA-9329
Jan 17, 2020
Merged

KAFKA-9329. KafkaController::replicasAreValid should return error#7865
hachikuji merged 6 commits intoapache:trunkfrom
soondenana:KAFKA-9329

Conversation

@soondenana
Copy link
Copy Markdown
Contributor

The KafkaController::replicasAreValid method currently returns a
boolean indicating if replicas are valid or not. But the failure
condition loses any context on why replicas are not valid. This change
updates the metod to return the error conition if validation fails. This
allows caller to report the error to the client.

The change also renames the replicasAreValid method to
validateReplicas to reflect updated semantics.

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)

@soondenana
Copy link
Copy Markdown
Contributor Author

retest this please

@soondenana
Copy link
Copy Markdown
Contributor Author

retest this please

@soondenana
Copy link
Copy Markdown
Contributor Author

retest this please

3 similar comments
@soondenana
Copy link
Copy Markdown
Contributor Author

retest this please

@soondenana
Copy link
Copy Markdown
Contributor Author

retest this please

@hachikuji
Copy link
Copy Markdown
Contributor

retest this please

@soondenana
Copy link
Copy Markdown
Contributor Author

2.13 build failed with OOM:

20:38:10 [0.036s][warning][os,thread] Failed to start thread - pthread_create failed (EAGAIN) for attributes: stacksize: 1024k, guardsize: 0k, detached.
20:38:10 Error occurred during initialization of VM
20:38:10 java.lang.OutOfMemoryError: unable to create native thread: possibly out of memory or process/resource limits reached

2.12 has two unit test failure:

kafka.api.GroupEndToEndAuthorizationTest.testNoConsumeWithoutDescribeAclViaSubscribe
kafka.api.PlaintextAdminIntegrationTest.testInvalidAlterPartitionReassignments

They pass locally. I will trigger tests again to see if 2.13 can make progress

@soondenana
Copy link
Copy Markdown
Contributor Author

retest this please

Comment thread core/src/main/scala/kafka/controller/KafkaController.scala Outdated
Comment thread core/src/main/scala/kafka/controller/KafkaController.scala Outdated
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.

Seems like a basic reassignment test case. Do you think it is not covered in ReassignPartitionsClusterTest? It's not too clear to me why we have two separate test cases.

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.

It is covered. That code uses zkClient and ReassignPartitionsCommand. This test code uses AdminClient directly. Both of them test same backend code, so maybe its ok to get rid of this as when ReassignPartitionsCommand is fixed as part of KIP-500 we will have duplicate test.

Let me know what you prefer and I will take this test out.

@hachikuji
Copy link
Copy Markdown
Contributor

retest this please

@soondenana
Copy link
Copy Markdown
Contributor Author

2.13 build had issues when running kafka.admin.AclCommandTest and hung. It was killed:

22:15:53 Build timed out (after 270 minutes). Marking the build as aborted.

2.12 build had one test failure: PlaintextAdminIntegrationTest.testInvalidAlterPartitionReassignments. Pushed a fix for that.

@hachikuji
Copy link
Copy Markdown
Contributor

retest this please

@hachikuji
Copy link
Copy Markdown
Contributor

ok to test

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.

I think we can remove this and just say there were duplicates in the replica list. Then we can remove the spotbugs warning.

@hachikuji
Copy link
Copy Markdown
Contributor

Just a minor comment. Otherwise, looks good.

The `KafkaController::replicasAreValid` method currently returns a
boolean indicating if replicas are valid or not. But the failure
condition loses any context on why replicas are not valid. This change
updates the metod to return the error conition if validation fails. This
allows caller to report the error to the client.

The change also renames the `replicasAreValid` method to
`validateReplicas` to reflect updated semantics.
The change fixes the error when using map on `scala.collections.Seq` as
2.13 has following change:

> In Scala 2.13 scala.Seq[+A] is an alias for
> scala.collection.immutable.Seq[A], instead of scala.collection.Seq[A]

Fixed code to specify correct collection type as implicit infrence was
creating incorrect collection and failing compilation.

The build still fails with coverage tool failing on deprecation
warnings.
Couple of tests were duplicating code to create list of bootstrap
servers. There is already a method in TestUtils to do the same, updated
the tests to use that (TestUtils.bootstrapServers)
…assignments

One failure case wasn't handled correctly in
KafkaController::validateReplicas method. Updated code to check the
boolean return condition and generate proper error message.
@soondenana
Copy link
Copy Markdown
Contributor Author

ok to test

@soondenana
Copy link
Copy Markdown
Contributor Author

retest this please

1 similar comment
@hachikuji
Copy link
Copy Markdown
Contributor

retest this please

@hachikuji
Copy link
Copy Markdown
Contributor

ok to test

@hachikuji
Copy link
Copy Markdown
Contributor

retest this please

Copy link
Copy Markdown
Contributor

@hachikuji hachikuji left a comment

Choose a reason for hiding this comment

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

LGTM

@hachikuji hachikuji merged commit 9b312c4 into apache:trunk Jan 17, 2020
ijuma added a commit to confluentinc/kafka that referenced this pull request Jan 21, 2020
Conflicts or compilation errors due to the fact that we temporarily
reverted the commit that removes Scala 2.11 support:

* AclCommand.scala: take upstream changes.
* AclCommandTest.scala: take upstream changes.
* TransactionCoordinatorTest.scala: don't use SAMs, but adjust
mock call to putTransactionStateIfNotExists given new signature.
* TransactionStateManagerTest: use Runnable instead of SAMs.
* PartitionLockTest: use Runnable instead of SAMs.
* docs/upgrade.html: take upstream changes excluding line that
states that Scala 2.11 support has been removed.

* apache-github/trunk: (28 commits)
  KAFKA-9457; Fix flaky test org.apache.kafka.common.network.SelectorTest.testGracefulClose (apache#7989)
  MINOR: Update AclCommand help message to match implementation (apache#7990)
  MINOR: Update introduction page in Kafka documentation
  MINOR: Use Math.min for StreamsPartitionAssignor#updateMinReceivedVersion method (apache#7954)
  KAFKA-9338; Fetch session should cache request leader epoch (apache#7970)
  KAFKA-9329; KafkaController::replicasAreValid should return error message (apache#7865)
  KAFKA-9449; Adds support for closing the producer's BufferPool. (apache#7967)
  MINOR: Handle expandIsr in PartitionLockTest and ensure read threads not blocked on write (apache#7973)
  MINOR: Fix typo in connect integration test class name (apache#7976)
  KAFKA-9218: MirrorMaker 2 can fail to create topics (apache#7745)
  KAFKA-8847; Deprecate and remove usage of supporting classes in kafka.security.auth (apache#7966)
  MINOR: Suppress DescribeConfigs Denied log during CreateTopics (apache#7971)
  [MINOR]: Fix typo in Fetcher comment (apache#7934)
  MINOR: Remove unnecessary call to `super` in `MetricConfig` constructor (apache#7975)
  MINOR: fix flaky StreamsUpgradeTestIntegrationTest (apache#7974)
  KAFKA-9431: Expose API in KafkaStreams to fetch all local offset lags (apache#7961)
  KAFKA-9235; Ensure transaction coordinator is stopped after replica deletion (apache#7963)
  KAFKA-9410; Make groupId Optional in KafkaConsumer (apache#7943)
  MINOR: Removed accidental double negation in error message. (apache#7834)
  KAFKA-6144: IQ option to query standbys (apache#7962)
  ...
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