Caideyipi commented on code in PR #18874:
URL: https://github.com/apache/iotdb/pull/18874#discussion_r4312938247
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/table/DataNodeTableCache.java:
##########
@@ -142,12 +152,40 @@ public void init(final byte[] tableInitializationBytes) {
table -> new Pair<>(table, 0L),
(v1, v2) -> v2,
ConcurrentHashMap::new))));
+ treeToTableViewCache.init(collectInitialViews(usingMap));
Review Comment:
**[P2] Restore the auto-sync index when a dropped view is recovered after
rollback**
This rebuild registers only USING views. If a DataNode starts or recovers
its metadata lease while an auto-sync view is in PRE_DELETE, the ConfigNode
initialization response puts that view only in `specialStatusMap` as a
`PreDeleteTsTable`, so it correctly has no index entry here. However, if DROP
VIEW subsequently fails, `DropTableProcedure.rollbackState(PRE_DELETE)` only
restores the ConfigNode status. A later table lookup recovers the USING
definition through `updateDeleteTable`, which updates `databaseTableMap` but
never registers the recovered view in `treeToTableViewCache`. The view becomes
queryable again, yet new measurements on this DataNode no longer trigger column
additions until another full cache rebuild.
Reproduced against this head at the cache level: initialize with an empty
USING map and a PRE_DELETE placeholder for `v`; pass the restored auto-sync
definition through `updateDeleteTable`; `getTable` returns `v`, but
`getTreeToTableViews` still returns an empty set for a covered device. Please
synchronize the index when fetch repair restores a view, or explicitly
propagate the restored registration on DROP VIEW rollback, and cover this
recovery sequence in a regression test.
--
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]