@@ -155,6 +155,7 @@ type resourceEstimateFactor struct {
155155 tempSegmentIndexFactor float64
156156 deltaDataExpansionFactor float64
157157 jsonKeyStatsExpansionFactor float64
158+ textIndexExpansionFactor float64
158159 TieredEvictionEnabled bool
159160 TieredEvictableMemoryCacheRatio float64
160161 TieredEvictableDiskCacheRatio float64
@@ -1497,6 +1498,7 @@ func (loader *segmentLoader) checkLogicalSegmentSize(ctx context.Context, segmen
14971498 // so we need to estimate the final resource usage of the segments
14981499 finalFactor := resourceEstimateFactor {
14991500 deltaDataExpansionFactor : paramtable .Get ().QueryNodeCfg .DeltaDataExpansionRate .GetAsFloat (),
1501+ textIndexExpansionFactor : paramtable .Get ().QueryNodeCfg .TextIndexExpansionFactor .GetAsFloat (),
15001502 TieredEvictionEnabled : paramtable .Get ().QueryNodeCfg .TieredEvictionEnabled .GetAsBool (),
15011503 TieredEvictableMemoryCacheRatio : paramtable .Get ().QueryNodeCfg .TieredEvictableMemoryCacheRatio .GetAsFloat (),
15021504 TieredEvictableDiskCacheRatio : paramtable .Get ().QueryNodeCfg .TieredEvictableDiskCacheRatio .GetAsFloat (),
@@ -1580,6 +1582,7 @@ func (loader *segmentLoader) checkSegmentSize(ctx context.Context, segmentLoadIn
15801582 tempSegmentIndexFactor : paramtable .Get ().QueryNodeCfg .InterimIndexMemExpandRate .GetAsFloat (),
15811583 deltaDataExpansionFactor : paramtable .Get ().QueryNodeCfg .DeltaDataExpansionRate .GetAsFloat (),
15821584 jsonKeyStatsExpansionFactor : paramtable .Get ().QueryNodeCfg .JSONKeyStatsExpansionFactor .GetAsFloat (),
1585+ textIndexExpansionFactor : paramtable .Get ().QueryNodeCfg .TextIndexExpansionFactor .GetAsFloat (),
15831586 TieredEvictionEnabled : paramtable .Get ().QueryNodeCfg .TieredEvictionEnabled .GetAsBool (),
15841587 }
15851588 maxSegmentSize := uint64 (0 )
@@ -1841,6 +1844,18 @@ func estimateLogicalResourceUsageOfSegment(schema *schemapb.CollectionSchema, lo
18411844 segmentInevictableMemorySize += uint64 (float64 (memSize ) * expansionFactor )
18421845 }
18431846
1847+ // PART 5: calculate logical resource usage of text index stats data
1848+ // Text match indexes are evictable (support_eviction=true in caching layer).
1849+ // Text match index mmap is driven by scalar_field_enable_mmap (same as raw scalar data).
1850+ textIndexMmapEnable := paramtable .Get ().QueryNodeCfg .MmapScalarField .GetAsBool ()
1851+ for _ , textStats := range loadInfo .GetTextStatsLogs () {
1852+ if textIndexMmapEnable {
1853+ segmentEvictableDiskSize += uint64 (float64 (textStats .GetMemorySize ()) * multiplyFactor .textIndexExpansionFactor )
1854+ } else {
1855+ segmentEvictableMemorySize += uint64 (float64 (textStats .GetMemorySize ()) * multiplyFactor .textIndexExpansionFactor )
1856+ }
1857+ }
1858+
18441859 log .Debug ("estimate logical resoure usage result" ,
18451860 zap .Int64 ("segmentID" , loadInfo .GetSegmentID ()),
18461861 zap .Uint64 ("segmentInevictableMemorySize" , segmentInevictableMemorySize ),
@@ -2084,6 +2099,25 @@ func estimateLoadingResourceUsageOfSegment(schema *schemapb.CollectionSchema, lo
20842099 structArrayOffsetsSize += 4 * rowCount + 4 * rowCount * 10
20852100 }
20862101
2102+ // PART 7: calculate size of text index stats data
2103+ // text index data is managed by the caching layer when tiered eviction is enabled,
2104+ // so it only needs to be included when tiered eviction is disabled.
2105+ // Text match index mmap is driven by scalar_field_enable_mmap (same as raw scalar data).
2106+ // memory_size = sum of Tantivy index file sizes (same value as C++ ByteSize() after load),
2107+ // so 1.0x is the baseline; textIndexExpansionFactor allows tuning if needed.
2108+ textIndexMmapEnable := paramtable .Get ().QueryNodeCfg .MmapScalarField .GetAsBool ()
2109+ for _ , textStats := range loadInfo .GetTextStatsLogs () {
2110+ if textIndexMmapEnable {
2111+ if ! multiplyFactor .TieredEvictionEnabled {
2112+ segDiskLoadingSize += uint64 (float64 (textStats .GetMemorySize ()) * multiplyFactor .textIndexExpansionFactor )
2113+ }
2114+ } else {
2115+ if ! multiplyFactor .TieredEvictionEnabled {
2116+ segMemoryLoadingSize += uint64 (float64 (textStats .GetMemorySize ()) * multiplyFactor .textIndexExpansionFactor )
2117+ }
2118+ }
2119+ }
2120+
20872121 return & ResourceUsage {
20882122 MemorySize : segMemoryLoadingSize + indexMemorySize + structArrayOffsetsSize ,
20892123 DiskSize : segDiskLoadingSize ,
0 commit comments