alpass163 opened a new pull request, #19017:
URL: https://github.com/apache/iotdb/pull/19017
## Description
### Motivation
`root.__system` is maintained by the database itself. In the open-source
version, external clients could write it, delete it, or create it through
SQL. The name was also matched case-insensitively, so `root.__System` was
treated as the same internal database even though tree-model paths are
case-sensitive.
This PR makes the exact lower-case name reserved and restricts its writes
to
dedicated internal writers. Names that differ only in case are ordinary
databases and stay fully usable.
### Changes
- **Internal database identification**: add `InternalDatabaseUtils` to
identify `root.__system` and the audit databases. Matching is
case-sensitive and includes descendants (`root.__system.x`).
- **Internal caller flag**: add `SessionInfo.internal`,
`IAuditEntity.isInternal()` and `TreeAccessCheckContext.internal`. Only
the internal metric reporter (`IoTDBInternalLocalReporter`) and the
internal insert RPC (`DataNodeInternalRPCServiceImpl.insertRecord`) set
it. `AutoCreateSchemaExecutor` now passes the query context instead of a
bare `UserEntity`, so the flag survives automatic schema creation.
- **Write guard**: add `TreeAccessCheckVisitor.checkSystemDatabaseWrite`.
It is applied to inserts, timeseries DDL, template statements, TTL,
logical view targets and sources, and centrally in
`checkTimeSeriesPermission`.
- **View rewrite**: `AnalyzeUtils` and the delete analysis re-check the
real
device paths after a writable view is rewritten, so a view created before
this restriction cannot write `root.__system`.
- **LOAD path**: `AccessControlImpl.checkFullPathWriteDataPermission`
applies
the same guard.
- **Database DDL**: `visitSetDatabase` rejects creating `root.__system`
(and
its descendants) through SQL; `visitAlterDatabase` and
`visitDeleteDatabase` already rejected altering and deleting it.
- **Case-sensitive audit matching**: `Audit` helpers and the direct
`equalsIgnoreCase` comparisons in `AccessControlImpl`,
`ITableAuthCheckerImpl`, `ClusterConfigTaskExecutor`, `ConfigManager`,
`PartitionInfo` and `SubscriptionInfo` now use `equals`.
- **Example and documentation**: the statistics trigger example writes to
`root.statistics` instead of `root.__system.statistics`, and
`iotdb-system.properties.template` states that the IOTDB session metric
reporter is not supported because its writes are rejected.
--
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]