Caideyipi commented on code in PR #19053:
URL: https://github.com/apache/iotdb/pull/19053#discussion_r4441207367


##########
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/pipe/PipeTaskInfo.java:
##########
@@ -422,6 +429,17 @@ private void checkBeforeStartPipeInternal(final String 
pipeName, final boolean i
     }
   }
 
+  private void checkPipeDataInsertionAvailability(final PipeStaticMeta 
staticMeta) {
+    // Procedures call these validators while holding the coordinator lock. 
Recheck the merged
+    // source parameters here because concurrent ALTER requests can change the 
RPC-time snapshot.
+    if 
(!staticMeta.getPipeName().startsWith(PipeStaticMeta.CONSENSUS_PIPE_PREFIX)
+        && 
!PipeConfigNodeAgent.isPipeDataInsertionEnabled(staticMeta.getSourceParameters()))
 {

Review Comment:
   Agreed. IoTConsensusV2 and Ratis are mutually exclusive, so the 
consensus-Pipe-prefix exemption is redundant. It was removed in `7936b04`, 
along with the matching exemptions at the other admission and recovery checks. 
The merged branch retains that change.



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/thrift/IoTDBDataNodeReceiver.java:
##########
@@ -534,6 +539,34 @@ private TPipeTransferResp handleTransferTabletInsertNode(
             : executeStatementAndAddRedirectInfo(statement));
   }
 
+  private static TPipeTransferResp pipeDataInsertionDisabledResponse() {
+    return new TPipeTransferResp(
+        RpcUtils.getStatus(
+            TSStatusCode.UNSUPPORTED_OPERATION,
+            PipeMessages
+                
.MESSAGE_PIPE_DATA_INSERTION_IS_DISABLED_WHEN_DATA_REGION_CONSENSUS_PROTOCOL_IS_RATIS_7D669ECC));
+  }
+
+  private static boolean isDataInsertionRequest(final PipeRequestType 
requestType) {
+    switch (requestType) {
+      case TRANSFER_TABLET_INSERT_NODE:
+      case TRANSFER_TABLET_INSERT_NODE_V2:
+      case TRANSFER_TABLET_RAW:
+      case TRANSFER_TABLET_RAW_V2:
+      case TRANSFER_TABLET_BINARY:
+      case TRANSFER_TABLET_BINARY_V2:
+      case TRANSFER_TABLET_BATCH:
+      case TRANSFER_TABLET_BATCH_V2:
+      case TRANSFER_TS_FILE_PIECE:
+      case TRANSFER_TS_FILE_SEAL:
+      case TRANSFER_TS_FILE_PIECE_WITH_MOD:
+      case TRANSFER_TS_FILE_SEAL_WITH_MOD:
+        return true;
+      default:
+        return false;
+    }
+  }

Review Comment:
   Applied in `35f1f0cd863`. `isDataInsertionRequest` now uses an exhaustive 
switch expression with no `default`. All 25 current enum values are classified 
explicitly, and future enum additions will require an explicit classification 
at compile time.



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/subscription/agent/SubscriptionReceiverAgent.java:
##########
@@ -90,8 +101,11 @@ public class SubscriptionReceiverAgent {
   SubscriptionReceiverAgent() {
     this(
         SubscriptionReceiverV1::new,
-        SubscriptionConfig.getInstance().getSubscriptionEnabled(),
-        () -> SubscriptionConfig.getInstance().getSubscriptionEnabled());
+        SubscriptionConfig.getInstance().getSubscriptionEnabled()
+            && PipeDataNodeAgent.isSubscriptionFeatureEnabled(),

Review Comment:
   Applied in `35f1f0cd863`. The constructor now uses one 
`isSubscriptionEnabled()` helper for both timeout-checker scheduling and the 
dynamic subscription-enabled supplier, combining the configuration flag and the 
Ratis feature check.



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