JackieTien97 commented on code in PR #18683:
URL: https://github.com/apache/iotdb/pull/18683#discussion_r4082612307
##########
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/auth/role/LocalFileRoleAccessor.java:
##########
@@ -85,8 +85,34 @@ public class LocalFileRoleAccessor implements
IEntityAccessor {
protected final String entityDirPath;
// It might be a good idea to use a Version number to control upgrade
compatibility.
- // Now it's version 1
- protected static final int VERSION = 2;
+ // Version 3 appends an extra segment region after the RBAC privileges.
+ protected static final int VERSION = 3;
Review Comment:
**[P1] Preserve the legacy profile format for older Pipe receivers**
The default writer now emits V3 even when no extension segment is present,
while auth snapshots are still transferred verbatim using the existing
ConfigSnapshot protocol. If the sender is upgraded before its Pipe receiver,
the receiver's old `CNPhysicalPlanGenerator` consumes the two session fields
only for `tag == 2`, so it misreads V3's default `-1/-1` session limits as
privilege data. An independently compiled pre-PR reader produced 13 extra
`GrantUser` plans, all with grant option, for the same unprivileged user whose
V2 profile produced none. Please retain the complete V2 format when extensions
are unused, or negotiate/transcode the profile format before sending it to an
older receiver.
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/SchemaValidator.java:
##########
@@ -90,28 +96,46 @@ public static void validate(
}
}
- private static Set<QualifiedObjectName> getTargetTables(
- final WrappedInsertStatement insertStatement, final MPPQueryContext
context) {
- final Set<QualifiedObjectName> targetTables = new LinkedHashSet<>();
- if (insertStatement instanceof InsertRows) {
- for (final InsertRowStatement rowStatement :
- ((InsertRows)
insertStatement).getInnerTreeStatement().getInsertRowStatementList()) {
- final String database = AnalyzeUtils.getDatabaseName(rowStatement,
context);
- if (database == null) {
- throw new SemanticException(DATABASE_NOT_SPECIFIED);
- }
- targetTables.add(
- new QualifiedObjectName(unQualifyDatabaseName(database),
rowStatement.getTableName()));
- }
- } else {
- targetTables.add(
+ /**
+ * Resolves the target tables to check. Every row of a pipe batch is
considered, since its rows
+ * may target different tables; rows of any other insert share the same
table, so the first row is
+ * representative.
+ */
+ private static Set<QualifiedObjectName> resolveTargetTables(
+ final WrappedInsertStatement insertStatement,
+ final MPPQueryContext context,
+ final boolean fromPipeBatch) {
+ if (!(insertStatement instanceof InsertRows)) {
+ return Collections.singleton(
new QualifiedObjectName(
unQualifyDatabaseName(insertStatement.getDatabase()),
insertStatement.getTableName()));
}
+
+ final List<InsertRowStatement> rowStatements =
+ ((InsertRows)
insertStatement).getInnerTreeStatement().getInsertRowStatementList();
+ if (!fromPipeBatch) {
+ return rowStatements.isEmpty()
+ ? Collections.emptySet()
+ : Collections.singleton(resolveTargetTable(rowStatements.get(0),
context));
Review Comment:
**[P2] Validate every table in single-request Pipe row plans**
An unmarked `InsertRows` is not necessarily single-table. Pipe batching
before #18577 grouped rows only by database and could create a legitimate
`table1/table2/table1` plan; with `sink.batch.enable=false`, a cascading Pipe
forwards that original InsertNode as one V2 request. The single-request decoder
does not set `fromPipeBatch`, so this branch checks only table1, although
subsequent schema/device validation still processes every row. A probe using
the real serialization and request constructor checked both tables on the merge
base but only table1 here; a normal rejection for table2 was skipped and schema
validation was entered. Please retain all-row target deduplication, or maintain
the invariant through every producer and rebuilder, including single/binary
transfers.
--
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]