luoluoyuyu commented on PR #19128:
URL: https://github.com/apache/iotdb/pull/19128#issuecomment-6656287131

   Database auto-creation is still not covered by the policy.
   
   Table LOAD: LoadTsFileTableSchemaCache.createTableAndDatabaseIfNecessary() 
(L322) calls autoCreateTableDatabaseIfAbsent() whenever needToCreateDatabase, 
and that method (L353) only checks the global config — neither 
allowAutoCreateSchema nor the session flag. With global enabled + 
'auto-create-schema'='false' (or enableAutoCreateSchema=false) + a missing 
database, LOAD still runs CREATE DATABASE, then fails table validation, leaving 
an empty database behind.
   Tree LOAD: TreeSchemaAutoCreatorAndVerifier.autoCreateDatabase() (L276) runs 
whenever isAutoCreateDatabase, which defaults to the global config and ignores 
both the request attribute and the session flag.
   Async load: ActiveLoadTsFileLoader.loadTsFile() sets autoCreateDatabase from 
the global config as well.
   LoadTsFileAnalyzer.isAutoCreateSchemaEnabled (L152) is still global && 
request, so the session flag never reaches the autoCreateDatabase decision. 
Suggest computing one effective policy (global && request && session) in the 
analyzer and using it for database/table/column creation, and throwing a clear 
"database does not exist, auto-create-schema disabled" error instead of 
creating it. Current tests all set setAutoCreateDatabase(false) and the IT 
pre-creates the database, so this path is untested.
   
   Smaller points:
   
   TableHeaderSchemaValidator dereferences context.getSession() unconditionally 
(L126), while SchemaValidator.isAutoCreateSchemaAllowed is null-safe — please 
make them consistent.
   NormalSchemaFetcher/TemplateSchemaFetcher are shared with ordinary tree 
INSERT, so sessions with the flag off now also stop auto-creating on 
INSERT/template extension. Possibly intended, but the PR description says 
existing INSERT behavior is kept — worth clarifying (including the 
partial-insert case).
   root.__system/root.__audit still bypass the global config but are blocked by 
the session flag; please confirm the intended semantics.
   With verify=false + creation disabled, a valid tree TsFile still loads 
successfully without schema (data invisible); only the fallback path is covered 
by the IT. Worth deciding/documenting.


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