This repository was archived by the owner on Jan 24, 2024. It is now read-only.
Repository navigation
Prevent incomplete future and add more logs for ProducerIdManager - #1391
Merged
BewareMyPower merged 1 commit intoJul 7, 2022
Merged
BewareMyPower merged 1 commit into
BewareMyPower merged 1 commit into
Conversation
### Motivation Currently, if the `ProducerIdManager` failed to generate the producer ID, the future of epoch and `TxnMetadata` would never complete, see https://github.com/streamnative/kop/blob/f63b191e72d2319f67f7a5ab7242e898c10ed9c5/kafka-impl/src/main/java/io/streamnative/pulsar/handlers/kop/coordinator/transaction/TransactionCoordinator.java#L248-L253 `epochAndTxnMetaFuture` would not complete in the case above. In addition, since `epochAndTxnMetaFuture` never complete exceptionally, the following code is redundant: https://github.com/streamnative/kop/blob/f63b191e72d2319f67f7a5ab7242e898c10ed9c5/kafka-impl/src/main/java/io/streamnative/pulsar/handlers/kop/coordinator/transaction/TransactionCoordinator.java#L304-L309 ### Modifications When the `ProducerIdManager` failed to generate the producer ID, complete `epochAndTxnMetaFuture` with null and handle the null value in the callback. Then add some debug and error logs for `ProducerIdManager`. Regarding the `exceptionally` block of `epochAndTxnMetaFuture`, treat it as an unexpected error caused by `thenAccept` block and return a `UNKNOWN_SERVER_ERROR` as well. Because in this case `Errors.forException(ex.getCause())` never return a valid error code.
BewareMyPower
added a commit
that referenced
this pull request
Jul 9, 2022
) ### Motivation Currently, if the `ProducerIdManager` failed to generate the producer ID, the future of epoch and `TxnMetadata` would never complete, see https://github.com/streamnative/kop/blob/f63b191e72d2319f67f7a5ab7242e898c10ed9c5/kafka-impl/src/main/java/io/streamnative/pulsar/handlers/kop/coordinator/transaction/TransactionCoordinator.java#L248-L253 `epochAndTxnMetaFuture` would not complete in the case above. In addition, since `epochAndTxnMetaFuture` never complete exceptionally, the following code is redundant: https://github.com/streamnative/kop/blob/f63b191e72d2319f67f7a5ab7242e898c10ed9c5/kafka-impl/src/main/java/io/streamnative/pulsar/handlers/kop/coordinator/transaction/TransactionCoordinator.java#L304-L309 ### Modifications When the `ProducerIdManager` failed to generate the producer ID, complete `epochAndTxnMetaFuture` with null and handle the null value in the callback. Then add some debug and error logs for `ProducerIdManager`. Regarding the `exceptionally` block of `epochAndTxnMetaFuture`, treat it as an unexpected error caused by `thenAccept` block and return a `UNKNOWN_SERVER_ERROR` as well. Because in this case `Errors.forException(ex.getCause())` never return a valid error code. (cherry picked from commit dc9d49a)
BewareMyPower
added a commit
that referenced
this pull request
Jul 19, 2022
) ### Motivation Currently, if the `ProducerIdManager` failed to generate the producer ID, the future of epoch and `TxnMetadata` would never complete, see https://github.com/streamnative/kop/blob/f63b191e72d2319f67f7a5ab7242e898c10ed9c5/kafka-impl/src/main/java/io/streamnative/pulsar/handlers/kop/coordinator/transaction/TransactionCoordinator.java#L248-L253 `epochAndTxnMetaFuture` would not complete in the case above. In addition, since `epochAndTxnMetaFuture` never complete exceptionally, the following code is redundant: https://github.com/streamnative/kop/blob/f63b191e72d2319f67f7a5ab7242e898c10ed9c5/kafka-impl/src/main/java/io/streamnative/pulsar/handlers/kop/coordinator/transaction/TransactionCoordinator.java#L304-L309 ### Modifications When the `ProducerIdManager` failed to generate the producer ID, complete `epochAndTxnMetaFuture` with null and handle the null value in the callback. Then add some debug and error logs for `ProducerIdManager`. Regarding the `exceptionally` block of `epochAndTxnMetaFuture`, treat it as an unexpected error caused by `thenAccept` block and return a `UNKNOWN_SERVER_ERROR` as well. Because in this case `Errors.forException(ex.getCause())` never return a valid error code. (cherry picked from commit dc9d49a)
BewareMyPower
added a commit
that referenced
this pull request
Jul 20, 2022
) ### Motivation Currently, if the `ProducerIdManager` failed to generate the producer ID, the future of epoch and `TxnMetadata` would never complete, see https://github.com/streamnative/kop/blob/f63b191e72d2319f67f7a5ab7242e898c10ed9c5/kafka-impl/src/main/java/io/streamnative/pulsar/handlers/kop/coordinator/transaction/TransactionCoordinator.java#L248-L253 `epochAndTxnMetaFuture` would not complete in the case above. In addition, since `epochAndTxnMetaFuture` never complete exceptionally, the following code is redundant: https://github.com/streamnative/kop/blob/f63b191e72d2319f67f7a5ab7242e898c10ed9c5/kafka-impl/src/main/java/io/streamnative/pulsar/handlers/kop/coordinator/transaction/TransactionCoordinator.java#L304-L309 ### Modifications When the `ProducerIdManager` failed to generate the producer ID, complete `epochAndTxnMetaFuture` with null and handle the null value in the callback. Then add some debug and error logs for `ProducerIdManager`. Regarding the `exceptionally` block of `epochAndTxnMetaFuture`, treat it as an unexpected error caused by `thenAccept` block and return a `UNKNOWN_SERVER_ERROR` as well. Because in this case `Errors.forException(ex.getCause())` never return a valid error code. (cherry picked from commit dc9d49a)
michaeljmarshall
pushed a commit
to michaeljmarshall/kop
that referenced
this pull request
Dec 13, 2022
…reamnative#1391) ### Motivation Currently, if the `ProducerIdManager` failed to generate the producer ID, the future of epoch and `TxnMetadata` would never complete, see https://github.com/streamnative/kop/blob/f63b191e72d2319f67f7a5ab7242e898c10ed9c5/kafka-impl/src/main/java/io/streamnative/pulsar/handlers/kop/coordinator/transaction/TransactionCoordinator.java#L248-L253 `epochAndTxnMetaFuture` would not complete in the case above. In addition, since `epochAndTxnMetaFuture` never complete exceptionally, the following code is redundant: https://github.com/streamnative/kop/blob/f63b191e72d2319f67f7a5ab7242e898c10ed9c5/kafka-impl/src/main/java/io/streamnative/pulsar/handlers/kop/coordinator/transaction/TransactionCoordinator.java#L304-L309 ### Modifications When the `ProducerIdManager` failed to generate the producer ID, complete `epochAndTxnMetaFuture` with null and handle the null value in the callback. Then add some debug and error logs for `ProducerIdManager`. Regarding the `exceptionally` block of `epochAndTxnMetaFuture`, treat it as an unexpected error caused by `thenAccept` block and return a `UNKNOWN_SERVER_ERROR` as well. Because in this case `Errors.forException(ex.getCause())` never return a valid error code. (cherry picked from commit dc9d49a)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Currently, if the
ProducerIdManagerfailed to generate the producer ID,the future of epoch and
TxnMetadatawould never complete, seekop/kafka-impl/src/main/java/io/streamnative/pulsar/handlers/kop/coordinator/transaction/TransactionCoordinator.java
Lines 248 to 253 in f63b191
epochAndTxnMetaFuturewould not complete in the case above.In addition, since
epochAndTxnMetaFuturenever complete exceptionally,the following code is redundant:
kop/kafka-impl/src/main/java/io/streamnative/pulsar/handlers/kop/coordinator/transaction/TransactionCoordinator.java
Lines 304 to 309 in f63b191
Modifications
When the
ProducerIdManagerfailed to generate the producer ID,complete
epochAndTxnMetaFuturewith null and handle the null value inthe callback.
Then add some debug and error logs for
ProducerIdManager. Regardingthe
exceptionallyblock ofepochAndTxnMetaFuture, treat it as anunexpected error caused by
thenAcceptblock and return aUNKNOWN_SERVER_ERRORas well. Because in this caseErrors.forException(ex.getCause())never return a valid error code.Documentation
Check the box below.
Need to update docs?
doc-required(If you need help on updating docs, create a doc issue)
no-need-doc(Please explain why)
doc(If this PR contains doc changes)