Arun Dhingra
09/12/2025, 12:58 PMv3.4.5 in k8s deployment using iceberg catalog for analytics (Shared Data Mode -> CN only). I am facing issues when trying to run regex queries which involve more data scanning. Getting the same spill issue
ERROR 1064 (HY000): Memory of default_wg exceed limit. Pipeline Backend: starrocks-cn-0.starrocks-cn-search.traceable.svc.cluster.local, fragment: a48af6d2-8fad-11f0-b062-5a3646794132 Used: 11748494560, Limit: 11741366844. Mem usage has exceed the limit of query pool: BE:153558
I understand this issue should be solvable using spill and have read the multiple threads on the channel regarding the same but somehow even by enabling the configs spill is not happening. Here are the configs I have set:
mysql> set global enable_spill = true;
Query OK, 0 rows affected (0.00 sec)
mysql> set global spill_mode = 'force';
Query OK, 0 rows affected (0.00 sec)
mysql> set global pipeline_dop = 2;
Query OK, 0 rows affected (0.02 sec)
--trigger early spill
mysql> ALTER RESOURCE GROUP default_wg WITH ( 'spill_mem_limit_threshold' = '20%' );
I have also set the CN conf as follows
spill_local_storage_dir=/opt/starrocks/cn/spill
For the above location I have tried using an emptyDir, PVC and simple node storage as well but still I get the OOM issue.
Any pointers on this?
TIARobert Raharjo
09/12/2025, 9:35 PMBentzi Mor
09/13/2025, 6:53 AMArun Dhingra
09/14/2025, 3:05 PMregexp operatorArun Dhingra
09/14/2025, 3:08 PMSELECT * FROM <table> WHERE (customer_id = 'customer-id') AND ((((regexp(request_body, 'pair')) AND ((start_time_millis_ts >= '2025-09-03 10:14:11') AND (start_time_millis_ts < '2025-09-04 10:14:11'))) ORDER BY 1 DESC, start_time_millis DESC LIMIT 10;
I haven't taken the profile yet, let me see how to do thatArun Dhingra
09/14/2025, 3:08 PMArun Dhingra
09/15/2025, 11:41 AME20250915 07:22:07.462986 140281858823744 scan_operator.cpp:478] scan fragment 82e97e05-9204-11f0-9825-fab1d11951dd driver 4 Scan tasks error: Internal error: FileReader::get_next failed. reason = Memory limit exceeded: Memory of default_mv_wg exceed limit. read and decompress page Backend: starrocks-cn-0.starrocks-cn-search.traceable.svc.cluster.local, Used: 94287230360, Limit: 93930934762. Mem usage has exceed the limit of the resource group [default_mv_wg]. You can change the limit by modifying [mem_limit] of this group
be/src/formats/parquet/column_chunk_reader.cpp:167 CurrentThread::mem_tracker()->check_mem_limit("read and decompress page")
be/src/formats/parquet/column_chunk_reader.cpp:213 _read_and_decompress_page_data(compressed_size, uncompressed_size, true)
be/src/formats/parquet/column_chunk_reader.cpp:152 _parse_data_page()
be/src/formats/parquet/stored_column_reader.cpp:393 _reader->load_page()
be/src/formats/parquet/stored_column_reader.cpp:337 _lazy_skip_values(range.begin())
be/src/formats/parquet/group_reader.cpp:292 _column_readers[slot_id]->read_range(range, filter, (*chunk)->get_column_by_slot_id(slot_id))
be/src/formats/parquet/group_reader.cpp:218 value_or_err_L218, file = s3a://<file_chunk_path>
be/src/connector/hive_connector.cpp:777 _scanner->get_next(state, chunk)
Here its failing roughly at ~90GB. But actual memory consumption of the CN nodes is only ~45GB. Below screenshots confirm itArun Dhingra
09/15/2025, 1:06 PMKevin Cai
09/15/2025, 1:42 PMCurrent memory statistics: in CN.info around the time range, take a look what's the stats looked like.Arun Dhingra
09/15/2025, 1:47 PMI20250915 07:20:14.799925 140286380439104 daemon.cpp:159] Current memory statistics: process(496402040), query_pool(0), load(0), metadata(0), compaction(0), schema_change(0), page_cache(0), update(0), chunk_allocator(0), passthrough(0), clone(0), consistency(0), datacache(0), jit(0)
I20250915 07:20:59.812546 140286380439104 daemon.cpp:159] Current memory statistics: process(496411640), query_pool(0), load(0), metadata(0), compaction(0), schema_change(0), page_cache(0), update(0), chunk_allocator(0), passthrough(0), clone(0), consistency(0), datacache(0), jit(0)
I20250915 07:21:14.816346 140286380439104 daemon.cpp:159] Current memory statistics: process(69770179416), query_pool(69192249208), load(0), metadata(0), compaction(0), schema_change(0), page_cache(0), update(0), chunk_allocator(0), passthrough(0), clone(0), consistency(0), datacache(0), jit(0)
I20250915 07:21:29.821259 140286380439104 daemon.cpp:159] Current memory statistics: process(87371246024), query_pool(86757720008), load(0), metadata(0), compaction(0), schema_change(0), page_cache(0), update(0), chunk_allocator(0), passthrough(0), clone(0), consistency(0), datacache(0), jit(0)
I20250915 07:21:59.828548 140286380439104 daemon.cpp:159] Current memory statistics: process(90052352800), query_pool(89459778120), load(0), metadata(0), compaction(0), schema_change(0), page_cache(0), update(0), chunk_allocator(0), passthrough(0), clone(0), consistency(0), datacache(0), jit(0)
I20250915 07:22:14.832030 140286380439104 daemon.cpp:159] Current memory statistics: process(91319269064), query_pool(90733988896), load(0), metadata(0), compaction(0), schema_change(0), page_cache(0), update(0), chunk_allocator(0), passthrough(0), clone(0), consistency(0), datacache(0), jit(0)
I20250915 07:22:29.835451 140286380439104 daemon.cpp:159] Current memory statistics: process(92744065192), query_pool(92252509728), load(0), metadata(0), compaction(0), schema_change(0), page_cache(0), update(0), chunk_allocator(0), passthrough(0), clone(0), consistency(0), datacache(0), jit(0)Arun Dhingra
09/15/2025, 1:49 PMKevin Cai
09/15/2025, 2:17 PMArun Dhingra
09/15/2025, 2:18 PMArun Dhingra
09/15/2025, 2:23 PMArun Dhingra
09/15/2025, 2:23 PMArun Dhingra
09/15/2025, 2:26 PMcontainer_memory_working_set_bytes (standard memory metric for overall pod memory)Kevin Cai
09/15/2025, 2:27 PMtop -p {cn_pid}Kevin Cai
09/15/2025, 2:27 PMArun Dhingra
09/15/2025, 2:28 PMArun Dhingra
09/15/2025, 2:29 PMKevin Cai
09/15/2025, 2:32 PMArun Dhingra
09/15/2025, 2:33 PMv3.4.5Arun Dhingra
09/15/2025, 2:34 PMKevin Cai
09/15/2025, 2:35 PMArun Dhingra
09/15/2025, 2:37 PMKevin Cai
09/15/2025, 2:45 PMcurl "http://localhost:8040/mem_tracker?upper_level=4&type=query_pool" inside the pod, need to get a detailed stats from the query poolArun Dhingra
09/15/2025, 2:52 PMKevin Cai
09/15/2025, 2:54 PM0427... the query id from fe.logArun Dhingra
09/15/2025, 3:05 PMCREATE MATERIALIZED VIEW IF NOT EXISTS internal_db.<table1> REFRESH DEFERRED MANUAL PROPERTIES ("replication_num" = "1") AS SELECT start_time_millis - (start_time_millis % 900000) AS view_col_0, count(*) AS view_col_1, 'dummy_col' AS dummy_alias
FROM <iceberg_table>
WHERE (customer_id = 'customer') AND ((regexp(request_body, 'paired')) AND ((start_time_millis_ts >= '2025-09-04 07:24:15') AND (start_time_millis_ts < '2025-09-10 07:24:15')))
GROUP BY 1 ORDER BY 1 ASC LIMIT 1000;
CREATE MATERIALIZED VIEW IF NOT EXISTS internal_db.<table2> REFRESH DEFERRED MANUAL PROPERTIES ("replication_num" = "1") AS SELECT view_col_0, view_col_1, view_col_2, view_col_3
FROM <iceberg_table>
WHERE (customer_id = 'customer') AND ((regexp(request_body, 'paired')) AND ((start_time_millis_ts >= '2025-09-04 07:24:15') AND (start_time_millis_ts < '2025-09-10 07:24:15'))) ORDER BY 10 DESC LIMIT 50;Arun Dhingra
09/15/2025, 3:05 PMREFRESH MV WITH SYNC MODE for both the queriesKevin Cai
09/15/2025, 3:09 PMquery_pool from the "Current memory statistics" logline and the mem_tracker http interface, are they about equal at the same timepoint?Arun Dhingra
09/15/2025, 3:10 PMquery_pool log line is higherKevin Cai
09/15/2025, 3:14 PMArun Dhingra
09/15/2025, 3:19 PMCliff Resnick
09/15/2025, 3:23 PMLIKE '%pair%' predicate? I'm wondering if regexp brings in memory overhead or even a possible leak.Arun Dhingra
09/15/2025, 3:28 PMCurrent Memory log > Query pool Stats >> actual memory from top command or container memory
The difference between Current Memory log and Query pool Stats is not a lot but they are quite high compared actual memory
The difference is somewhere between 1.5 to ~2xArun Dhingra
09/15/2025, 3:30 PM@Arun Dhingra just wondering, did you try the same query with a simpleThis particular query is simple and can be replaced withpredicate? I'm wondering ifLIKE '%pair%'brings in memory overhead or even a possible leak.regexp
LIKE but in general there are actual regex queries, using this simple regex here just for testingRobert Raharjo
09/15/2025, 10:04 PMKevin Cai
09/15/2025, 11:16 PMArun Dhingra
09/16/2025, 2:41 AMwill the mem usage dropped when you stopped the two MV async refresh?I am assuming to meant to ask if the memory usage went down after the refresh finished? yes
Kevin Cai
09/16/2025, 2:54 AMArun Dhingra
09/16/2025, 3:12 AMREGEXP operator... when REGEXP is not present it is mostly similar
(in rare scenarios I do see query_pool log showing a high memory but that I guess is transient)Kevin Cai
09/16/2025, 3:21 AMArun Dhingra
09/16/2025, 3:22 AMArun Dhingra
09/16/2025, 3:22 AMREGEXP not very performant in starrocks?Kevin Cai
09/16/2025, 3:35 AMArun Dhingra
09/16/2025, 3:36 AMArun Dhingra
09/18/2025, 8:33 AMArun Dhingra
09/18/2025, 8:34 AM