diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/SchemaEngine.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/SchemaEngine.java index 76958eaf1d23..4f73a8707c17 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/SchemaEngine.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/SchemaEngine.java @@ -388,31 +388,28 @@ public Map countTimeSeriesNumBySchemaRegion(final List s && SchemaRegionConsensusImpl.getInstance().isLeader(entry.getKey())) .forEach( entry -> - timeSeriesNum.put( - entry.getKey().getId(), - entry.getValue().getSchemaRegionStatistics().getSeriesNumber(false) - + entry - .getValue() - .getSchemaRegionStatistics() - .getTable2DevicesNumMap() - .entrySet() - .stream() - .map( - tableEntry -> { - final TsTable table = - DataNodeTableCache.getInstance() - .getTable( - PathUtils.unQualifyDatabaseName( - entry.getValue().getDatabaseFullPath()), - tableEntry.getKey()); - return Objects.nonNull(table) - ? table.getMeasurementNum() * tableEntry.getValue() - : 0; - }) - .reduce(0L, Long::sum))); + timeSeriesNum.put(entry.getKey().getId(), getTimeSeriesNumber(entry.getValue()))); return timeSeriesNum; } + // not including view number + private long getTimeSeriesNumber(ISchemaRegion schemaRegion) { + return schemaRegion.getSchemaRegionStatistics().getSeriesNumber(false) + + schemaRegion.getSchemaRegionStatistics().getTable2DevicesNumMap().entrySet().stream() + .map( + tableEntry -> { + final TsTable table = + DataNodeTableCache.getInstance() + .getTable( + PathUtils.unQualifyDatabaseName(schemaRegion.getDatabaseFullPath()), + tableEntry.getKey()); + return Objects.nonNull(table) + ? table.getMeasurementNum() * tableEntry.getValue() + : 0; + }) + .reduce(0L, Long::sum); + } + /** * Update total count in schema quota manager and generate local count map response. If limit is * not -1 and deviceNumMap/timeSeriesNumMap is null, fill deviceNumMap/timeSeriesNumMap of the @@ -459,9 +456,7 @@ public void updateAndFillSchemaCountMap(TDataNodeHeartbeatReq req, TDataNodeHear tmp.put( consensusGroupId.getId(), Optional.ofNullable(schemaRegionMap.get(consensusGroupId)) - .map( - schemaRegion -> - schemaRegion.getSchemaRegionStatistics().getSeriesNumber(false)) + .map(this::getTimeSeriesNumber) .orElse(0L))); } }