2020package org .apache .iotdb .db .pipe .agent .task .subtask .sink ;
2121
2222import org .apache .iotdb .commons .consensus .DataRegionId ;
23- import org .apache .iotdb .commons .pipe .agent .plugin .builtin .BuiltinPipePlugin ;
2423import org .apache .iotdb .commons .pipe .agent .task .connection .UnboundedBlockingPendingQueue ;
2524import org .apache .iotdb .commons .pipe .agent .task .progress .CommitterKey ;
2625import org .apache .iotdb .commons .pipe .agent .task .progress .PipeEventCommitManager ;
@@ -65,11 +64,10 @@ public synchronized String register(
6564 final Supplier <? extends PipeSinkSubtaskExecutor > executorSupplier ,
6665 final PipeParameters pipeSinkParameters ,
6766 final PipeTaskSinkRuntimeEnvironment environment ) {
67+ final String connectorName =
68+ PipeSinkConstant .getConnectorOrSinkNameWithDefault (pipeSinkParameters );
6869 final String connectorKey =
69- pipeSinkParameters
70- .getStringOrDefault (
71- Arrays .asList (PipeSinkConstant .CONNECTOR_KEY , PipeSinkConstant .SINK_KEY ),
72- BuiltinPipePlugin .IOTDB_THRIFT_CONNECTOR .getPipePluginName ())
70+ connectorName
7371 // Convert the value of `CONNECTOR_KEY` or `SINK_KEY` to lowercase
7472 // for matching in `CONNECTOR_CONSTRUCTORS`
7573 .toLowerCase ();
@@ -87,29 +85,30 @@ public synchronized String register(
8785
8886 final int sinkNum ;
8987 boolean realTimeFirst = false ;
88+ boolean serializeByRegion = false ;
9089 String attributeSortedString = generateAttributeSortedString (pipeSinkParameters );
9190 if (isDataSinkConnector ) {
91+ serializeByRegion = PipeSinkConstant .isSerializeByRegionEnabled (pipeSinkParameters );
9292 sinkNum =
93- pipeSinkParameters .getIntOrDefault (
94- Arrays .asList (
95- PipeSinkConstant .CONNECTOR_IOTDB_PARALLEL_TASKS_KEY ,
96- PipeSinkConstant .SINK_IOTDB_PARALLEL_TASKS_KEY ),
97- PipeSinkConstant .SINGLE_THREAD_DEFAULT_SINK .contains (
98- pipeSinkParameters
99- .getStringOrDefault (
100- Arrays .asList (
101- PipeSinkConstant .CONNECTOR_KEY , PipeSinkConstant .SINK_KEY ),
102- BuiltinPipePlugin .IOTDB_THRIFT_SINK .getPipePluginName ())
103- .toLowerCase ())
104- ? 1
105- : PipeSinkConstant .CONNECTOR_IOTDB_PARALLEL_TASKS_DEFAULT_VALUE );
93+ serializeByRegion
94+ ? 1
95+ : pipeSinkParameters .getIntOrDefault (
96+ Arrays .asList (
97+ PipeSinkConstant .CONNECTOR_IOTDB_PARALLEL_TASKS_KEY ,
98+ PipeSinkConstant .SINK_IOTDB_PARALLEL_TASKS_KEY ),
99+ PipeSinkConstant .SINGLE_THREAD_DEFAULT_SINK .contains (connectorKey )
100+ ? 1
101+ : PipeSinkConstant .CONNECTOR_IOTDB_PARALLEL_TASKS_DEFAULT_VALUE );
106102 realTimeFirst =
107103 pipeSinkParameters .getBooleanOrDefault (
108104 Arrays .asList (
109105 PipeSinkConstant .CONNECTOR_REALTIME_FIRST_KEY ,
110106 PipeSinkConstant .SINK_REALTIME_FIRST_KEY ),
111107 PipeSinkConstant .CONNECTOR_REALTIME_FIRST_DEFAULT_VALUE );
112- attributeSortedString = "data_" + attributeSortedString ;
108+ attributeSortedString =
109+ serializeByRegion
110+ ? "data_region_" + environment .getRegionId () + "_" + attributeSortedString
111+ : "data_" + attributeSortedString ;
113112 } else {
114113 // Do not allow parallel tasks for schema region connectors
115114 // to avoid the potential disorder of the schema region data transfer
0 commit comments