@@ -388,31 +388,28 @@ public Map<Integer, Long> countTimeSeriesNumBySchemaRegion(final List<Integer> s
388388 && SchemaRegionConsensusImpl .getInstance ().isLeader (entry .getKey ()))
389389 .forEach (
390390 entry ->
391- timeSeriesNum .put (
392- entry .getKey ().getId (),
393- entry .getValue ().getSchemaRegionStatistics ().getSeriesNumber (false )
394- + entry
395- .getValue ()
396- .getSchemaRegionStatistics ()
397- .getTable2DevicesNumMap ()
398- .entrySet ()
399- .stream ()
400- .map (
401- tableEntry -> {
402- final TsTable table =
403- DataNodeTableCache .getInstance ()
404- .getTable (
405- PathUtils .unQualifyDatabaseName (
406- entry .getValue ().getDatabaseFullPath ()),
407- tableEntry .getKey ());
408- return Objects .nonNull (table )
409- ? table .getMeasurementNum () * tableEntry .getValue ()
410- : 0 ;
411- })
412- .reduce (0L , Long ::sum )));
391+ timeSeriesNum .put (entry .getKey ().getId (), getTimeSeriesNumber (entry .getValue ())));
413392 return timeSeriesNum ;
414393 }
415394
395+ // not including view number
396+ private long getTimeSeriesNumber (ISchemaRegion schemaRegion ) {
397+ return schemaRegion .getSchemaRegionStatistics ().getSeriesNumber (false )
398+ + schemaRegion .getSchemaRegionStatistics ().getTable2DevicesNumMap ().entrySet ().stream ()
399+ .map (
400+ tableEntry -> {
401+ final TsTable table =
402+ DataNodeTableCache .getInstance ()
403+ .getTable (
404+ PathUtils .unQualifyDatabaseName (schemaRegion .getDatabaseFullPath ()),
405+ tableEntry .getKey ());
406+ return Objects .nonNull (table )
407+ ? table .getMeasurementNum () * tableEntry .getValue ()
408+ : 0 ;
409+ })
410+ .reduce (0L , Long ::sum );
411+ }
412+
416413 /**
417414 * Update total count in schema quota manager and generate local count map response. If limit is
418415 * not -1 and deviceNumMap/timeSeriesNumMap is null, fill deviceNumMap/timeSeriesNumMap of the
@@ -459,9 +456,7 @@ public void updateAndFillSchemaCountMap(TDataNodeHeartbeatReq req, TDataNodeHear
459456 tmp .put (
460457 consensusGroupId .getId (),
461458 Optional .ofNullable (schemaRegionMap .get (consensusGroupId ))
462- .map (
463- schemaRegion ->
464- schemaRegion .getSchemaRegionStatistics ().getSeriesNumber (false ))
459+ .map (this ::getTimeSeriesNumber )
465460 .orElse (0L )));
466461 }
467462 }
0 commit comments