(in progress) Fix duplication on shutdown fixes #23#34
Closed
ocadaruma wants to merge 3 commits intoline:masterfrom
Closed
(in progress) Fix duplication on shutdown fixes #23#34ocadaruma wants to merge 3 commits intoline:masterfrom
ocadaruma wants to merge 3 commits intoline:masterfrom
Conversation
3140cbc to
6370afd
Compare
Member
Author
|
As described above, to achieve "duplication not to occur in ordinary processing situation", it's required to wait all pending tasks. But it brings another risk that, the possibility of ungraceful shutdown. Waiting them all makes shutdown duration longer certainly. It can cause unpredictable result which possibly affects service. In conclusion, I close this PR for now. |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Decaton allows process duplication by design.
However, it's expected duplication not to occur in ordinary processing situation. ordinary situation here means:
Currently, process can be duplicated even in ordinary situation above due to 3 issues.
This PR fixes them.
Issue 1: ProcessPipeline returns immediately without doing process after terminated
(tasks are denoted by [offset: key])
Say partition contains
[1:a], [2:b], [3:b], [4:a], and partition concurrency is set to 2 (threadX,Y).And
key awill be routed to threadX,key bwill be routed to threadY.[1:a], [4:a][2:b], [3:b][1(n), 2(n), 3(n), 4(n)] hw=0(n)means not completed.(c)means completed.[1:a]and[4:a][2:b][1(c), 2(c), 3(n), 4(c)] hw=2[3:b], hence[4:a]will be processed again after rebalanceSolution
Revert to process all queued tasks.
Issue 2: Kafka 2.4 has changed to call
onPartitionsRevokedon shutdownKafka clients changed the behavior to call
onPartitionRevokedon KafkaConsumer#close. (apache/kafka#6884)This can cause duplication as below:
Say OOOCC is like this
[1(c), 2(c), 3(n), 4(c)] hw=2.decaton/processor/src/main/java/com/linecorp/decaton/processor/runtime/ProcessorSubscription.java
Line 254 in 85a426e
decaton/processor/src/main/java/com/linecorp/decaton/processor/runtime/ProcessorSubscription.java
Line 255 in 85a426e
3(n)will not be completed by anyone (decaton/processor/src/main/java/com/linecorp/decaton/processor/runtime/ProcessorSubscription.java
Line 180 in 85a426e
4(c)will be processed again after rebalanceSolution
onPartitionRevoked immediately returns if ProcessorSubscription already terminated.
Issue 3: ProcessorSubscription doesn't wait pending tasks on shutdown
Solution
wait all pending tasks on shutdown