Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1.2k
IoTV2: Remove events that do not retry in leader's transfer buffer & fix concurrency bug of retryQueue & fix retry interval & refine log#15684
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
28 changes: 19 additions & 9 deletions
28 ...rg/apache/iotdb/db/pipe/connector/protocol/pipeconsensus/PipeConsensusAsyncConnector.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -72,10 +72,10 @@ | ||
| import java.util.Comparator; | ||
| import java.util.Iterator; | ||
| import java.util.Objects; | ||
| import java.util.PriorityQueue; | ||
| import java.util.Queue; | ||
| import java.util.concurrent.BlockingQueue; | ||
| import java.util.concurrent.LinkedBlockingDeque; | ||
| import java.util.concurrent.PriorityBlockingQueue; | ||
| import java.util.concurrent.ScheduledExecutorService; | ||
| import java.util.concurrent.TimeUnit; | ||
| import java.util.concurrent.atomic.AtomicBoolean; | ||
| @@ -101,7 +101,7 @@ public class PipeConsensusAsyncConnector extends IoTDBConnector implements Conse | ||
| private static final long PIPE_CONSENSUS_EVENT_ENQUEUE_TIMEOUT_IN_MS = | ||
| IOTDB_CONFIG.getConnectionTimeoutInMS() / 6; | ||
| private final Queue<EnrichedEvent> retryEventQueue = | ||
| new PriorityQueue<>( | ||
| new PriorityBlockingQueue<>( | ||
| IOTDB_CONFIG.getIotConsensusV2PipelineSize(), | ||
| Comparator.comparingLong(EnrichedEvent::getReplicateIndexForIoTV2)); | ||
| // We use enrichedEvent here to make use of EnrichedEvent.equalsInPipeConsensus | ||
| @@ -535,9 +535,10 @@ private void asyncTransferQueuedEventsIfNecessary() { | ||
| ? peekedEvent.getRetryInterval() | ||
| : 0L; | ||
| LOGGER.info( | ||
| "PipeConsensus-ConsensusGroup-{}: retry with interval {} for {}", | ||
| "PipeConsensus-ConsensusGroup-{}: retry with interval {} for index {} {}", | ||
| consensusGroupId, | ||
| retryInterval, | ||
| peekedEvent.getReplicateIndexForIoTV2(), | ||
| peekedEvent); | ||
| // need to retry in background service, otherwise the retryInterval will block the sender | ||
| // procedure. | ||
| @@ -616,7 +617,7 @@ private void retryTransfer(final PipeDeleteDataNodeEvent deleteDataNodeEvent) { | ||
| * @param event event to retry | ||
| */ | ||
| @SuppressWarnings("java:S899") | ||
| public void addFailureEventToRetryQueue(final EnrichedEvent event) { | ||
| public synchronized void addFailureEventToRetryQueue(final EnrichedEvent event) { | ||
jt2594838 marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| if (event.isReleased()) { | ||
| return; | ||
| } | ||
| @@ -630,11 +631,20 @@ public void addFailureEventToRetryQueue(final EnrichedEvent event) { | ||
| return; | ||
| } | ||
| retryEventQueue.offer(event); | ||
| LOGGER.info( | ||
| "PipeConsensus-ConsensusGroup-{}: Event {} transfer failed, will be added to retry queue.", | ||
| consensusGroupId, | ||
| event); | ||
| boolean res = retryEventQueue.offer(event); | ||
| if (res) { | ||
| LOGGER.info( | ||
| "PipeConsensus-ConsensusGroup-{}: Event {} replicate index {} transfer failed, will be added to retry queue.", | ||
| consensusGroupId, | ||
| event, | ||
| event.getReplicateIndexForIoTV2()); | ||
| } else { | ||
| LOGGER.warn( | ||
| "PipeConsensus-ConsensusGroup-{}: Event {} replicate index {} transfer failed, added to retry queue failed, this event will be ignored.", | ||
| consensusGroupId, | ||
| event, | ||
| event.getReplicateIndexForIoTV2()); | ||
| } | ||
jt2594838 marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| if (isClosed.get()) { | ||
| event.clearReferenceCount(PipeConsensusAsyncConnector.class.getName()); | ||
4 changes: 3 additions & 1 deletion
4 ...tdb/db/pipe/connector/protocol/pipeconsensus/handler/PipeConsensusDeleteEventHandler.java
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
5 changes: 4 additions & 1 deletion
5 ...pe/connector/protocol/pipeconsensus/handler/PipeConsensusTabletInsertionEventHandler.java
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
10 changes: 5 additions & 5 deletions
10 ...pe/connector/protocol/pipeconsensus/handler/PipeConsensusTsFileInsertionEventHandler.java
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
6 changes: 3 additions & 3 deletions
6 ...anode/src/main/java/org/apache/iotdb/db/pipe/event/realtime/PipeRealtimeEventFactory.java
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
2 changes: 1 addition & 1 deletion
2 ...e/extractor/dataregion/historical/PipeHistoricalDataRegionTsFileAndDeletionExtractor.java
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
4 changes: 2 additions & 2 deletions
4 iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/event/EnrichedEvent.java
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
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.
Uh oh!
There was an error while loading. Please reload this page.