Caideyipi commented on code in PR #18663:
URL: https://github.com/apache/iotdb/pull/18663#discussion_r4033082977
##########
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/balancer/RegionBalancer.java:
##########
@@ -118,6 +130,14 @@ public CreateRegionGroupsPlan
genRegionGroupsAllocationPlan(
final int allotment = entry.getValue();
final int replicationFactor =
getClusterSchemaManager().getReplicationFactor(database,
consensusGroupType);
+ final Integer requestPreferredDataNode =
+ preferredDataNodeMap == null ? null :
preferredDataNodeMap.get(database);
+ final int preferredDataNodeId =
+ TConsensusGroupType.DataRegion.equals(consensusGroupType)
+ ? (requestPreferredDataNode != null
+ ? requestPreferredDataNode
+ : getPreferredDataNodeId(database))
Review Comment:
[P1] 不要把一次 LOAD 的节点偏好永久落到数据库 schema
当请求没有 hint 时,这里会回退到数据库 schema 中持久化的 `preferredDataNodeId`。这个字段没有清理入口,因此数据库由
LOAD 创建后,后续普通 INSERT、修复任务等触发的 DataRegion 扩容也会一直偏向最初的 DataNode。即使热加载
`load_tsfile_prefer_local_node=false`,`PartitionManager` 传入的仍是空 map,这里依然会
fallback;RF=1 时后续 Region 甚至可能持续集中到同一节点。建议让 hint 保持请求级,或在首次消费后清除。
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/ClusterPartitionFetcher.java:
##########
@@ -319,6 +319,14 @@ public DataPartition getOrCreateDataPartition(
@Override
public DataPartition getOrCreateDataPartition(
final List<DataPartitionQueryParam> dataPartitionQueryParams, final
String userName) {
+ return getOrCreateDataPartition(dataPartitionQueryParams, userName, -1);
Review Comment:
[P2] Tablet conversion 路径会丢失 preferred DataNode hint
这里把原有二参数接口固定转成 `preferredDataNodeId=-1`,但小 TsFile 会在正常 schema 分析前直接转换成
InsertTablet,类型不匹配转换也使用普通 INSERT 分析接口。这些路径最终调用的正是二参数 overload,因此即使 LOAD 创建了数据库或
DataRegion,也不会优先本机。需要将 preferred ID 继续传入转换后的 tree/table insert 分区请求。
##########
iotdb-protocol/thrift-confignode/src/main/thrift/confignode.thrift:
##########
@@ -241,6 +241,7 @@ struct TDatabaseSchema {
10: optional i64 timePartitionOrigin
11: optional bool isTableModel
12: optional bool needLastCache
+ 13: optional i32 preferredDataNodeId
Review Comment:
[P2] 不要让集群本地 DataNodeId 随数据库 schema 经 Pipe 传播
`TDatabaseSchema` 会随 CreateDatabase plan 通过 ConfigRegion Pipe
发送到下游。接收端会替换复制因子、时间分区等发送端本地配置,却没有清除这个字段。DataNodeId 是集群本地标识;目标集群若存在同编号节点,后续
DataRegion 会错误偏向该节点,而且目标端关闭 `load_tsfile_prefer_local_node` 也无法阻止 schema
fallback。若保留该字段,Pipe receiver 至少应调用 `unsetPreferredDataNodeId()`。
--
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]