This is an automated email from the ASF dual-hosted git repository. shuwenwei pushed a commit to branch removeIsTableModelMethod in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit e7828521ccfbd2076100cfec6cd3397dac495038 Author: shuwenwei <[email protected]> AuthorDate: Fri Oct 9 09:38:01 2026 +0800 [Storage] Replace IDeviceID.isTableModel with context checks --- .../execution/fragment/FragmentInstanceContext.java | 4 +--- .../iotdb/db/queryengine/execution/fragment/QueryContext.java | 11 ++++++++--- .../readchunk/ReadChunkAlignedSeriesCompactionExecutor.java | 3 ++- .../wal/recover/file/UnsealedTsFileRecoverPerformer.java | 7 +++++-- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/FragmentInstanceContext.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/FragmentInstanceContext.java index c76b15b0f0f..b7060be8cbc 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/FragmentInstanceContext.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/FragmentInstanceContext.java @@ -490,9 +490,7 @@ public class FragmentInstanceContext extends QueryContext { getQueryModificationLoader( tsFileResource, modification -> - deviceID.isTableModel() - ? modification.affects(deviceID) - : modification.affectsAll(deviceID), + isTableModel() ? modification.affects(deviceID) : modification.affectsAll(deviceID), mods -> getPathModifications(mods, deviceID))) { return modificationLoader.getPathModifications(); } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/QueryContext.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/QueryContext.java index a9cea56e96e..1bd5f70081f 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/QueryContext.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/QueryContext.java @@ -145,7 +145,7 @@ public class QueryContext { } protected boolean shouldSkipModification(ModEntry modification) { - if (tables != null && modification instanceof TableDeletionEntry) { + if (isTableModel() && modification instanceof TableDeletionEntry) { String tableName = ((TableDeletionEntry) modification).getTableName(); return !tables.contains(tableName); } @@ -170,7 +170,7 @@ public class QueryContext { return Collections.emptyList(); } List<ModEntry> modEntries = fileModEntries.getOverlapped(deviceID, measurement); - if (deviceID.isTableModel()) { + if (isTableModel()) { // the pattern tree has false-positive for table model deletion, so we do a further // filtering modEntries = @@ -200,7 +200,7 @@ public class QueryContext { } List<ModEntry> modEntries = fileModEntries.getOverlapped(deviceID, AlignedPath.VECTOR_PLACEHOLDER); - if (deviceID.isTableModel()) { + if (isTableModel()) { // the pattern tree has false-positive for table model deletion, so we do a further // filtering modEntries = @@ -274,6 +274,11 @@ public class QueryContext { return ignoreAllNullRows; } + // ignoreAllNullRows is true only for tree-model queries. + public boolean isTableModel() { + return !ignoreAllNullRows; + } + public void setIgnoreAllNullRows(boolean ignoreAllNullRows) { this.ignoreAllNullRows = ignoreAllNullRows; } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/executor/readchunk/ReadChunkAlignedSeriesCompactionExecutor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/executor/readchunk/ReadChunkAlignedSeriesCompactionExecutor.java index 947a22ae600..90181e111a2 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/executor/readchunk/ReadChunkAlignedSeriesCompactionExecutor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/executor/readchunk/ReadChunkAlignedSeriesCompactionExecutor.java @@ -22,6 +22,7 @@ package org.apache.iotdb.db.storageengine.dataregion.compaction.execute.utils.ex import org.apache.iotdb.commons.schema.table.TsTable; import org.apache.iotdb.commons.schema.table.column.TsTableColumnSchema; import org.apache.iotdb.commons.utils.MetadataUtils; +import org.apache.iotdb.commons.utils.PathUtils; import org.apache.iotdb.db.conf.IoTDBDescriptor; import org.apache.iotdb.db.schemaengine.table.DataNodeTableCache; import org.apache.iotdb.db.storageengine.dataregion.compaction.execute.exception.CompactionLastTimeCheckFailedException; @@ -109,7 +110,7 @@ public class ReadChunkAlignedSeriesCompactionExecutor { this.targetResource = targetResource; this.summary = summary; this.ignoreAllNullRows = ignoreAllNullRows; - if (device.isTableModel()) { + if (PathUtils.isTableModelDatabase(database)) { collectValueColumnSchemaListForTable(database); } else { collectValueColumnSchemaListForTree(); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/recover/file/UnsealedTsFileRecoverPerformer.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/recover/file/UnsealedTsFileRecoverPerformer.java index d8617234190..abce4d0ec03 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/recover/file/UnsealedTsFileRecoverPerformer.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/recover/file/UnsealedTsFileRecoverPerformer.java @@ -21,6 +21,7 @@ package org.apache.iotdb.db.storageengine.dataregion.wal.recover.file; import org.apache.iotdb.commons.path.MeasurementPath; import org.apache.iotdb.commons.schema.table.TsFileTableSchemaUtil; +import org.apache.iotdb.commons.utils.PathUtils; import org.apache.iotdb.db.exception.DataRegionException; import org.apache.iotdb.db.i18n.StorageEngineMessages; import org.apache.iotdb.db.pipe.agent.PipeDataNodeAgent; @@ -84,6 +85,7 @@ public class UnsealedTsFileRecoverPerformer extends AbstractTsFileRecoverPerform private final WALRecoverListener recoverListener; private final String databaseName; private final String dataRegionId; + private final boolean isTableModel; public UnsealedTsFileRecoverPerformer( TsFileResource tsFileResource, @@ -92,6 +94,7 @@ public class UnsealedTsFileRecoverPerformer extends AbstractTsFileRecoverPerform super(tsFileResource); this.databaseName = tsFileResource.getDatabaseName(); this.dataRegionId = tsFileResource.getDataRegionId(); + this.isTableModel = PathUtils.isTableModelDatabase(databaseName); this.sequence = sequence; this.callbackAfterUnsealedTsFileRecovered = callbackAfterUnsealedTsFileRecovered; this.walRedoer = new TsFilePlanRedoer(tsFileResource); @@ -183,7 +186,7 @@ public class UnsealedTsFileRecoverPerformer extends AbstractTsFileRecoverPerform // delete data already flushed in the MemTable to avoid duplicates for (IDeviceID device : tsFileResource.getDevices()) { // iterating the index, must present - if (device.isTableModel()) { + if (isTableModel) { memTable.delete( new TableDeletionEntry( new DeletionPredicate(device.getTableName(), new FullExactMatch(device)), @@ -200,7 +203,7 @@ public class UnsealedTsFileRecoverPerformer extends AbstractTsFileRecoverPerform } } for (IDeviceID deviceID : memTable.getMemTableMap().keySet()) { - if (deviceID.isTableModel()) { + if (isTableModel) { registerToTsFile(deviceID.getTableName()); } }
