Pengzna commented on code in PR #15600:
URL: https://github.com/apache/iotdb/pull/15600#discussion_r2113357699


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/extractor/dataregion/historical/PipeHistoricalDataRegionTsFileAndDeletionExtractor.java:
##########
@@ -426,6 +435,58 @@ private void flushDataRegionAllTsFiles() {
     }
   }
 
+  /**
+   * IoTV2 will only resend event that contains un-replicated local write 
data. So we only extract
+   * ProgressIndex containing local writes for comparison to prevent 
misjudgment on whether
+   * high-level tsFiles with mixed progressIndexes need to be retransmitted
+   *
+   * @return recoverProgressIndex dedicated in local DataNodeId or origin for 
fallback.
+   */
+  private ProgressIndex tryToExtractLocalProgressIndexForIoTV2(ProgressIndex 
origin) {
+    // There are only 2 cases:
+    // 1. origin is RecoverProgressIndex
+    if (origin instanceof RecoverProgressIndex) {
+      RecoverProgressIndex toBeTransformed = (RecoverProgressIndex) origin;
+      return new RecoverProgressIndex(
+          toBeTransformed.getDataNodeId2LocalIndex().entrySet().stream()
+              .filter(
+                  entry ->
+                      entry
+                          .getKey()
+                          
.equals(IoTDBDescriptor.getInstance().getConfig().getDataNodeId()))
+              .collect(Collectors.toMap(Map.Entry::getKey, 
Map.Entry::getValue)));

Review Comment:
   good catch, fixed!



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to