Skip to content

MINOR: Cleanup handling of mixed transactional/idempotent records#6172

Merged
hachikuji merged 2 commits intoapache:trunkfrom
hachikuji:minor-transactional-request-cleanup
Jan 22, 2019
Merged

MINOR: Cleanup handling of mixed transactional/idempotent records#6172
hachikuji merged 2 commits intoapache:trunkfrom
hachikuji:minor-transactional-request-cleanup

Conversation

@hachikuji
Copy link
Copy Markdown
Contributor

Committer Checklist (excluded from commit message)

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


@Test
public void testMixedTransactionalData() {
long producerId = 15L;
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.

can we make some / all of these final ?

@cmccabe
Copy link
Copy Markdown
Contributor

cmccabe commented Jan 19, 2019

Thanks, @hachikuji . I left a comment.

LGTM

@hachikuji
Copy link
Copy Markdown
Contributor Author

@cmccabe Pushed a commit. I will merge after the build completes. Thanks for reviewing!

if (produceRequest.isTransactional) {
if (!authorize(request.session, Write, Resource(TransactionalId, produceRequest.transactionalId, LITERAL))) {
if (produceRequest.hasTransactionalRecords) {
val isAuthorizedTransactional = produceRequest.transactionalId != null &&
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.

What's the intended behaviour if transactionalId == null && produceRequest.hasTransactionalRecords?

Copy link
Copy Markdown
Contributor Author

@hachikuji hachikuji Jan 20, 2019

Choose a reason for hiding this comment

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

Returning TRANSACTIONAL_ID_AUTHORIZATION_FAILED seemed like the best bet. INVALID_REQUEST might be another option. Currently, without this check, the authorizer raises an NPE which causes the connection to terminate. We could push the null checks into the authorizor as well.

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.

Makes sense. I guess one can say that the null transaction id is never authorized.

Copy link
Copy Markdown
Contributor

@rajinisivaram rajinisivaram left a comment

Choose a reason for hiding this comment

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

@hachikuji Thanks for the PR, LGTM

@hachikuji hachikuji merged commit 523465b into apache:trunk Jan 22, 2019
hachikuji added a commit that referenced this pull request Jan 22, 2019
)

Reviewers: Rajini Sivaram <rajinisivaram@googlemail.com>, Ismael Juma <ismael@juma.me.uk>, Colin Patrick McCabe <colin@cmccabe.xyz>
hachikuji added a commit that referenced this pull request Jan 22, 2019
)

Reviewers: Rajini Sivaram <rajinisivaram@googlemail.com>, Ismael Juma <ismael@juma.me.uk>, Colin Patrick McCabe <colin@cmccabe.xyz>
hachikuji added a commit that referenced this pull request Jan 22, 2019
)

Reviewers: Rajini Sivaram <rajinisivaram@googlemail.com>, Ismael Juma <ismael@juma.me.uk>, Colin Patrick McCabe <colin@cmccabe.xyz>
hachikuji added a commit that referenced this pull request Jan 22, 2019
)

Reviewers: Rajini Sivaram <rajinisivaram@googlemail.com>, Ismael Juma <ismael@juma.me.uk>, Colin Patrick McCabe <colin@cmccabe.xyz>
hachikuji added a commit that referenced this pull request Jan 22, 2019
)

Reviewers: Rajini Sivaram <rajinisivaram@googlemail.com>, Ismael Juma <ismael@juma.me.uk>, Colin Patrick McCabe <colin@cmccabe.xyz>
abbccdda pushed a commit to abbccdda/kafka that referenced this pull request Jan 24, 2019
…ache#6172)

Reviewers: Rajini Sivaram <rajinisivaram@googlemail.com>, Ismael Juma <ismael@juma.me.uk>, Colin Patrick McCabe <colin@cmccabe.xyz>
return transactionalId;
}

public boolean isTransactional() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

fwiw, the renamed methods are a breaking change of public API and shouldn't have been merged into master as is, I think. Why not just @deprecate them? Asking, because this has caused me some headache today :(

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.

The request classes are not public API. Only the classes shown in the javadoc are considered public:
https://kafka.apache.org/21/javadoc/overview-summary.html

Out of curiosity, how are you using this internal classes?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for getting back to me. We're using Alpakka Kafka and I wanted to test the client-version 2.1.1 talking with server 2.0.1.

For testing purposes we're spinning up an embedded Kafka, which comes from a transitive dependency that akka-stream-kafka-testkit provides. These APIs are used somewhere in there, so it's not even code that I control.

I wasn't aware that this is considered "private public" API and was a bit worried about the "unnoticed" breaking changes to the API. Thanks for the explanation

jarekr pushed a commit to confluentinc/kafka that referenced this pull request Apr 18, 2019
* ak/trunk:
  MINOR: fix race condition in KafkaStreamsTest (apache#6185)
  KAFKA-4850: Enable bloomfilters (apache#6012)
  MINOR: ducker-ak: add down -f, avoid using a terminal in ducker test
  KAFKA-5117: Stop resolving externalized configs in Connect REST API
  MINOR: Cleanup handling of mixed transactional/idempotent records (apache#6172)
  KAFKA-7844: Use regular subproject for generator to fix *All targets (apache#6182)
  Fix Documentation for cleanup.policy is out of date (apache#6181)
  MINOR: increase timeouts for KafkaStreamsTest (apache#6178)
  MINOR: Rejoin split ssl principal mapping rules (apache#6099)
  MINOR: Handle case where connector status endpoints returns 404 (apache#6176)
  MINOR: Remove unused imports, exceptions, and values (apache#6117)
  KAFKA-3522: Add internal RecordConverter interface (apache#6150)
  Fix Javadoc of KafkaConsumer (apache#6155)
  KAFKA-6455: Extend CacheFlushListener to forward timestamp (apache#6147)
  MINOR: Log partition info when creating new request batch in controller (apache#6145)
  KAFKA-7652: Part I; Fix SessionStore's findSession(single-key) (apache#6134)
  MINOR: Remove the InvalidTopicException handling in InternalTopicManager (apache#6167)
  [KAFKA-7024] Rocksdb state directory should be created before opening the DB (apache#6138)
  MINOR:: Fix typos (apache#6079)
pengxiaolong pushed a commit to pengxiaolong/kafka that referenced this pull request Jun 14, 2019
…ache#6172)

Reviewers: Rajini Sivaram <rajinisivaram@googlemail.com>, Ismael Juma <ismael@juma.me.uk>, Colin Patrick McCabe <colin@cmccabe.xyz>
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.

5 participants