You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by "Caideyipi (via GitHub)" <gi...@apache.org> on 2026/05/22 08:47:10 UTC

[PR] Fixed the drop pipe logic to avoid losing data [iotdb]

Caideyipi opened a new pull request, #17748:
URL: https://github.com/apache/iotdb/pull/17748

   ## Description
   As the title said.
   
   <!--
   In each section, please describe design decisions made, including:
    - Choice of algorithms
    - Behavioral aspects. What configuration values are acceptable? How are corner cases and error 
       conditions handled, such as when there are insufficient resources?
    - Class organization and design (how the logic is split between classes, inheritance, composition, 
       design patterns)
    - Method organization and design (how the logic is split between methods, parameters and return types)
    - Naming (class, method, API, configuration, HTTP endpoint, names of emitted metrics)
   -->
   
   
   <!-- It's good to describe an alternative design (or mention an alternative name) for every design 
   (or naming) decision point and compare the alternatives with the designs that you've implemented 
   (or the names you've chosen) to highlight the advantages of the chosen designs and names. -->
   
   <!-- If there was a discussion of the design of the feature implemented in this PR elsewhere 
   (e. g. a "Proposal" issue, any other issue, or a thread in the development mailing list), 
   link to that discussion from this PR description and explain what have changed in your final design 
   compared to your original proposal or the consensus version in the end of the discussion. 
   If something hasn't changed since the original discussion, you can omit a detailed discussion of 
   those aspects of the design here, perhaps apart from brief mentioning for the sake of readability 
   of this PR description. -->
   
   <!-- Some of the aspects mentioned above may be omitted for simple and small changes. -->
   
   <hr>
   
   This PR has:
   - [ ] been self-reviewed.
       - [ ] concurrent read
       - [ ] concurrent write
       - [ ] concurrent read and write 
   - [ ] added documentation for new or modified features or behaviors.
   - [ ] added Javadocs for most classes and all non-trivial methods. 
   - [ ] added or updated version, __license__, or notice information
   - [ ] added comments explaining the "why" and the intent of the code wherever would not be obvious 
     for an unfamiliar reader.
   - [ ] added unit tests or modified existing tests to cover new code paths, ensuring the threshold 
     for code coverage.
   - [ ] added integration tests.
   - [ ] been tested in a test IoTDB cluster.
   
   <!-- Check the items by putting "x" in the brackets for the done things. Not all of these items 
   apply to every PR. Remove the items which are not done or not relevant to the PR. None of the items 
   from the checklist above are strictly necessary, but it would be very helpful if you at least 
   self-review the PR. -->
   
   <hr>
   
   ##### Key changed/added classes (or packages if there are too many classes) in this PR
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix pipe drop event discard with restart-aware committer keys [iotdb]

Posted by "luoluoyuyu (via GitHub)" <gi...@apache.org>.
luoluoyuyu commented on code in PR #17748:
URL: https://github.com/apache/iotdb/pull/17748#discussion_r3309326152


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/subtask/sink/PipeSinkSubtask.java:
##########
@@ -252,11 +248,18 @@ public void discardEventsOfPipe(
     }
 
     if (outputPipeSink instanceof PipeConnectorWithEventDiscard) {
-      ((PipeConnectorWithEventDiscard) outputPipeSink)
-          .discardEventsOfPipe(pipeNameToDrop, creationTimeToDrop, regionId);
+      ((PipeConnectorWithEventDiscard) outputPipeSink).discardEventsOfPipe(committerKey);
     }
   }
 
+  private static boolean isEventFromPipe(
+      final EnrichedEvent event, final CommitterKey committerKey) {
+    return committerKey.getPipeName().equals(event.getPipeName())
+        && committerKey.getCreationTime() == event.getCreationTime()
+        && committerKey.getRegionId() == event.getRegionId()
+        && (committerKey.getRestartTimes() < 0 || committerKey.equals(event.getCommitterKey()));

Review Comment:
   `committerKey.getRestartTimes() < 0` 时跳过 restartTimes 比较,用于 drop 时丢弃该 creationTime 下所有 restart 实例。
   
   **建议**:
   1. 在 `CommitterKey` 或调用处用常量/document 说明 `-1` 语义(如 `DROP_ALL_RESTARTS`)
   2. 补 IT:`CREATE pipe A → DROP → CREATE 同名 pipe B(新 creationTime)→ 验证 B 的事件不被 discard`



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/connection/PipeEventCollector.java:
##########
@@ -238,7 +238,10 @@ private void collectEvent(final Event event) {
       enrichedEvent.setRebootTimes(PipeDataNodeAgent.runtime().getRebootTimes());
 
       if (enrichedEvent.getPipeName() != null
-          && pendingQueue.isPipeDropped(enrichedEvent.getPipeName(), creationTime, regionId)) {
+          && (pendingQueue.isEventFromDroppedPipe(enrichedEvent)

Review Comment:
   丢弃逻辑分两支:
   1. `isEventFromDroppedPipe(enrichedEvent)` — 有 committerKey 的精确匹配
   2. `committerKey == null` 时回退到 `(pipeName, creationTime, regionId)`
   
   **请确认**:`committerKey == null` 的事件是否只可能来自「尚未 enrich」的瞬时状态?若某些路径长期为 null,可能在 drop 后仍按旧三元组误丢**新** pipe(若 creationTime 复用)。
   
   建议在注释中写明 null committerKey 的生命周期,或保证 enrich 在入队前完成。



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix pipe drop event discard with restart-aware committer keys [iotdb]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #17748:
URL: https://github.com/apache/iotdb/pull/17748#issuecomment-4539510853

   ## [Codecov](https://app.codecov.io/gh/apache/iotdb/pull/17748?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `56.32184%` with `38 lines` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 40.57%. Comparing base ([`0d1b838`](https://app.codecov.io/gh/apache/iotdb/commit/0d1b838de0697b24218a1e15f99f99ff85f8f2df?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`a20c1d3`](https://app.codecov.io/gh/apache/iotdb/commit/a20c1d31913c2c08d20fbcd9e0f5cc0a3ef2f302?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 13 commits behind head on master.
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/iotdb/pull/17748?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [.../payload/evolvable/batch/PipeTabletEventBatch.java](https://app.codecov.io/gh/apache/iotdb/pull/17748?src=pr&el=tree&filepath=iotdb-core%2Fdatanode%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fiotdb%2Fdb%2Fpipe%2Fsink%2Fpayload%2Fevolvable%2Fbatch%2FPipeTabletEventBatch.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aW90ZGItY29yZS9kYXRhbm9kZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW90ZGIvZGIvcGlwZS9zaW5rL3BheWxvYWQvZXZvbHZhYmxlL2JhdGNoL1BpcGVUYWJsZXRFdmVudEJhdGNoLmphdmE=) | 0.00% | [7 Missing :warning: ](https://app.codecov.io/gh/apache/iotdb/pull/17748?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [.../pipe/agent/task/subtask/sink/PipeSinkSubtask.java](https://app.codecov.io/gh/apache/iotdb/pull/17748?src=pr&el=tree&filepath=iotdb-core%2Fdatanode%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fiotdb%2Fdb%2Fpipe%2Fagent%2Ftask%2Fsubtask%2Fsink%2FPipeSinkSubtask.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aW90ZGItY29yZS9kYXRhbm9kZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW90ZGIvZGIvcGlwZS9hZ2VudC90YXNrL3N1YnRhc2svc2luay9QaXBlU2lua1N1YnRhc2suamF2YQ==) | 25.00% | [6 Missing :warning: ](https://app.codecov.io/gh/apache/iotdb/pull/17748?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...ink/protocol/airgap/IoTDBDataRegionAirGapSink.java](https://app.codecov.io/gh/apache/iotdb/pull/17748?src=pr&el=tree&filepath=iotdb-core%2Fdatanode%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fiotdb%2Fdb%2Fpipe%2Fsink%2Fprotocol%2Fairgap%2FIoTDBDataRegionAirGapSink.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aW90ZGItY29yZS9kYXRhbm9kZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW90ZGIvZGIvcGlwZS9zaW5rL3Byb3RvY29sL2FpcmdhcC9Jb1REQkRhdGFSZWdpb25BaXJHYXBTaW5rLmphdmE=) | 0.00% | [3 Missing :warning: ](https://app.codecov.io/gh/apache/iotdb/pull/17748?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [.../protocol/thrift/sync/IoTDBDataRegionSyncSink.java](https://app.codecov.io/gh/apache/iotdb/pull/17748?src=pr&el=tree&filepath=iotdb-core%2Fdatanode%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fiotdb%2Fdb%2Fpipe%2Fsink%2Fprotocol%2Fthrift%2Fsync%2FIoTDBDataRegionSyncSink.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aW90ZGItY29yZS9kYXRhbm9kZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW90ZGIvZGIvcGlwZS9zaW5rL3Byb3RvY29sL3RocmlmdC9zeW5jL0lvVERCRGF0YVJlZ2lvblN5bmNTaW5rLmphdmE=) | 0.00% | [3 Missing :warning: ](https://app.codecov.io/gh/apache/iotdb/pull/17748?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...db/pipe/sink/protocol/websocket/WebSocketSink.java](https://app.codecov.io/gh/apache/iotdb/pull/17748?src=pr&el=tree&filepath=iotdb-core%2Fdatanode%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fiotdb%2Fdb%2Fpipe%2Fsink%2Fprotocol%2Fwebsocket%2FWebSocketSink.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aW90ZGItY29yZS9kYXRhbm9kZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW90ZGIvZGIvcGlwZS9zaW5rL3Byb3RvY29sL3dlYnNvY2tldC9XZWJTb2NrZXRTaW5rLmphdmE=) | 0.00% | [3 Missing :warning: ](https://app.codecov.io/gh/apache/iotdb/pull/17748?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...e/sink/protocol/PipeConnectorWithEventDiscard.java](https://app.codecov.io/gh/apache/iotdb/pull/17748?src=pr&el=tree&filepath=iotdb-core%2Fnode-commons%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fiotdb%2Fcommons%2Fpipe%2Fsink%2Fprotocol%2FPipeConnectorWithEventDiscard.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aW90ZGItY29yZS9ub2RlLWNvbW1vbnMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2lvdGRiL2NvbW1vbnMvcGlwZS9zaW5rL3Byb3RvY29sL1BpcGVDb25uZWN0b3JXaXRoRXZlbnREaXNjYXJkLmphdmE=) | 0.00% | [3 Missing :warning: ](https://app.codecov.io/gh/apache/iotdb/pull/17748?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...gent/task/subtask/sink/PipeSinkSubtaskManager.java](https://app.codecov.io/gh/apache/iotdb/pull/17748?src=pr&el=tree&filepath=iotdb-core%2Fdatanode%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fiotdb%2Fdb%2Fpipe%2Fagent%2Ftask%2Fsubtask%2Fsink%2FPipeSinkSubtaskManager.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aW90ZGItY29yZS9kYXRhbm9kZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW90ZGIvZGIvcGlwZS9hZ2VudC90YXNrL3N1YnRhc2svc2luay9QaXBlU2lua1N1YnRhc2tNYW5hZ2VyLmphdmE=) | 0.00% | [2 Missing :warning: ](https://app.codecov.io/gh/apache/iotdb/pull/17748?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...d/evolvable/batch/PipeTransferBatchReqBuilder.java](https://app.codecov.io/gh/apache/iotdb/pull/17748?src=pr&el=tree&filepath=iotdb-core%2Fdatanode%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fiotdb%2Fdb%2Fpipe%2Fsink%2Fpayload%2Fevolvable%2Fbatch%2FPipeTransferBatchReqBuilder.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aW90ZGItY29yZS9kYXRhbm9kZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW90ZGIvZGIvcGlwZS9zaW5rL3BheWxvYWQvZXZvbHZhYmxlL2JhdGNoL1BpcGVUcmFuc2ZlckJhdGNoUmVxQnVpbGRlci5qYXZh) | 50.00% | [2 Missing :warning: ](https://app.codecov.io/gh/apache/iotdb/pull/17748?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...rotocol/thrift/async/IoTDBDataRegionAsyncSink.java](https://app.codecov.io/gh/apache/iotdb/pull/17748?src=pr&el=tree&filepath=iotdb-core%2Fdatanode%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fiotdb%2Fdb%2Fpipe%2Fsink%2Fprotocol%2Fthrift%2Fasync%2FIoTDBDataRegionAsyncSink.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aW90ZGItY29yZS9kYXRhbm9kZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW90ZGIvZGIvcGlwZS9zaW5rL3Byb3RvY29sL3RocmlmdC9hc3luYy9Jb1REQkRhdGFSZWdpb25Bc3luY1NpbmsuamF2YQ==) | 83.33% | [2 Missing :warning: ](https://app.codecov.io/gh/apache/iotdb/pull/17748?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...n/task/subtask/SubscriptionSinkSubtaskManager.java](https://app.codecov.io/gh/apache/iotdb/pull/17748?src=pr&el=tree&filepath=iotdb-core%2Fdatanode%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fiotdb%2Fdb%2Fsubscription%2Ftask%2Fsubtask%2FSubscriptionSinkSubtaskManager.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aW90ZGItY29yZS9kYXRhbm9kZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW90ZGIvZGIvc3Vic2NyaXB0aW9uL3Rhc2svc3VidGFzay9TdWJzY3JpcHRpb25TaW5rU3VidGFza01hbmFnZXIuamF2YQ==) | 0.00% | [2 Missing :warning: ](https://app.codecov.io/gh/apache/iotdb/pull/17748?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | ... and [4 more](https://app.codecov.io/gh/apache/iotdb/pull/17748?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #17748      +/-   ##
   ============================================
   - Coverage     40.59%   40.57%   -0.03%     
     Complexity     2574     2574              
   ============================================
     Files          5179     5180       +1     
     Lines        349979   350366     +387     
     Branches      44749    44803      +54     
   ============================================
   + Hits         142082   142153      +71     
   - Misses       207897   208213     +316     
   ```
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/iotdb/pull/17748?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix pipe drop event discard with restart-aware committer keys [iotdb]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #17748:
URL: https://github.com/apache/iotdb/pull/17748#issuecomment-4531015302

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache_iotdb&pullRequest=17748) **Quality Gate failed**  
   Failed conditions  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [7.4% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_iotdb&pullRequest=17748&metric=new_duplicated_lines_density&view=list) (required ≤ 5%)  
     
   <!-- sqra:qg_revision=3b9affb4ea5d5a3d7abdf14f889ed7b4d92c20d18f9e195d06f401f4a7bff428 -->
   <!-- sqra-placement-anchor -->
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_iotdb&pullRequest=17748)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix pipe drop event discard with restart-aware committer keys [iotdb]

Posted by "luoluoyuyu (via GitHub)" <gi...@apache.org>.
luoluoyuyu commented on code in PR #17748:
URL: https://github.com/apache/iotdb/pull/17748#discussion_r3309370308


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/connection/PipeEventCollector.java:
##########
@@ -238,7 +238,10 @@ private void collectEvent(final Event event) {
       enrichedEvent.setRebootTimes(PipeDataNodeAgent.runtime().getRebootTimes());
 
       if (enrichedEvent.getPipeName() != null
-          && pendingQueue.isPipeDropped(enrichedEvent.getPipeName(), creationTime, regionId)) {
+          && (pendingQueue.isEventFromDroppedPipe(enrichedEvent)

Review Comment:
   Drop logic uses isEventFromDroppedPipe when possible, and falls back to isPipeDropped only when committerKey is null. Please document when committerKey can still be null at collection time; if that window is wide, the fallback could discard events for a recreated pipe with the same name and creationTime.



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/subtask/sink/PipeSinkSubtask.java:
##########
@@ -252,11 +248,18 @@ public void discardEventsOfPipe(
     }
 
     if (outputPipeSink instanceof PipeConnectorWithEventDiscard) {
-      ((PipeConnectorWithEventDiscard) outputPipeSink)
-          .discardEventsOfPipe(pipeNameToDrop, creationTimeToDrop, regionId);
+      ((PipeConnectorWithEventDiscard) outputPipeSink).discardEventsOfPipe(committerKey);
     }
   }
 
+  private static boolean isEventFromPipe(
+      final EnrichedEvent event, final CommitterKey committerKey) {
+    return committerKey.getPipeName().equals(event.getPipeName())
+        && committerKey.getCreationTime() == event.getCreationTime()
+        && committerKey.getRegionId() == event.getRegionId()
+        && (committerKey.getRestartTimes() < 0 || committerKey.equals(event.getCommitterKey()));

Review Comment:
   restartTimes < 0 skips restart comparison for drop-all-restarts behavior. Consider a named constant (e.g. DROP_ALL_RESTARTS) instead of a magic -1, and add a test: drop pipe, recreate same name, verify new events are not discarded.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix pipe drop event discard with restart-aware committer keys [iotdb]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #17748:
URL: https://github.com/apache/iotdb/pull/17748#issuecomment-4539167680

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache_iotdb&pullRequest=17748) **Quality Gate failed**  
   Failed conditions  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [7.3% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_iotdb&pullRequest=17748&metric=new_duplicated_lines_density&view=list) (required ≤ 5%)  
     
   <!-- sqra:qg_revision=92d86895959a54725fc695e21a6426e3b500148822624eeeffee5eb610e76d9c -->
   <!-- sqra-placement-anchor -->
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_iotdb&pullRequest=17748)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix pipe drop event discard with restart-aware committer keys [iotdb]

Posted by "luoluoyuyu (via GitHub)" <gi...@apache.org>.
luoluoyuyu commented on code in PR #17748:
URL: https://github.com/apache/iotdb/pull/17748#discussion_r3309326145


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/connection/PipeEventCollector.java:
##########
@@ -238,7 +238,10 @@ private void collectEvent(final Event event) {
       enrichedEvent.setRebootTimes(PipeDataNodeAgent.runtime().getRebootTimes());
 
       if (enrichedEvent.getPipeName() != null
-          && pendingQueue.isPipeDropped(enrichedEvent.getPipeName(), creationTime, regionId)) {
+          && (pendingQueue.isEventFromDroppedPipe(enrichedEvent)

Review Comment:
   丢弃逻辑分两支:
   1. `isEventFromDroppedPipe(enrichedEvent)` — 有 committerKey 的精确匹配
   2. `committerKey == null` 时回退到 `(pipeName, creationTime, regionId)`
   
   **请确认**:`committerKey == null` 的事件是否只可能来自「尚未 enrich」的瞬时状态?若某些路径长期为 null,可能在 drop 后仍按旧三元组误丢**新** pipe(若 creationTime 复用)。
   
   建议在注释中写明 null committerKey 的生命周期,或保证 enrich 在入队前完成。



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/subtask/sink/PipeSinkSubtask.java:
##########
@@ -252,11 +248,18 @@ public void discardEventsOfPipe(
     }
 
     if (outputPipeSink instanceof PipeConnectorWithEventDiscard) {
-      ((PipeConnectorWithEventDiscard) outputPipeSink)
-          .discardEventsOfPipe(pipeNameToDrop, creationTimeToDrop, regionId);
+      ((PipeConnectorWithEventDiscard) outputPipeSink).discardEventsOfPipe(committerKey);
     }
   }
 
+  private static boolean isEventFromPipe(
+      final EnrichedEvent event, final CommitterKey committerKey) {
+    return committerKey.getPipeName().equals(event.getPipeName())
+        && committerKey.getCreationTime() == event.getCreationTime()
+        && committerKey.getRegionId() == event.getRegionId()
+        && (committerKey.getRestartTimes() < 0 || committerKey.equals(event.getCommitterKey()));

Review Comment:
   `committerKey.getRestartTimes() < 0` 时跳过 restartTimes 比较,用于 drop 时丢弃该 creationTime 下所有 restart 实例。
   
   **建议**:
   1. 在 `CommitterKey` 或调用处用常量/document 说明 `-1` 语义(如 `DROP_ALL_RESTARTS`)
   2. 补 IT:`CREATE pipe A → DROP → CREATE 同名 pipe B(新 creationTime)→ 验证 B 的事件不被 discard`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix pipe drop event discard with restart-aware committer keys [iotdb]

Posted by "jt2594838 (via GitHub)" <gi...@apache.org>.
jt2594838 merged PR #17748:
URL: https://github.com/apache/iotdb/pull/17748


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org