Caideyipi opened a new pull request, #18861: URL: https://github.com/apache/iotdb/pull/18861
## Description Schema mutations can leave alias indexes and statistics inconsistent. Deleting wide devices also repeatedly scans their children, and repeated table-device creation/deletion retains every historical attribute slot. - Validate aliases against other aliases and measurement names in an aligned batch before changing the tree, in both Memory and PBTree modes. Preserve aliases equal to their own measurement name and reject conflicting merge batches before mutation. - Keep matched-device counts on blacklist retries, while decrementing device statistics only on the first state transition. - Maintain direct measurement and non-view measurement child counts to avoid a child scan for each deleted measurement. Snapshot loading rebuilds the counters; nested devices, templates, and view-only alignment cleanup retain their behavior. The extra 8 bytes per internal node are included in memory estimates. - Account table attribute memory using value-size changes, independently of the full map-entry changes used by region memory accounting. - Reuse deleted attribute slots using a bitmap, including after snapshot recovery. Live pointers and the snapshot format are unchanged; retained list references and allocated bitmap storage are accounted for, and store operations use the same monitor. ## Validation - 191 tests passed across `DeviceAttributeStoreTest`, `DeviceBlackListConstructorTest`, `MTreeBelowSGMemoryImplTest`, `SchemaRegionAliasAndTagTest`, `SchemaRegionTableDeviceTest`, `SchemaStatisticsTest`, `SchemaRegionBasicTest`, `SchemaRegionTemplateTest`, and `MNodeTest`. Selected test sources and helpers were compiled separately against fresh reactor output and run through JUnitCore, with one JVM per test class as configured by Surefire. - `mvn -nsu package -pl distribution -am -Dmaven.test.skip=true`: all 39 modules passed. The all-in-one and Edge distribution server jars match the fresh DataNode jar by SHA-256 and contain all six modified production classes. - `mvn spotless:apply -pl iotdb-core/datanode` and the reactor's Checkstyle/Spotless checks passed. - `mvn -nsu test-compile -Dmaven.test.skip=true -P with-zh-locale`: all 53 reactor modules passed. The usual Maven test invocation is blocked by an unchanged master test, `AlignedWritableMemChunkTest`, which still calls `AlignedWritableMemChunk(List<IMeasurementSchema>, boolean)` at four sites although that constructor no longer exists. Packaging therefore skips test compilation; the 191 selected tests were compiled and run separately as described above. The original reproduction harness, with changed production classes freshly compiled, reports: - Repeated predelete: device count remains 0; rollback restores 1. - Clearing an attribute: table attribute memory returns to 0. - 100,000 empty-attribute create/delete cycles: 1 retained slot, 12 accounted bytes, and an 8-byte snapshot (previously 100,000 slots and a 400,004-byte snapshot). - Deleting 64,000 aligned measurements in blacklist traversal order: about 19 ms in this local run (previously 5–8 seconds). This is a local reproduction benchmark, not a cluster throughput measurement. - [x] Self-reviewed. - [x] Added regression tests for alias conflicts, retries/rollback, attribute accounting/reuse, snapshot recovery, nested-device cleanup, view-only cleanup, and deletion without repeated child scans. -- 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]
