PipeConsensus: Fix replication block when leader restart.#13028
Merged
OneSizeFitsQuorum merged 2 commits intoapache:masterfrom Jul 26, 2024
Merged
PipeConsensus: Fix replication block when leader restart.#13028OneSizeFitsQuorum merged 2 commits intoapache:masterfrom
OneSizeFitsQuorum merged 2 commits intoapache:masterfrom
Conversation
Caideyipi
approved these changes
Jul 25, 2024
...ain/java/org/apache/iotdb/db/pipe/receiver/protocol/pipeconsensus/PipeConsensusReceiver.java
Outdated
Show resolved
Hide resolved
JackieTien97
pushed a commit
that referenced
this pull request
Jul 29, 2024
* fix 833 * fix review(rename typo) (cherry picked from commit 2a06d48)
JackieTien97
pushed a commit
that referenced
this pull request
Jul 29, 2024
* fix 833 * fix review(rename typo) (cherry picked from commit 2a06d48)
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.
In PipeConsensus, in order to accept tsfile in parallel, the tsfileWriterPool mechanism is introduced: each time a tsfilePiece is written, it will first try to get a tsfileWriter from the pool. If it cannot get one, it will block the polling until it gets a writer. The number of tsfileWriters in the tsfileWriterPool is equal to the number of pipelines.
Under normal circumstances, this mechanism is fine. Because as long as the previous tsfile completes the sealing, it will return the writer to the pool. This ensures that the tsfiles waiting in line for writers will eventually get the writer and will not be blocked all the time.
However, there are two scenarios that may cause problems:
Chinese Version:
在 PipeConsensus 中,为了并行接受 tsfile,引入了 tsfileWriterPool 的机制:每次写 tsfilePiece 时,会首先尝试从 pool 中拿一个 tsfileWriter。如果拿不到,会一直阻塞轮询,直到拿到 writer 为止。 tsfileWriterPool 中 tsfileWriter 的个数等于 pipeline 个数。
正常情况下,这套机制是没有问题的。因为只要前面的 tsfile 完成封口,它就会把 writer 还给 pool。从而保证后面排队等 writer 的 tsfile 最终一定能拿到 writer,不会一直阻塞。
然而,有两种场景可能会产生问题: