You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by "XNX02 (via GitHub)" <gi...@apache.org> on 2025/03/17 16:06:37 UTC

[PR] Pipe: Double-living Semantic Correction to Forward Events from Cluster A to B by Default Unless They Originate from B [iotdb]

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

   (no comment)


-- 
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] Pipe: Double-living Semantic Correction to Forward Events from Cluster A to B by Default Unless They Originate from B [iotdb]

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


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessor.java:
##########
@@ -577,6 +597,16 @@ public void insertTablet(
     if (!insertTabletNode.isGeneratedByPipe()) {
       workMemTable.markAsNotGeneratedByPipe();
     }
+    final String originClusterId =
+        insertTabletNode.getOriginClusterId() == null
+            ? config.getClusterId()
+            : insertTabletNode.getOriginClusterId();
+    if (Objects.isNull(workMemTable.getCurrentOriginClusterId())) {
+      workMemTable.setCurrentOriginClusterId(originClusterId);
+    } else if (!Objects.equals(originClusterId, workMemTable.getCurrentOriginClusterId())) {

Review Comment:
   originClusterId != workMemTable.getCurrentOriginClusterId()



-- 
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] Pipe: Double-living Semantic Correction to Forward Events from Cluster A to B by Default Unless They Originate from B [iotdb]

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


##########
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/PermissionManager.java:
##########
@@ -59,7 +59,8 @@ public PermissionManager(ConfigManager configManager, AuthorInfo authorInfo) {
    * @param isGeneratedByPipe whether the plan is operated by pipe receiver
    * @return TSStatus
    */
-  public TSStatus operatePermission(AuthorPlan authorPlan, boolean isGeneratedByPipe) {
+  public TSStatus operatePermission(
+      AuthorPlan authorPlan, boolean isGeneratedByPipe, String originClusterIds) {

Review Comment:
   originClusterId<s>... Same in other files



-- 
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] Pipe: Double-living Semantic Correction to Forward Events from Cluster A to B by Default Unless They Originate from B [iotdb]

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


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/deletion/PipeDeleteDataNodeEvent.java:
##########
@@ -44,6 +44,7 @@ public class PipeDeleteDataNodeEvent extends EnrichedEvent implements Serializab
   private AbstractDeleteDataNode deleteDataNode;
   private DeletionResource deletionResource;
   private boolean isGeneratedByPipe;
+  private String originClusterId;

Review Comment:
   comment



-- 
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] Pipe: Double-living Semantic Correction to Forward Events from Cluster A to B by Default Unless They Originate from B [iotdb]

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


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tsfile/PipeTsFileInsertionEvent.java:
##########
@@ -136,6 +140,42 @@ public PipeTsFileInsertionEvent(
       final boolean skipIfNoPrivileges,
       final long startTime,
       final long endTime) {
+    this(
+        isTableModelEvent,
+        databaseNameFromDataRegion,
+        resource,
+        true,
+        isLoaded,
+        isGeneratedByHistoricalExtractor,
+        null,
+        pipeName,
+        creationTime,
+        pipeTaskMeta,
+        treePattern,
+        tablePattern,
+        userName,
+        skipIfNoPrivileges,
+        startTime,
+        endTime);
+  }
+
+  public PipeTsFileInsertionEvent(

Review Comment:
   Not used?



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/scheduler/load/LoadTsFileScheduler.java:
##########
@@ -141,6 +141,7 @@ public class LoadTsFileScheduler implements IScheduler {
   private final Set<TRegionReplicaSet> allReplicaSets;
   private final boolean isGeneratedByPipe;
   private final LoadTsFileDataCacheMemoryBlock block;
+  private final String originClusterId;
 
   public LoadTsFileScheduler(

Review Comment:
   Better remove this?



-- 
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] Pipe: Double-living Semantic Correction to Forward Events from Cluster A to B by Default Unless They Originate from B [iotdb]

Posted by "SteveYurongSu (via GitHub)" <gi...@apache.org>.
SteveYurongSu closed pull request #15112: Pipe: Double-living Semantic Correction to Forward Events from Cluster A to B by Default Unless They Originate from B
URL: https://github.com/apache/iotdb/pull/15112


-- 
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] Pipe: Double-living Semantic Correction to Forward Events from Cluster A to B by Default Unless They Originate from B [iotdb]

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


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessor.java:
##########
@@ -577,6 +597,16 @@ public void insertTablet(
     if (!insertTabletNode.isGeneratedByPipe()) {
       workMemTable.markAsNotGeneratedByPipe();
     }
+    final String originClusterId =
+        insertTabletNode.getOriginClusterId() == null
+            ? config.getClusterId()
+            : insertTabletNode.getOriginClusterId();
+    if (Objects.isNull(workMemTable.getCurrentOriginClusterId())) {

Review Comment:
   if from the same cluster



-- 
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] Pipe: Double-living Semantic Correction to Forward Events from Cluster A to B by Default Unless They Originate from B [iotdb]

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


##########
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/pipe/payload/PipeEnrichedPlanV2.java:
##########
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.confignode.consensus.request.write.pipe.payload;
+
+import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
+import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
+
+import org.apache.tsfile.utils.ReadWriteIOUtils;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.Objects;
+
+public class PipeEnrichedPlanV2 extends PipeEnrichedPlanV1 {
+
+  private String originClusterId;
+
+  public PipeEnrichedPlanV2() {
+    super(ConfigPhysicalPlanType.PipeEnrichedV2);
+  }
+
+  public PipeEnrichedPlanV2(ConfigPhysicalPlan innerPlan, String originClusterId) {
+    super(ConfigPhysicalPlanType.PipeEnrichedV2);
+    this.innerPlan = innerPlan;
+    this.originClusterId = originClusterId;
+  }
+
+  public String getOriginClusterId() {
+    return originClusterId;
+  }
+
+  @Override
+  protected void serializeImpl(DataOutputStream stream) throws IOException {
+    super.serializeImpl(stream);
+    ReadWriteIOUtils.write(originClusterId, stream);
+  }
+
+  @Override
+  protected void deserializeImpl(ByteBuffer buffer) throws IOException {
+    super.deserializeImpl(buffer);
+    originClusterId = ReadWriteIOUtils.readString(buffer);
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+    if (this == obj) {
+      return true;
+    }
+    if (obj == null || getClass() != obj.getClass()) {
+      return false;
+    }
+    PipeEnrichedPlanV2 that = (PipeEnrichedPlanV2) obj;
+    return innerPlan.equals(that.innerPlan)
+        && Objects.equals(originClusterId, that.originClusterId);
+  }
+
+  @Override
+  public int hashCode() {
+    return Objects.hash(innerPlan, originClusterId);
+  }
+
+  @Override
+  public String toString() {
+    return "PipeEnrichedPlanV2{" + "innerPlan='" + innerPlan + "'}";

Review Comment:
   Better add "originClusterId" here



##########
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/sync/AuthOperationProcedure.java:
##########
@@ -87,6 +87,19 @@ public AuthOperationProcedure(
     this.timeoutMS = commonConfig.getDatanodeTokenTimeoutMS();
   }

Review Comment:
   May remove the unused constructors... Same in other files



##########
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/event/PipeConfigRegionWritePlanEvent.java:
##########
@@ -91,23 +110,42 @@ public EnrichedEvent shallowCopySelfAndBindPipeTaskMetaForProgressReport(
         tablePattern,
         userName,
         skipIfNoPrivileges,
-        false);
+        false,
+        null);
   }
 
   @Override
   public ByteBuffer serializeToByteBuffer() {
     final ByteBuffer planBuffer = configPhysicalPlan.serializeToByteBuffer();
-    final ByteBuffer result = ByteBuffer.allocate(Byte.BYTES * 2 + planBuffer.limit());
+    final ByteBuffer result =
+        ByteBuffer.allocate(
+            Byte.BYTES * 2
+                + planBuffer.limit()
+                + computeOriginClusterIdBufferSize(originClusterId));
     ReadWriteIOUtils.write(PipeConfigSerializableEventType.CONFIG_WRITE_PLAN.getType(), result);
     ReadWriteIOUtils.write(isGeneratedByPipe, result);
     result.put(planBuffer);
+    ReadWriteIOUtils.write(originClusterId, result);
     return result;
   }
 
   @Override
   public void deserializeFromByteBuffer(final ByteBuffer buffer) throws IOException {
     isGeneratedByPipe = ReadWriteIOUtils.readBool(buffer);
     configPhysicalPlan = ConfigPhysicalPlan.Factory.create(buffer);
+
+    // There might be an ignoredChildrenSize 0

Review Comment:
   The size may not appear on configNodes...



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/executor/RegionWriteExecutor.java:
##########
@@ -1045,6 +1045,7 @@ private RegionExecutionResult executeCreateOrUpdateTableDevice(
     @Override
     public RegionExecutionResult visitPipeEnrichedWritePlanNode(
         final PipeEnrichedWritePlanNode node, final WritePlanNodeExecutionContext context) {
+      node.setOriginClusterId(node.getOriginClusterId());

Review Comment:
   ...?



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/extractor/dataregion/IoTDBDataRegionExtractor.java:
##########
@@ -697,6 +698,14 @@ public void close() throws Exception {
     }
   }
 
+  public Set<String> getSinkClusterIds() {

Review Comment:
   Is it used?



##########
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/PermissionManager.java:
##########
@@ -59,7 +59,8 @@ public PermissionManager(ConfigManager configManager, AuthorInfo authorInfo) {
    * @param isGeneratedByPipe whether the plan is operated by pipe receiver
    * @return TSStatus
    */
-  public TSStatus operatePermission(AuthorPlan authorPlan, boolean isGeneratedByPipe) {
+  public TSStatus operatePermission(
+      AuthorPlan authorPlan, boolean isGeneratedByPipe, String originClusterIds) {

Review Comment:
   originClusterId<s>



##########
iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlanSerDeTest.java:
##########
@@ -1668,16 +1669,17 @@ public void updateClusterIdPlanTest() throws IOException {
 
   @Test
   public void pipeEnrichedPlanTest() throws IOException {
-    final PipeEnrichedPlan plan =
-        new PipeEnrichedPlan(
+    final PipeEnrichedPlanV1 plan =

Review Comment:
   Better use "V2".. Same in other tests



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/extractor/dataregion/IoTDBDataRegionExtractor.java:
##########
@@ -697,6 +698,14 @@ public void close() throws Exception {
     }
   }
 
+  public Set<String> getSinkClusterIds() {
+    return realtimeExtractor.getSinkClusterIds();
+  }
+
+  public void setSinkClusterIds(Set<String> sinkClusterIds) {
+    realtimeExtractor.setSinkClusterIds(sinkClusterIds);

Review Comment:
   Personally I think it's better to put this in IoTDBExtractor...



##########
iotdb-protocol/thrift-datanode/src/main/thrift/datanode.thrift:
##########
@@ -436,12 +437,14 @@ struct TDeleteDataForDeleteSchemaReq {
   1: required list<common.TConsensusGroupId> dataRegionIdList
   2: required binary pathPatternTree
   3: optional bool isGeneratedByPipe
+  4: optional string originClusterId
 }
 
 struct TDeleteTimeSeriesReq {
   1: required list<common.TConsensusGroupId> schemaRegionIdList
   2: required binary pathPatternTree
   3: optional bool isGeneratedByPipe
+  4: optional string originCluster

Review Comment:
   Better add "Id" here



##########
iotdb-protocol/thrift-datanode/src/main/thrift/client.thrift:
##########
@@ -497,6 +497,7 @@ struct TPipeTransferReq {
 struct TPipeTransferResp {
   1:required common.TSStatus status
   2:optional binary body
+  3:optional string clusterId

Review Comment:
   Better use "body" instead of adding a new field?



-- 
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] Pipe: Double-living Semantic Correction to Forward Events from Cluster A to B by Default Unless They Originate from B [iotdb]

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


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessor.java:
##########
@@ -577,6 +597,16 @@ public void insertTablet(
     if (!insertTabletNode.isGeneratedByPipe()) {
       workMemTable.markAsNotGeneratedByPipe();
     }
+    final String originClusterId =
+        insertTabletNode.getOriginClusterId() == null
+            ? config.getClusterId()

Review Comment:
   Generated or cached?



-- 
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] Pipe: Double-living Semantic Correction to Forward Events from Cluster A to B by Default Unless They Originate from B [iotdb]

Posted by "Caideyipi (via GitHub)" <gi...@apache.org>.
Caideyipi commented on PR #15112:
URL: https://github.com/apache/iotdb/pull/15112#issuecomment-2811658964

   Will any similar mechanism be applied to "WriteBackSink" (i.e. write-back-sink won't transfer data written back once)?


-- 
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] Pipe: Double-living Semantic Correction to Forward Events from Cluster A to B by Default Unless They Originate from B [iotdb]

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


##########
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/receiver/IoTDBFileReceiver.java:
##########
@@ -74,6 +76,10 @@ public abstract class IoTDBFileReceiver implements IoTDBReceiver {
   protected String username = CONNECTOR_IOTDB_USER_DEFAULT_VALUE;
   protected String password = CONNECTOR_IOTDB_PASSWORD_DEFAULT_VALUE;
 
+  // Used to store the clusterId for location comparison
+  public static final Map<String, String> CLUSTER_ID_MAP = new HashMap<>();

Review Comment:
   Why not use a hashSet....



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/pipe/PipeEnrichedInsertNode.java:
##########
@@ -233,16 +245,20 @@ public void setSearchIndex(final long searchIndex) {
   protected void serializeAttributes(final ByteBuffer byteBuffer) {
     PlanNodeType.PIPE_ENRICHED_INSERT_DATA.serialize(byteBuffer);
     insertNode.serialize(byteBuffer);
+    ReadWriteIOUtils.write(originClusterId, byteBuffer);
   }
 
   @Override
   protected void serializeAttributes(final DataOutputStream stream) throws IOException {
     PlanNodeType.PIPE_ENRICHED_INSERT_DATA.serialize(stream);
     insertNode.serialize(stream);
+    ReadWriteIOUtils.write(originClusterId, stream);
   }
 
   public static PipeEnrichedInsertNode deserialize(final ByteBuffer buffer) {
-    return new PipeEnrichedInsertNode((InsertNode) PlanNodeType.deserialize(buffer));
+    return new PipeEnrichedInsertNode(
+        (InsertNode) PlanNodeType.deserialize(buffer),
+        buffer.hasRemaining() ? ReadWriteIOUtils.readString(buffer) : null);

Review Comment:
   What about ignore children size?



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/executor/RegionWriteExecutor.java:
##########
@@ -1045,6 +1045,7 @@ private RegionExecutionResult executeCreateOrUpdateTableDevice(
     @Override
     public RegionExecutionResult visitPipeEnrichedWritePlanNode(
         final PipeEnrichedWritePlanNode node, final WritePlanNodeExecutionContext context) {
+      node.setOriginClusterId(node.getOriginClusterId());

Review Comment:
   Seemingly some extra operations are needed to pass the "originClusterId" to the state machine....



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/pipe/PipeEnrichedWritePlanNode.java:
##########
@@ -156,16 +170,20 @@ public <R, C> R accept(final PlanVisitor<R, C> visitor, final C context) {
   protected void serializeAttributes(final ByteBuffer byteBuffer) {
     PlanNodeType.PIPE_ENRICHED_WRITE.serialize(byteBuffer);
     writePlanNode.serialize(byteBuffer);
+    ReadWriteIOUtils.write(originClusterId, byteBuffer);
   }
 
   @Override
   protected void serializeAttributes(final DataOutputStream stream) throws IOException {
     PlanNodeType.PIPE_ENRICHED_WRITE.serialize(stream);
     writePlanNode.serialize(stream);
+    ReadWriteIOUtils.write(originClusterId, stream);
   }
 
   public static PipeEnrichedWritePlanNode deserialize(final ByteBuffer buffer) {
-    return new PipeEnrichedWritePlanNode((WritePlanNode) PlanNodeType.deserialize(buffer));
+    return new PipeEnrichedWritePlanNode(
+        (WritePlanNode) PlanNodeType.deserialize(buffer),

Review Comment:
   Will there be some ignored children sizes..



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/pipe/PipeEnrichedNonWritePlanNode.java:
##########
@@ -141,16 +154,20 @@ public <R, C> R accept(PlanVisitor<R, C> visitor, C context) {
   protected void serializeAttributes(ByteBuffer byteBuffer) {
     PlanNodeType.PIPE_ENRICHED_NON_WRITE.serialize(byteBuffer);
     nonWritePlanNode.serialize(byteBuffer);
+    ReadWriteIOUtils.write(originClusterId, byteBuffer);
   }
 
   @Override
   protected void serializeAttributes(DataOutputStream stream) throws IOException {
     PlanNodeType.PIPE_ENRICHED_NON_WRITE.serialize(stream);
     nonWritePlanNode.serialize(stream);
+    ReadWriteIOUtils.write(originClusterId, stream);
   }
 
   public static PipeEnrichedNonWritePlanNode deserialize(ByteBuffer buffer) {
-    return new PipeEnrichedNonWritePlanNode(PlanNodeType.deserialize(buffer));
+    return new PipeEnrichedNonWritePlanNode(
+        PlanNodeType.deserialize(buffer),

Review Comment:
   What about ignored children size?



-- 
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] Pipe: Double-living Semantic Correction to Forward Events from Cluster A to B by Default Unless They Originate from B [iotdb]

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


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/subtask/connector/PipeConnectorSubtaskManager.java:
##########
@@ -156,6 +160,17 @@ public synchronized String register(
         final PipeConnectorSubtaskLifeCycle pipeConnectorSubtaskLifeCycle =
             new PipeConnectorSubtaskLifeCycle(executor, pipeConnectorSubtask, pendingQueue);
         pipeConnectorSubtaskLifeCycleList.add(pipeConnectorSubtaskLifeCycle);
+
+        if (pipeConnector instanceof IoTDBDataNodeSyncConnector) {
+          attributeSortedStringToSinkClusterIdsMap.put(
+              attributeSortedString,
+              ((IoTDBDataNodeSyncConnector) pipeConnector).getEndPointsClusterIds());

Review Comment:
   Better put this in "IoTDBConnector"....



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertBaseStatement.java:
##########
@@ -109,6 +109,8 @@ public abstract class InsertBaseStatement extends Statement implements Accountab
 
   protected long ramBytesUsed = Long.MIN_VALUE;
 
+  protected String originClusterId;

Review Comment:
   Is it used?



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/LoadTsFileStatement.java:
##########
@@ -62,6 +62,7 @@ public class LoadTsFileStatement extends Statement {
   private long tabletConversionThresholdBytes = -1;
   private boolean autoCreateDatabase = true;
   private boolean isGeneratedByPipe = false;
+  private String originClusterId;

Review Comment:
   Is it used?



##########
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/extractor/IoTDBNonDataRegionExtractor.java:
##########
@@ -284,6 +291,14 @@ protected abstract Optional<PipeWritePlanEvent> trimRealtimeEventByPipePattern(
 
   protected abstract void confineHistoricalEventTransferTypes(final PipeSnapshotEvent event);
 
+  public Set<String> getSinkClusterIds() {

Review Comment:
   May be useless



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/LogicalPlanVisitor.java:
##########
@@ -491,6 +491,7 @@ public PlanNode visitInsertRow(InsertRowStatement insertRowStatement, MPPQueryCo
             insertRowStatement.getValues(),
             insertRowStatement.isNeedInferType());
     insertNode.setFailedMeasurementNumber(insertRowStatement.getFailedMeasurementNumber());
+    insertNode.setOriginClusterId(insertRowStatement.getOriginClusterId());

Review Comment:
   Do we really need this?



-- 
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] Pipe: Double-living Semantic Correction to Forward Events from Cluster A to B by Default Unless They Originate from B [iotdb]

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


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/deletion/PipeDeleteDataNodeEvent.java:
##########
@@ -175,15 +191,19 @@ public boolean mayEventPathsOverlappedWithPattern() {
   @Override
   public ByteBuffer serializeToByteBuffer() {
     final ByteBuffer planBuffer = deleteDataNode.serializeToByteBuffer();
-    final ByteBuffer result = ByteBuffer.allocate(Byte.BYTES + planBuffer.limit());
+    final ByteBuffer result =
+        ByteBuffer.allocate(
+            Byte.BYTES + planBuffer.limit() + computeOriginClusterIdBufferSize(originClusterId));
     ReadWriteIOUtils.write(isGeneratedByPipe, result);
+    ReadWriteIOUtils.write(originClusterId, result);

Review Comment:
   remove



-- 
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] Pipe: Double-living Semantic Correction to Forward Events from Cluster A to B by Default Unless They Originate from B [iotdb]

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


##########
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/StateMachineProcedure.java:
##########
@@ -291,6 +305,17 @@ public void deserialize(ByteBuffer byteBuffer) {
       }
     }
     this.setStateDeserialized(true);
+    if (byteBuffer.hasRemaining()) {
+      boolean hasClusterId = byteBuffer.get() != 0;
+      if (hasClusterId) {
+        int strLength = byteBuffer.getShort();
+        byte[] bytes = new byte[strLength];
+        byteBuffer.get(bytes);
+        originClusterId = new String(bytes);
+      } else {
+        originClusterId = null;
+      }
+    }

Review Comment:
   Check and add some UTs



-- 
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] Pipe: Double-living Semantic Correction to Forward Events from Cluster A to B by Default Unless They Originate from B [iotdb]

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


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessor.java:
##########
@@ -577,6 +597,16 @@ public void insertTablet(
     if (!insertTabletNode.isGeneratedByPipe()) {
       workMemTable.markAsNotGeneratedByPipe();
     }
+    final String originClusterId =
+        insertTabletNode.getOriginClusterId() == null
+            ? config.getClusterId()
+            : insertTabletNode.getOriginClusterId();
+    if (Objects.isNull(workMemTable.getCurrentOriginClusterId())) {
+      workMemTable.setCurrentOriginClusterId(originClusterId);
+    } else if (!Objects.equals(originClusterId, workMemTable.getCurrentOriginClusterId())) {

Review Comment:
   Make a static final cache map in the receiver and get the id string from the map
   
   map <id, id> putIfAbsent



-- 
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] Pipe: Double-living Semantic Correction to Forward Events from Cluster A to B by Default Unless They Originate from B [iotdb]

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


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessor.java:
##########
@@ -577,6 +597,16 @@ public void insertTablet(
     if (!insertTabletNode.isGeneratedByPipe()) {
       workMemTable.markAsNotGeneratedByPipe();
     }
+    final String originClusterId =
+        insertTabletNode.getOriginClusterId() == null
+            ? config.getClusterId()
+            : insertTabletNode.getOriginClusterId();
+    if (Objects.isNull(workMemTable.getCurrentOriginClusterId())) {
+      workMemTable.setCurrentOriginClusterId(originClusterId);
+    } else if (!Objects.equals(originClusterId, workMemTable.getCurrentOriginClusterId())) {

Review Comment:
   comment here if using the ref comparing 



-- 
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