Kenneth Oh
09/07/2026, 5:47 PMRocky
09/07/2026, 5:47 PMSHOW BACKENDS (look at TabletNum and DataUsedCapacity) or SHOW PROC '/cluster_balance/tablet_migration_history'.
* Resource Isolation: If you want specific materialized views to stay on a subset of BE nodes, you can use BE Labels (available in v3.2.8+) to restrict their distribution, though the default behavior is to balance across all available nodes.
References
• deployment/deploy_manually.md
• introduction/Architecture.md
• sql-reference/sql-statements/cluster-management/nodes_processes/SHOW_COMPUTE_NODES.mdKenneth Oh
09/07/2026, 7:16 PMRocky
09/07/2026, 7:17 PMcurated_channel), StarRocks can distribute the task of scanning metadata (reading manifest files and calculating splits) across the Backend (BE) or Compute (CN) nodes to speed up the planning phase.
* The Pool Limit: Each BE node has a dedicated thread pool for these "metadata collection jobs." By default, this pool is capped at 5 concurrent jobs per node.
* The Failure Pattern: In production environments, if you have multiple concurrent Iceberg queries, automated recommendations, or search jobs happening at once, they can easily exceed this limit of 5. When the burst occurs, additional requests are either rejected immediately (often with the null variant of the error) or block until they hit the query_timeout, leading to the intermittent failures you observed.
How to Configure for It
You can resolve this by increasing the concurrency limit in the BE configuration or by changing how planning is handled.
1. Increase Backend Concurrency (Recommended)
Increase the number of concurrent metadata collection jobs allowed on each BE node by adding or updating this parameter in your be.conf file:
properties
# Add to be.conf on all BE/CN nodes
metadata_collect_concurrency = 64
Default is 5. Increasing this to a higher value (e.g., 32 or 64) allows the nodes to handle more concurrent metadata tasks during query bursts.
Note: You must restart the BE/CN for this change to take effect.
2. Switch to Local Planning (Alternative)
If your Iceberg table metadata is not extremely large, you can force the Frontend (FE) to handle all metadata planning locally, bypassing the backend thread pool entirely. You can set this as a session variable:
sql
SET plan_mode = 'local';
This avoids the BE concurrency limit but places more memory and CPU load on the FE during the planning phase. It is generally better to stick with distributed planning and just increase the BE concurrency.
Summary
The root cause is a hard-coded or default low limit (5) on the backend's metadata processing threads. Updating metadata_collect_concurrency in the BE configuration is the standard fix for high-concurrency data lakehouse workloads.
References
• administration/management/BE_configuration.md
• administration/management/FE_configuration.md
• administration/management/monitoring/metrics.mdKenneth Oh
09/07/2026, 7:18 PMRocky
09/07/2026, 7:18 PMmetadata-collection job on the BE nodes.
* Result: You bypass the metadata_collect_concurrency limit entirely for these queries.
2. During the Consistency Check (Loose Consistency)
To decide whether to use the MV, StarRocks must check if the base table has changed.
* Strong Consistency: StarRocks checks the remote Iceberg catalog for the latest snapshot ID. This is typically a lightweight Frontend (FE) operation, not a distributed BE metadata job.
* Loose Consistency (mv_rewrite_staleness_second): If you set this property, StarRocks compares the last refresh time of the MV with its cached knowledge of the base table. This is even more lightweight and occurs entirely within the FE's metadata memory.
* Avoiding the Error: By using loose consistency, you ensure the query successfully rewrites to the MV even if the base table is busy or the FE's metadata cache is slightly behind. This prevents the query from "falling back" to a direct Iceberg scan, which would trigger the metadata scan and the concurrency error.
3. During MV Refresh
The "metadata-collection" error will still occur during the refresh task of the materialized view.
* When the MV needs to update itself, it must run a full INSERT INTO ... SELECT from the base Iceberg table.
* This refresh task is a "read" on the Iceberg table and will trigger the distributed metadata scan to calculate splits. If you have many MVs refreshing simultaneously or many concurrent direct queries during a refresh, you will hit the metadata_collect_concurrency limit.
Recommendation
If you are seeing this error while using MVs, it is likely happening because:
1. The Rewrite Failed: The query could not be rewritten to the MV (e.g., because the MV was too stale or didn't match the SQL), so StarRocks fell back to scanning the Iceberg table directly.
2. The Refresh Burst: Too many MV refresh tasks were running at the same time.
To fix this:
* Increase the limit: Set metadata_collect_concurrency = 64 (or higher) in be.conf to handle bursts.
* Use Local Planning: If your FE has enough memory, set plan_mode = 'local' globally or for the refresh user to move this work away from the BE thread pool.
* Stagger Refreshes: Use REFRESH DEFERRED and schedule refreshes with a task manager to avoid concurrent spikes.
References
• data_source/catalog/iceberg/iceberg_catalog.md
• using_starrocks/async_mv/use_cases/data_lake_query_acceleration_with_materialized_views.md
• administration/management/BE_configuration.md
• sql-reference/sql-statements/materialized_view/CREATE_MATERIALIZED_VIEW.md
References
• using_starrocks/async_mv/use_cases/query_rewrite_with_materialized_views.mdRocky
09/07/2026, 7:18 PMKenneth Oh
09/07/2026, 7:20 PMRocky
09/07/2026, 7:20 PMREFRESH DEFERRED is a configuration for the refresh moment of an asynchronous materialized view. It determines whether the MV should start populating data immediately upon creation or wait for a later trigger.
How it works
When you define a materialized view with REFRESH DEFERRED, StarRocks creates the metadata and schema for the MV but does not execute the underlying query to load data into the tablets.
* Syntax:
sql
CREATE MATERIALIZED VIEW my_mv
REFRESH DEFERRED ASYNC [EVERY (INTERVAL 1 DAY)] -- 'DEFERRED' is the key here
AS
SELECT ... FROM iceberg_catalog.db.table;
* Default Behavior: Without this keyword (the default is IMMEDIATE), StarRocks will immediately launch a refresh task as soon as the CREATE statement finishes. For massive Iceberg tables, this can immediately consume all available metadata-collection slots on your BE nodes.
Why it is used to avoid spikes
1. Controlled Initialization: By using DEFERRED, you can create multiple materialized views in bulk without crashing the system or hitting the metadata_collect_concurrency limit.
2. Manual Triggering: After creation, the MV remains empty (and essentially "stale"). You can then manually trigger the first refresh at a quiet time (e.g., midnight) using:
sql
REFRESH MATERIALIZED VIEW my_mv;
3. Staggered Schedules: If you have 50 MVs, you can create them all with DEFERRED and then assign them different refresh schedules (e.g., MV1 at 1:00 AM, MV2 at 1:05 AM) so they don't all attempt to scan the Iceberg metadata at the same time.
Summary of Differences
Feature | REFRESH IMMEDIATE (Default) | REFRESH DEFERRED
Initial Load | Occurs immediately after creation. | No data is loaded initially.
System Load | High spike during creation. | Zero load during creation.
Data Readiness | Ready for use right away. | Requires a manual or scheduled refresh before use.
Best For | Small/Native tables. | Large Data Lake tables (Iceberg/Hudi/Delta).
Note: If you use REFRESH DEFERRED MANUAL, the MV will never refresh until you explicitly run the REFRESH MATERIALIZED VIEW command. This is the safest way to manually orchestrate complex dependencies.
References
• sql-reference/sql-statements/materialized_view/REFRESH_MATERIALIZED_VIEW.md
• using_starrocks/async_mv/Materialized_view.md
• sql-reference/sql-statements/materialized_view/CREATE_MATERIALIZED_VIEW.mdKenneth Oh
09/07/2026, 7:29 PMRocky
09/07/2026, 7:29 PMmetadata_collect_concurrency limit is often the first bottleneck you'll hit, but several other default settings can throttle your performance or cause "noise" in a high-load environment.
Here are the key Backend (BE/CN) and Frontend (FE) configurations to review:
1. Connector Scanner Concurrency (max_hdfs_scanner_num)
* Parameter: max_hdfs_scanner_num (BE/CN configuration)
* Default: 50
* The Issue: This limits the maximum number of concurrent remote scanners (S3/HDFS) a single scan node can have. In high-concurrency environments, 50 scanners per node might be too low, causing queries to queue at the data-fetching layer rather than the metadata layer.
* Recommendation: Increase to 128 or 256 depending on your CPU core count.
2. Data Cache (Block Cache)
* Parameters: datacache_enable, datacache_disk_size (BE/CN configuration)
* Default: Disk cache is often disabled or small by default.
* The Issue: Without a robust data cache, every high-QPS burst hits your object storage (S3/GCS/HDFS) directly. This introduces latency spikes and potential IO throttling from the storage provider.
* Recommendation: Enable the Data Cache and allocate dedicated NVMe/SSD space. High QPS on Iceberg is significantly more stable when the "hot" data is served from local disk.
3. FE Metadata Cache Capacity
* Parameters:
* iceberg_metadata_memory_cache_capacity (Default: 512MB)
* enable_iceberg_metadata_disk_cache (Default: false)
* The Issue: The FE caches Iceberg manifest files. If your Iceberg catalog is large (thousands of partitions/files), a 512MB cache will result in high "cache churn." This forces the FE to repeatedly re-fetch and re-parse metadata from S3, which slows down the entire planning phase.
* Recommendation:
* Increase memory cache to 2GB or more.
* Enable enable_iceberg_metadata_disk_cache = true to allow a larger secondary metadata cache on the FE's local disk.
4. Metadata Refresh Interval
* Parameter: background_refresh_metadata_interval_millis (FE configuration)
* Default: 600000 (10 minutes)
* The Issue: StarRocks automatically polls the metastore (Glue/HMS) to see if the Iceberg table has changed. If you have hundreds of MVs or external tables, the background refresh itself can become a source of contention.
* Recommendation: If you don't need sub-10-minute freshness, increase this interval to reduce the background load on the FE and Metastore.
5. I/O Thread Pools for Remote Storage
* Parameter: pipeline_hdfs_scan_thread_pool_thread_num (BE/CN configuration)
* Default: Often defaults to the number of CPU cores.
* The Issue: This pool handles the actual I/O tasks for reading data from the lake. If your storage (like S3) is high-latency, threads can spend a lot of time waiting for I/O.
* Recommendation: In I/O-bound workloads, you can safely increase this to 2x or 3x the number of CPU cores to ensure the CPU isn't idling while waiting for remote data.
6. Session Variable: plan_mode
* Default: adaptive
* The Issue: In adaptive mode, StarRocks decides between local (FE does everything) and distributed (BEs help). If it incorrectly chooses distributed for a small but frequent query, you hit the BE concurrency cap we discussed earlier.
* Recommendation: For specific high-QPS workloads where metadata is small, you can force SET GLOBAL plan_mode = 'local'; to keep all planning on the FE and bypass the BE thread pool entirely.
Summary Checklist for High-QPS Iceberg
1. BE: metadata_collect_concurrency = 64
2. BE: max_hdfs_scanner_num = 256
3. BE: Enable Data Cache (Data Cache is the single biggest performance booster for QPS).
4. FE: Increase iceberg_metadata_memory_cache_capacity and enable disk cache.
ReferencesRocky
09/07/2026, 7:29 PMKenneth Oh
09/07/2026, 10:51 PMRocky
09/07/2026, 10:52 PMmetadata_collect_concurrency is a Compute Node (CN) or Backend (BE) configuration.
It is often missing from the default configuration files (cn.conf or be.conf) because it uses a default value (usually 16). To change it, you must manually add it or use an administrative command.
1. How to verify the setting exists
Even if it's not in your file, it exists in the node's memory. You can verify the current value by running this from any node with access to the CN/BE:
bash
# Replace <CN_IP> and <CN_HTTP_PORT> (default 8040)
curl http://<CN_IP>:<CN_HTTP_PORT>/get_config?metadata_collect_concurrency
If you see a value (e.g., 16), then the setting is active.
2. How to set it in Shared-Data (CN)
In a shared-data cluster, your nodes are Compute Nodes (CN).
1. Permanent Change: Add the line to conf/cn.conf on every node:
properties
metadata_collect_concurrency = 64
2. Restart the CN nodes to apply.
3. Why you might not see it (Adaptive Planning)
Starting from v3.3.3 and in v4.x, StarRocks uses an Adaptive Metadata Retrieval Strategy.
* Small Metadata: The Frontend (FE) parses Iceberg metadata locally.
* Large Metadata: The FE distributes the metadata parsing task to CNs (this is where the metadata_collect_concurrency limit is hit).
If you are on a "Shared-Data" (Cloud Native) cluster with high QPS, you are likely hitting the limit because the FE is delegating too many manifest-parsing tasks to your CNs simultaneously.
4. Better Alternative for High QPS: plan_mode
Instead of just raising the thread limit on the CNs, you can change how StarRocks handles the metadata entirely using a System Variable. This is often more effective for high-QPS environments than tuning individual BE/CN thread pools.
Run this to force the Frontend to handle the metadata parsing (bypassing the CN concurrency limit):
sql
-- Apply to the current session or GLOBAL for all users
SET GLOBAL plan_mode = 'local';
* local mode: The FE handles all manifest parsing. This is faster for high QPS if your FE has enough CPU/Memory, as it avoids the network overhead of sending metadata tasks to CNs.
* distributed mode: (Default for large tables) FE sends tasks to CNs. This is where metadata_collect_concurrency applies.
Summary Checklist
* Parameter Name: metadata_collect_concurrency (Add to cn.conf if missing).
* Location: CN nodes (for shared-data) or BE nodes.
* QPS Fix: Try SET GLOBAL plan_mode = 'local'; to stop the CNs from being the metadata bottleneck.
* Verification: Use the curl command above to confirm the node recognizes the parameter.
References
• administration/management/BE_configuration.md
• data_source/catalog/iceberg/iceberg_catalog.md
• sql-reference/System_variable.md
References
• deployment/shared_data/s3.md
• deployment/shared_data/azure.md
• deployment/shared_data/minio.md
• deployment/shared_data/gcs.md
• quick_start/shared-data.md
• administration/management/FE_configuration.md
• deployment/shared_data/hdfs.mdKenneth Oh
09/07/2026, 11:03 PMRocky
09/07/2026, 11:03 PMmetadata_collect_concurrency is part of the Distributed Metadata Planning feature (introduced in v3.3). However, starting with v4.0 and v4.1, StarRocks moved toward an Adaptive Metadata Retrieval Strategy, which is why you may not find this specific parameter listed in the standard configuration tables for the latest versions.
Documentation Links
* Iceberg Catalog Tuning: Iceberg catalog - Appendix B: Metadata File Parsing
* This section explains how StarRocks switches between Local Plan and Distributed Plan. It explicitly mentions that the adaptive approach "dynamically optimizes metadata retrieval without the need for manual adjustment."
* Controlling the Plan Mode: `plan_mode` System Variable
* This variable (introduced in v3.3.3) allows you to force the metadata planning behavior (local, distributed, or adaptive).
Why the setting is "missing" in v4.1.1
1. Adaptive by Default: In v4.x, the system uses an adaptive strategy to determine if it should use the FE or the CNs to parse Iceberg manifests. It attempts to balance load automatically.
2. Internal BE Config: metadata_collect_concurrency is a BE/CN-side configuration. Like many advanced tuning parameters, it is not included in the default cn.conf or be.conf files provided with the installation. It uses a built-in default (usually 16 or 64 depending on the minor version).
3. Manual Override: If you are experiencing "metadata fetch cap" or queuing issues even in v4.1.1, you can manually add the line to your `cn.conf`:
properties
metadata_collect_concurrency = 128
Then restart the CN. However, the recommended modern approach is to tune the FE-side metadata cache or the session variable plan_mode first.
Summary of what to check instead
If you are hitting metadata bottlenecks in a large shared-data cluster:
1. Check FE Metadata Cache: Increase iceberg_metadata_memory_cache_capacity and enable enable_iceberg_metadata_disk_cache (Doc link).
2. Switch Plan Mode: Try SET GLOBAL plan_mode = 'local'; to reduce the dependency on CN thread pools for metadata parsing if your FE has the capacity.
References
• data_source/catalog/iceberg/iceberg_catalog.md
• data_source/feature-support-data-lake-analytics.mdKenneth Oh
09/08/2026, 1:40 AMRocky
09/08/2026, 1:41 AMmetadata_collect_concurrency is an internal configuration for the Backend (BE) or Compute Node (CN). Because it is not explicitly defined in the default cn.conf or be.conf files, it won't appear there unless you manually add it.
1. Default Value and How to Check
In v4.1.1, the default value for metadata_collect_concurrency is typically 16.
To verify the exact value currently running on your CNs without relying on the config file, run the following command from a machine that can reach the CN:
bash
# Replace <CN_IP> and <CN_HTTP_PORT> (default is 8040)
curl http://<CN_IP>:<CN_HTTP_PORT>/get_config?conf=metadata_collect_concurrency
This will return the active value in memory.
──────────
2. Other CN Settings Affecting Iceberg High QPS
If you are hitting a "metadata fetch cap" or experiencing queuing on your CNs, check these other critical default settings:
Connector Scan Concurrency (max_hdfs_scanner_num)
* Default: 50
* Impact: This limits the number of concurrent remote scanners (S3/HDFS/GCS) allowed for a single scan node. In high-QPS environments with many concurrent queries, this 50-scanner limit can cause queries to wait for scan slots even if the CPU is idle.
* Recommendation: Increase to 128 or 256 in cn.conf.
Pipeline HDFS Scan Threads (pipeline_hdfs_scan_thread_pool_thread_num)
* Default: Usually equal to the number of CPU cores.
* Impact: This pool handles the actual I/O tasks for reading data from the lake. If your storage (S3/OSS) has high latency, these threads spend time waiting for I/O.
* Recommendation: If you see low CPU usage but high query latency, increase this to 2x or 3x the number of CPU cores.
Data Cache (Block Cache) Concurrency
* Settings: datacache_read_thread_num
* Impact: If you have enabled the StarRocks Data Cache (highly recommended for high QPS on shared-data clusters), this setting controls the threads reading from the local SSD/NVMe.
* Recommendation: Ensure this is sufficient to saturate your local NVMe throughput.
──────────
3. The "Adaptive" Strategy (FE Side)
In v4.1.1, StarRocks uses an Adaptive Metadata Retrieval Strategy. The Frontend (FE) decides whether to parse Iceberg metadata locally (fast for small tables) or distribute it to CNs (necessary for large tables).
If you want to bypass the CN concurrency bottleneck entirely for high-QPS workloads (provided your FE has enough memory), you can force the FE to handle it:
sql
-- Force the FE to do the planning locally and bypass CN thread pools
SET GLOBAL plan_mode = 'local';
Summary of Bottlenecks
* FE Bottleneck: Check iceberg_metadata_memory_cache_capacity (Default 512MB).
* CN Bottleneck: Increase metadata_collect_concurrency and max_hdfs_scanner_num.
References
• administration/management/BE_configuration.md
• data_source/catalog/iceberg/iceberg_catalog.md#appendix-b-metadata-file-parsing
• sql-reference/System_variable.md#plan_mode
References
• data_source/catalog/iceberg/iceberg_catalog.md
• data_source/catalog/iceberg/iceberg_meta_table.md
• data_source/feature-support-data-lake-analytics.md
• administration/management/FE_configuration.mdKenneth Oh
09/08/2026, 1:52 AMRocky
09/08/2026, 1:52 AMlake_metadata_fetch_thread_count is a Backend (BE) or Compute Node (CN) configuration parameter used specifically for Shared-Data (Cloud-Native) tables.
It should not be confused with metadata_collect_concurrency (which is for external tables like Iceberg). This setting governs how your nodes fetch metadata for StarRocks' own internal tables stored in object storage.
Key Details
* Default Value: 3
* Type: Integer
* Introduced in: v3.5.16, v4.0.9 (and present in all v4.1.x versions).
* Function: It defines the number of concurrent threads in the thread pool dedicated to fetching tablet metadata from object storage (like S3, OSS, or HDFS).
* Operations affected: Background and administrative tasks such as get_tablet_stats and get_tablet_metadatas.
When to adjust this setting
You might need to increase this value if you notice the following in your Shared-Data cluster:
1. Slow Metadata Reports: If the Frontend (FE) is taking a long time to get tablet statistics or status updates from the CNs.
2. Queueing in Logs: If you see logs indicating that metadata fetch tasks are waiting in a queue.
3. High Tablet Count: Clusters with a very large number of tablets (thousands or millions) may benefit from a higher thread count (e.g., 16 or 32) to speed up the reporting of tablet states to the FE.
How to verify or change it
Since it is a BE/CN configuration, you can check its current value using `curl`:
bash
# Check the current value on a specific node
curl http://<CN_IP>:8040/get_config?conf=lake_metadata_fetch_thread_count
To change it permanently, add it to your cn.conf (or be.conf):
properties
lake_metadata_fetch_thread_count = 16
Then restart the node. Because it is marked as mutable, you may also be able to change it at runtime via the HTTP API, though a config file change is safer for persistence.
References
• administration/management/BE_configuration.md
• deployment/shared_data/s3.md
• administration/management/FE_configuration.md
References
• administration/management/FE_configuration.md
• administration/management/BE_configuration.mdKenneth Oh
09/08/2026, 4:33 AMmetadata_collect_concurrencyRocky
09/08/2026, 4:33 AMmetadata_collect_concurrency setting in StarRocks v4.1.1, you can use either a SQL query or a curl command against the Backend (BE) or Compute Node (CN) HTTP interface.
Method 1: Using SQL (Easiest)
You can query the information_schema.be_configs table directly from your MySQL client. This is the most convenient way to check the value across all nodes in the cluster.
sql
SELECT * FROM information_schema.be_configs
WHERE NAME = 'metadata_collect_concurrency';
This will show you the current value, the default value, and whether it is mutable for every BE/CN node.
──────────
Method 2: Using curl (Direct Node Check)
If you want to check a specific node directly from the command line, use the /get_config endpoint.
For a specific parameter:
bash
# Replace <IP> with your BE/CN IP and <PORT> with the be_http_port (default 8040)
curl http://<IP>:<PORT>/get_config?conf=metadata_collect_concurrency
To see all configurations (long list):
bash
curl http://<IP>:<PORT>/varz
──────────
Method 3: Using ADMIN SHOW CONFIG
You can also use the administrative command to view configurations, though the information_schema method (Method 1) is generally more readable for specific filters.
sql
ADMIN SHOW FRONTEND CONFIG; -- For FE settings
-- Note: There is no direct "ADMIN SHOW BACKEND CONFIG" command;
-- Method 1 or 2 must be used for BE/CN settings.
Important Note
* Default Value: If you have not manually added this setting to your cn.conf or be.conf, it will likely show the default value (usually 16).
* CN vs BE: In a shared-data cluster using Compute Nodes, use the CN's IP and its be_http_port (default 8040).
References
• sql-reference/information_schema/be_configs.md
• administration/management/BE_configuration.md
References
• administration/management/BE_configuration.md
• sql-reference/information_schema/be_configs.md
• administration/http_interface.mdKenneth Oh
09/08/2026, 5:46 AMfailed after 1 times, try lock failed: 0, error-msg : com.starrocks.common.DdlException: [E104]Fail to read from Socket{id=17179871695 fd=1603 addr=10.0.71.142:8060:40616} (0x0xfffc881f0000): Connection reset by peer [R1][E112]Not connected to 10.0.71.142:8060 yet, server_id=17179871695 [R2][E112]Not connected to 10.0.71.142:8060 yet, server_id=17179871695 [R3][E112]Not connected to 10.0.71.142:8060 yet, server_id=17179871695: BE:10200
at com.starrocks.common.ErrorReport.reportDdlException(ErrorReport.java:100)
at com.starrocks.qe.StmtExecutor.handleDMLStmt(StmtExecutor.java:3355)
[wrapped] com.starrocks.common.StarRocksException: [E104]Fail to read from Socket{id=17179871695 fd=1603 addr=10.0.71.142:8060:40616} (0x0xfffc881f0000): Connection reset by peer [R1][E112]Not connected to 10.0.71.142:8060 yet, server_id=17179871695 [R2][E112]Not connected to 10.0.71.142:8060 yet, server_id=17179871695 [R3][E112]Not connected to 10.0.71.142:8060 yet, server_id…
how do i make these refreshes more robustRocky
09/08/2026, 5:46 AMConnection reset by peer during a large Materialized View (MV) refresh typically indicates that the Backend (BE) or Compute Node (CN) crashed or closed the connection abruptly, most often due to an Out of Memory (OOM) event or a socket timeout during a long-running "Full Refresh."
Since your tables are not partitioned, StarRocks must recompute the entire dataset every time, which is resource-intensive. Here is how to make these refreshes more robust:
1. Enable "Spill to Disk"
To prevent OOM when joining or aggregating large dimensional tables, force the refresh task to spill intermediate results to disk instead of failing when memory is tight.
sql
ALTER MATERIALIZED VIEW <mv_name> SET (
"session.enable_spill" = "true",
"session.spill_mode" = "force"
);
2. Increase Refresh Timeouts
The default timeout for MV refreshes is 1 hour (3600 seconds). For very large dimensional tables, this may not be enough. Increase it via the MV properties:
sql
ALTER MATERIALIZED VIEW <mv_name> SET (
"session.insert_timeout" = "10800", -- Increase to 3 hours
"session.query_timeout" = "10800"
);
3. Adjust Memory Limits
If the refresh is hitting a per-query memory limit (default is often 10% of BE memory), increase the limit specifically for the refresh session:
sql
ALTER MATERIALIZED VIEW <mv_name> SET (
"session.query_mem_limit" = "34359738368" -- Set to 32GB or higher as needed
);
4. Use Resource Isolation (Recommended)
By default, MV refreshes run in a system resource group called default_mv_wg. You can tune this group to ensure refreshes have enough memory but don't starve your interactive queries.
* Check if the refresh is being killed by the resource group:
sql
SELECT * FROM information_schema.resource_groups;
* Increase the mem_limit for the default_mv_wg or create a dedicated group for large refreshes.
5. Strategy: "Dummy" Partitioning
Even if your base table is not partitioned by date, you can sometimes partition the Materialized View by a high-cardinality column (like a hash(id) or a range of IDs).
* This allows you to use partition_refresh_number = 1, forcing StarRocks to refresh the table in smaller batches rather than one massive, memory-heavy transaction.
How to Diagnose the Root Cause
To confirm if it was an OOM or a timeout, check the task history:
1. Find the Query ID:
sql
SELECT query_id, status, error_msg, create_time
FROM information_schema.task_runs
WHERE task_name = (SELECT task_name FROM information_schema.tasks WHERE mv_name = 'your_mv_name')
ORDER BY create_time DESC;
2. Inspect the Profile (if available):
sql
-- If the task is still in the cache, get the detailed execution graph
SELECT GET_QUERY_PROFILE('your_query_id');
3. Check BE Logs:
Search the be.out or <http://be.INFO|be.INFO> logs on the node 10.0.71.142 (from your error) at the time of failure for "OOM" or "Terminated".
Summary of Robust Properties
Apply these to your MV for maximum stability:
sql
ALTER MATERIALIZED VIEW <mv_name> SET (
"session.enable_spill" = "true",
"session.insert_timeout" = "10800",
"session.query_mem_limit" = "0", -- 0 means use the BE's maximum available
"max_mv_refresh_failure_retry_times" = "3"
);
References
• using_starrocks/async_mv/troubleshooting_asynchronous_materialized_views.md
• administration/management/resource_management/spill_to_disk.md
• knowledge/usage/best-practice.md
• administration/management/BE_configuration.mdRocky
09/08/2026, 5:46 AMKenneth Oh
09/08/2026, 5:47 AMRocky
09/08/2026, 5:48 AMSET GLOBAL command to change the default behavior for all future background refresh sessions.
sql
-- Enable spilling to disk for all future refresh tasks
SET GLOBAL enable_spill = true;
-- Increase the default timeout for all data loading/refresh tasks (in seconds)
SET GLOBAL insert_timeout = 10800; -- 3 hours
SET GLOBAL query_timeout = 10800;
-- Remove the default memory limit per query (allowing it to use available BE memory)
SET GLOBAL query_mem_limit = 0;
Note: SET GLOBAL affects all new sessions created after the command is run. Since MV refreshes are background tasks, they will pick up these global defaults.
2. Adjust FE Configurations for MV Defaults
Some behaviors are controlled by FE parameters rather than session variables. You can update these using the ADMIN SET FRONTEND CONFIG command (these are mutable and do not require a restart).
sql
-- Enable spilling specifically for MV tasks globally (v3.1+)
ADMIN SET FRONTEND CONFIG ("enable_materialized_view_spill" = "true");
-- Set the global default retry count for MV refresh failures (v3.3+)
ADMIN SET FRONTEND CONFIG ("max_mv_refresh_failure_retry_times" = "3");
-- Set the retry count for "Try Lock Failed" errors (v3.3+)
ADMIN SET FRONTEND CONFIG ("max_mv_refresh_try_lock_failure_retry_times" = "5");
-- Increase the timeout when trying to acquire a lock on base tables (in ms)
ADMIN SET FRONTEND CONFIG ("mv_refresh_try_lock_timeout_ms" = "60000");
3. Handle Partitioned vs. Non-Partitioned Refresh
For your non-partitioned dimensional tables, the most critical global setting is:
sql
ADMIN SET FRONTEND CONFIG ("default_mv_partition_refresh_number" = "1");
While this is mostly for partitioned MVs, it ensures that StarRocks handles batching correctly. However, for a Full Refresh (non-partitioned), the enable_spill and insert_timeout settings mentioned in step 1 are your primary tools for robustness.
Verification
To verify that your FE configurations have been applied:
sql
ADMIN SHOW FRONTEND CONFIG LIKE '%mv%';
To verify global session variables:
sql
SHOW GLOBAL VARIABLES WHERE Variable_name IN ('enable_spill', 'insert_timeout', 'query_mem_limit');
References
• administration/management/FE_configuration.md
• sql-reference/System_variable.md
• using_starrocks/async_mv/troubleshooting_asynchronous_materialized_views.md
References
• administration/management/FE_configuration.md
• sql-reference/System_variable.md
• using_starrocks/async_mv/troubleshooting_asynchronous_materialized_views.md
• administration/management/BE_configuration.md
• sql-reference/sql-statements/materialized_view/ALTER_MATERIALIZED_VIEW.md
• using_starrocks/async_mv/Materialized_view.md
• using_starrocks/async_mv/feature-support-asynchronous-materialized-views.mdRocky
09/08/2026, 5:48 AMRocky
09/08/2026, 5:48 AMRocky
09/08/2026, 5:48 AMRocky
09/08/2026, 5:48 AMKenneth Oh
09/08/2026, 6:35 AMRocky
09/08/2026, 6:36 AMmaterialized_view_rewrite_mode session variable (available in v3.2+).
* To prioritize the MV:
sql
SET [GLOBAL] materialized_view_rewrite_mode = 'force';
* To fail with an error if it doesn't rewrite (best for debugging):
sql
SET materialized_view_rewrite_mode = 'force_or_error';
-- Then run your query. The error message will tell you exactly why it failed.
2. Bypass Data Consistency Checks
The most common reason one FE rewrites while another doesn't is a slight delay in metadata or data freshness. By default, StarRocks won't rewrite if the MV is even slightly "stale."
You can force the rewrite to ignore data freshness by altering the MV properties:
sql
ALTER MATERIALIZED VIEW <mv_name> SET ("query_rewrite_consistency" = "loose");
Alternatively, you can set a staleness threshold:
sql
ALTER MATERIALIZED VIEW <mv_name> SET ("mv_rewrite_staleness_second" = "60");
3. Ensure MV Status is "Active"
An MV must be in the Active state to be eligible for rewrite. If an FE thinks the MV is inactive (due to a failed refresh or metadata sync issue), it will skip it.
sql
-- Run this on the problematic FE
ALTER MATERIALIZED VIEW <mv_name> ACTIVE;
4. Troubleshoot FE Inconsistency
If one FE works and others don't, check for these configuration drifts:
* Check Session Variables on both FEs:
Compare the output of SHOW VARIABLES LIKE '%materialized_view%'; on a working vs. non-working connection. Ensure enable_materialized_view_rewrite is true.
* Clear the Plan Cache:
Sometimes an FE caches a plan that hits the base table before the MV was ready.
sql
SET enable_materialized_view_plan_cache = false;
-- Run query, then turn it back on if desired
SET enable_materialized_view_plan_cache = true;
* Verify FE Configs:
Ensure all FEs have the same internal configurations:
sql
ADMIN SHOW FRONTEND CONFIG LIKE '%mv%';
5. Diagnosis with EXPLAIN
On the FE that is not rewriting, run:
sql
EXPLAIN LOGICAL <your_query>;
If you don't see SCAN [mv_name], and you have already set materialized_view_rewrite_mode = 'force_or_error', StarRocks will return a specific error code explaining the rejection (e.g., "partition mismatch," "expression not supported," or "stale data").
References
• using_starrocks/async_mv/use_cases/query_rewrite_with_materialized_views.md
• sql-reference/System_variable.md
• using_starrocks/async_mv/troubleshooting_asynchronous_materialized_views.md
References
• using_starrocks/async_mv/use_cases/query_rewrite_with_materialized_views.md
• using_starrocks/async_mv/Materialized_view.md
• sql-reference/System_variable.mdKenneth Oh
09/08/2026, 6:38 AMRocky
09/08/2026, 6:39 AMquery_rewrite_consistency is a Materialized View (MV) property, not a global system variable. There is no single SET GLOBAL command to change this specific property for all MVs at once.
However, you can achieve a similar "global" effect using the following two methods:
1. The Global "Force" Variable (v3.2+)
If your goal is to force all queries to prioritize MVs even if they aren't perfectly consistent, you can use the materialized_view_rewrite_mode system variable. Setting this to force tells the optimizer to prioritize the MV over the base table for all queries in the cluster.
sql
-- Apply to all future sessions/connections
SET GLOBAL materialized_view_rewrite_mode = 'force';
-- Apply to the current session only
SET materialized_view_rewrite_mode = 'force';
* force: Prioritizes query rewrite using the MV. If rewrite fails for technical reasons (e.g., incompatible SQL), it falls back to the base table.
* force_or_error: Prioritizes the MV, but returns an error if the rewrite fails (excellent for debugging why a specific FE isn't using an MV).
2. Batch Update Existing MVs
If you must change the consistency level to loose for every MV currently in your system, you can generate a batch of ALTER statements using the information_schema.
Run this query to generate the commands, then copy and execute the results:
sql
SELECT CONCAT('ALTER MATERIALIZED VIEW ', table_schema, '.', table_name, ' SET ("query_rewrite_consistency" = "loose");')
FROM information_schema.materialized_views
WHERE table_schema NOT IN ('information_schema', '_statistics_');
Why one FE might differ from others
Since you mentioned one FE is rewriting while others are not, it is often due to Plan Caching or Session Variable Drift. To fix this globally across all FEs:
1. Clear the Plan Cache: Run SET GLOBAL enable_materialized_view_plan_cache = false; and then set it back to true.
2. Verify Consistency: Ensure enable_materialized_view_rewrite is true in the global scope:
sql
SET GLOBAL enable_materialized_view_rewrite = true;
Summary of Properties
Property | Level | Global Variable?
query_rewrite_consistency | MV Property | No (Set per MV)
mv_rewrite_staleness_second | MV Property | No (Set per MV)
materialized_view_rewrite_mode | Session/Global | Yes (SET GLOBAL)
References
• using_starrocks/async_mv/use_cases/query_rewrite_with_materialized_views.md
• sql-reference/System_variable.md
• using_starrocks/async_mv/troubleshooting_asynchronous_materialized_views.md
References
• administration/management/FE_configuration.md
• using_starrocks/async_mv/use_cases/query_rewrite_with_materialized_views.md
• sql-reference/System_variable.mdKenneth Oh
09/08/2026, 6:54 AMRocky
09/08/2026, 6:54 AMTRACE REASON MV returns an empty output, it means the optimizer didn't even consider your Materialized View (MV) as a candidate for the rewrite process. This typically happens before the actual structural matching begins.
Here are the reasons why this happens and how to fix it:
1. The MV is "Inactive"
This is the most common reason for a sudden stop in rewrites. If a base table schema changes or a background refresh fails too many times, StarRocks marks the MV as Inactive. An inactive MV is ignored by the optimizer.
* Check Status: Run SHOW MATERIALIZED VIEWS WHERE name = 'your_mv_name'\G and look at the is_active column.
* Fix: If it is false, force it back to active:
sql
ALTER MATERIALIZED VIEW your_mv_name ACTIVE;
2. Rewrite is Disabled on that FE
Since you mentioned only one FE is working, it's highly likely the session variables or global configurations differ between the FEs.
* Verify Variable: On the problematic FE, run:
sql
SHOW VARIABLES LIKE 'enable_materialized_view_rewrite';
If it is false, the optimizer will skip the MV phase entirely, leaving the trace empty.
* Fix: Ensure it is enabled globally:
sql
SET GLOBAL enable_materialized_view_rewrite = true;
3. Trace Logs are Redirecting to a File
If the variable trace_log_mode is set to 'file', the output of TRACE commands will not appear in your SQL client; instead, it will be written to the fe.log of the Frontend you are connected to.
* Check: SHOW VARIABLES LIKE 'trace_log_mode';
* Fix: Set it to command to see output in your terminal:
sql
SET trace_log_mode = 'command';
4. FE Metadata Inconsistency
If one FE rewrites and others do not, the non-working FEs might have a stale metadata cache. They might think the MV is still "refresing" or "stale" even if it's not.
* Action: Try clearing the plan cache on the problematic FEs:
sql
SET GLOBAL enable_materialized_view_plan_cache = false;
-- Wait a few seconds
SET GLOBAL enable_materialized_view_plan_cache = true;
5. Get More Detail with TRACE LOGS
TRACE REASON MV is a concise summary. If it's empty, use the more verbose version to see where the optimizer is exiting:
sql
TRACE LOGS MV <your_query>;
If this also returns nothing, it confirms the optimizer is skipping the MV module entirely (likely due to Point 1 or 2 above).
Summary Checklist
1. Is is_active true in SHOW MATERIALIZED VIEWS?
2. Is enable_materialized_view_rewrite true?
3. Is materialized_view_rewrite_mode set to default or force?
4. Is your query a supported SPJG (Select-Project-Join-Aggregation) type? (Nested aggregates or window functions often prevent the optimizer from even trying a rewrite).
References
• using_starrocks/async_mv/troubleshooting_asynchronous_materialized_views.md
• sql-reference/System_variable.md
• developers/trace-tools/query_trace_profile.md
References
• developers/trace-tools/query_trace_profile.md
• administration/management/FE_configuration.md
• using_starrocks/async_mv/troubleshooting_asynchronous_materialized_views.md
• sql-reference/System_variable.md
• using_starrocks/async_mv/feature-support-asynchronous-materialized-views.mdRocky
09/08/2026, 6:54 AMKenneth Oh
09/08/2026, 6:57 AMRocky
09/08/2026, 6:58 AM[MV TRACE] [PREPARE GLOBAL] Table mytable has no related materialized views indicates that the optimizer’s "candidate search" phase is completely bypassing your Materialized View (MV). This happens because the FE (Frontend) you are connected to does not have mytable mapped to any Active MVs in its internal memory.
Since this is working on one FE but not others, it is almost certainly a metadata synchronization or status issue. Here is how to resolve it:
1. Check the is_active status on the failing FE
An MV is only added to the "related tables" map if its status is Active. If an FE thinks the MV is inactive (e.g., due to a base table schema change that hasn't been "seen" correctly by all FEs), it will skip it.
Run this on the non-working FE:
sql
SELECT table_name, is_active, inactive_reason
FROM information_schema.materialized_views
WHERE table_name = 'your_mv_name';
* If is_active is false: You must reactivate it:
sql
ALTER MATERIALIZED VIEW your_mv_name ACTIVE;
* If it’s already true on the working FE but false on this one: This confirms a metadata sync lag between your Leader FE and Follower FEs.
2. Check for Database/Catalog context
The "Related MV" mapping is sensitive to the Database and Catalog scope.
* If your MV is in db1 and you are running the query in db2 (even if mytable exists in both), the FE might not link them unless you use fully qualified names (e.g., db1.mytable).
* Ensure the search_path or current database is the same across all FEs when testing.
3. Clear the FE’s MV Plan Cache
StarRocks caches the relationship between tables and MVs to speed up the optimizer. If this cache became corrupted or stale on specific FEs, they won't "see" the relationship.
Run these commands to force a refresh of the internal metadata cache on the problematic FEs:
sql
-- Disable and re-enable the plan cache to flush it
SET GLOBAL enable_materialized_view_plan_cache = false;
SET GLOBAL enable_materialized_view_plan_cache = true;
4. Force a "Rewrite Error" to see the real state
On the FE that says "no related MVs," force the optimizer to try anyway. This will often surface a more descriptive error than the trace:
sql
SET materialized_view_rewrite_mode = 'force_or_error';
-- Run your query
If the FE truly believes there are no related MVs, the query will fail immediately with an error stating no MV could be found for the rewrite.
5. Why the inconsistency exists?
If one FE works and others don't:
* Leader vs. Follower: Only the Leader FE manages the state of MVs. Follower FEs receive updates via the BDBJE image/journal. If a Follower has fallen behind or has a local metadata exception, it might not mark the MV as active.
* Check FE Health: Run SHOW FRONTENDS; and ensure all FEs have Alive = true and that the LastHeartbeat is recent.
Summary Checklist
1. Reactivate: ALTER MATERIALIZED VIEW <name> ACTIVE; (Even if it looks active, this forces a metadata broadcast).
2. Verify: Ensure enable_materialized_view_rewrite is true on all FEs.
3. Sync: If the issue persists, the Follower FE might need a restart to re-sync its metadata image from the Leader.
References
• using_starrocks/async_mv/troubleshooting_asynchronous_materialized_views.md
• sql-reference/sql-statements/cluster-management/plan_profile/TRACE.md
• administration/management/FE_configuration.md
References
• administration/management/FE_configuration.mdKenneth Oh
09/08/2026, 7:02 AMRocky
09/08/2026, 7:02 AMALTER command creates a new journal entry that all FEs must replay.
Run this on the Leader FE:
sql
ALTER MATERIALIZED VIEW your_mv_name ACTIVE;
Wait 5-10 seconds for the journals to sync to the other nodes.
2. Verify Metadata Sync Status
Check if the other FEs are actually synchronized with the Leader. If the ReplayedJournalId on a Follower is significantly lower than the Leader's CurrentJournalId, it won't see recent changes (like MV creations or activations).
sql
SHOW FRONTENDS;
* Check Alive: Must be true for all.
* Check ReplayedJournalId: Should be identical or very close to the Leader's ID. If a node is stuck, it won't register the MV relationship.
3. Flush the Internal MV Plan Cache (Global)
StarRocks uses a specific cache for MV rewrites. If this cache is corrupted or stale on specific FEs, they will skip the "related MV" search. Disabling and re-enabling it globally forces every FE to purge its local cache.
sql
-- This affects all FEs in the cluster
SET GLOBAL enable_materialized_view_plan_cache = false;
-- Wait a few seconds
SET GLOBAL enable_materialized_view_plan_cache = true;
4. Direct Validation on the "Broken" FE
Connect your SQL client directly to one of the FEs that isn't working (bypass your load balancer if you have one) and run:
sql
-- Check if THIS specific node sees the MV as active
SELECT table_name, is_active
FROM information_schema.materialized_views
WHERE table_name = 'your_mv_name';
-- Check if rewrite is actually enabled on this node
SHOW VARIABLES LIKE 'enable_materialized_view_rewrite';
5. The "Nuclear" Option: Restart the Follower FE
If the FE is "Alive" and synced (ReplayedJournalId is current) but still claims there are no related MVs, its internal memory-map for MVs has likely failed to initialize.
* Restart the problematic FE. Upon startup, it will reload the entire metadata image from the Leader and rebuild the Table-to-MV mapping from scratch.
Summary Checklist
1. ALTER ... ACTIVE: Forces a metadata update event.
2. SET GLOBAL enable_materialized_view_plan_cache = false: Purges stale rewrite caches.
3. SHOW FRONTENDS: Ensures BDBJE journals are actually syncing to the followers.
References
• using_starrocks/async_mv/troubleshooting_asynchronous_materialized_views.md
• administration/management/FE_configuration.md
• sql-reference/information_schema/materialized_views.md
References
• knowledge/usage/best-practice.md
• administration/management/FE_configuration.md
• using_starrocks/async_mv/troubleshooting_asynchronous_materialized_views.mdKenneth Oh
09/08/2026, 7:10 AMRocky
09/08/2026, 7:10 AMbase_table_A -> materialized_view_B is built in the FE's memory.
* The Issue: Sometimes, a background state change (like an automatic refresh or a transient schema check) updates the "active" status on the Leader but fails to generate a specific "event" that tells the Followers to rebuild their internal table-to-MV map.
* The Fix: By running ALTER MATERIALIZED VIEW ... ACTIVE, you forced the Leader to write a new journal entry. When the Follower nodes replayed this specific log entry, it triggered their internal listeners to refresh the mapping for that MV.
2. The "Automatic Active Checker" Lag
StarRocks has a background thread (active_checker) that runs on the Leader FE. It periodically checks if MVs that were marked Inactive (due to schema changes or base table drops) can be reactivated.
* If this checker reactivates an MV on the Leader, there have been known edge cases in older versions (pre-v3.1.16) where this state change didn't broadcast effectively to the Followers' optimizer caches.
* Tip: Ensure enable_mv_automatic_active_check is true (default in newer versions) and check your version for bug #54236, which specifically addressed inconsistent MV states across FE nodes.
3. Metadata Replay Lag
If a Follower node is under heavy load or has network issues, its ReplayedJournalId might fall behind the Leader's CurrentJournalId. Until the Follower replays the latest logs, it will treat the MV as if it doesn't exist or is still in its old state.
* Check Sync: Run SHOW FRONTENDS; and compare the ReplayedJournalId of the Followers against the Leader. They should be identical.
4. Database/Catalog Scope
The relationship map is sometimes sensitive to the "current database" context. If you are connected to a Follower and your session is in db1, but the MV is in db2, the Follower may not link them unless you use fully qualified names. The Leader is often more "aware" of cross-db relationships because it handles the primary metadata transitions.
How to prevent this in the future:
* Upgrade: Ensure you are on v3.1.16+, v3.2.11+, or v3.3+ where several FE metadata synchronization bugs were fixed.
* Force Sync: If it happens again, you don't always need to ALTER. You can also try flushing the plan cache globally:
sql
SET GLOBAL enable_materialized_view_plan_cache = false;
SET GLOBAL enable_materialized_view_plan_cache = true;
This forces every FE to purge and rebuild its optimizer's MV relationship structures.
References
• using_starrocks/async_mv/troubleshooting_asynchronous_materialized_views.md
• administration/management/FE_configuration.md
• sql-reference/sql-statements/cluster-management/plan_profile/TRACE.md
References
• deployment/deploy_manually.md
• administration/Meta_recovery.md
• administration/management/FE_configuration.mdKenneth Oh
09/08/2026, 7:21 AMRocky
09/08/2026, 7:22 AMstop_fe.sh -g), the FE will attempt to minimize disruption:
* Wait for completion: The FE node will stop accepting new connections but will wait for currently running queries to finish before it actually shuts down.
* Timeout: By default, it will wait for 60 seconds. If your query takes longer than this, the FE will eventually force a shutdown, and the query will fail.
* Health Check: It immediately reports an HTTP 500 error on its /api/health endpoint so that your Load Balancer (like F5, HAProxy, or Nginx) knows to stop sending new traffic to it.
3. How to achieve "Pick up" behavior
Since the database itself doesn't hand off active queries, you must handle this at the client/connectivity layer:
* JDBC Failover: You can configure your JDBC connection string to automatically retry on a different node if one fails:
sql
jdbc:mysql:<loadbalance://host1:9030,host2:9030,host3:9030/db>
*Note: This will only help for new queries or if your application code is designed to catch the exception and retry the execution.*
* External Load Balancer: Using a proxy like ProxySQL or a hardware load balancer is the recommended way to manage FE high availability. If an FE goes down, the proxy directs the next request to a healthy node, but the currently running request will still fail.
Summary
* Will it fail? Yes, the specific query running during the restart will fail.
* Will the cluster stay up? Yes, the other FEs will remain active, and new queries will be handled by them (provided you have a load balancer or a list of IPs in your app).
* Recommendation: If you are performing maintenance, use stop_fe.sh -g to allow short-running queries to finish naturally.
_Ref: StarRocks Docs - Graceful Exit, Load Balancing_
References
• deployment/deploy_manually.md
• administration/management/resource_management/Load_balance.md
• administration/Meta_recovery.md
• faq/Deploy_faq.md
• administration/management/graceful_exit.mdKenneth Oh
09/08/2026, 4:20 PMRocky
09/08/2026, 4:21 PMlake_autovacuum_grace_period_minutes is set too low, or if a transaction (like a large MV refresh) takes longer than this grace period to finish, the vacuum process may delete the logs while the FE is still trying to publish them.
* Check this setting:
sql
ADMIN SHOW FRONTEND CONFIG LIKE 'lake_autovacuum_grace_period_minutes';
* Solution: Increase the grace period (default is usually 60 minutes). If your MV refreshes or loads are very long, try increasing it to 120 or 180:
sql
ADMIN SET FRONTEND CONFIG ("lake_autovacuum_grace_period_minutes" = "180");
2. Follower FE Metadata Desync
You mentioned earlier that your Follower FEs weren't "registering" MV relationships correctly. If you are running queries or refreshes on a Follower FE that is lagging behind the Leader:
* The Follower FE might attempt to publish or access a transaction version that the Leader FE has already marked as obsolete or has already vacuumed.
* Solution: Ensure all FEs are perfectly synced. Run SHOW FRONTENDS and verify ReplayedJournalId matches the Leader. If a Follower is lagging, it will frequently encounter "404 Not Found" for S3 objects that the Leader has already cleaned up.
3. Concurrent MV Refreshes & "GTID" Mismatches
If multiple processes are trying to refresh the same Materialized View simultaneously, or if a base table schema change is happening at the same time:
* One transaction might "win" and publish a version, causing the other "in-flight" transactions to become invalid.
* In some versions of StarRocks, a race condition can occur where the "losing" transaction's logs are cleaned up before the FE can gracefully handle the conflict.
4. Clock Skew between FE/BE Nodes
Shared-data clusters rely heavily on timestamps for vacuuming. If your FE nodes and BE/CN nodes have different system times (clock skew), the vacuum logic might think a file is "old enough to delete" when it was actually just created.
* Action: Ensure all nodes in your cluster are synced via NTP.
Summary Checklist
1. Increase Vacuum Buffer: Set lake_autovacuum_grace_period_minutes to a higher value.
2. Verify Leader/Follower Sync: Ensure the FE you are connected to is not lagging (SHOW FRONTENDS).
3. Check MV Status: Run ALTER MATERIALIZED VIEW <name> ACTIVE to ensure the metadata state is fresh across all nodes.
4. Check Version: If you are on an early v3.x release, consider upgrading to the latest bugfix release (e.g., v3.2.x or v3.3.x), as there were significant fixes for "Lake metadata not found" race conditions.
References
• faq/shared_data_faq.md
• administration/management/FE_configuration.md
• knowledge/admin_and_operation/shared_data_compaction.md
References
• administration/management/FE_configuration.md
• faq/shared_data_faq.md
• administration/Meta_recovery.mdRocky
09/08/2026, 4:21 PMKenneth Oh
09/08/2026, 4:46 PMPlanner:
- -- Parser[1] 0
- -- Total[1] 16s55ms
- -- Analyzer[1] 16s52ms
- -- Lock[1] 0
- -- AnalyzeDatabase[1] 0
- -- AnalyzeTemporaryTable[1] 0
- -- AnalyzeTable[1] 16s52ms
- -- Transformer[1] 0
- -- Optimizer[1] 2ms
- -- MVPreprocess[1] 1ms
- -- MVChooseCandidates[1] 0
- -- MVGenerateMvPlan[1] 0
- -- AnalyzeDatabase[1] 0
- -- AnalyzeTemporaryTable[1] 0
- -- AnalyzeTable[1] 0
- -- MVTextRewrite[1] 0
- -- MVPrepareRelatedMVs[1] 0
- -- MVTimelinessUpdateInfo[1] 0
- -- MVProcessWithView[1] 0
- -- MVTextRewrite[1] 0
- -- RuleBaseOptimize[1] 0
- -- CostBaseOptimize[1] 0
- -- PhysicalRewrite[1] 0
- -- DynamicRewrite[1] 0
- -- PlanValidate[1] 0
- -- TypeChecker[1] 0
- -- ConditionalTypeChecker[1] 0
- -- CTEUniqueChecker[1] 0
- -- InputDependenciesChecker[1] 0
- -- ColumnReuseChecker[1] 0
- -- ExecPlanBuild[1] 0
- -- Pending[1] 0
- -- Prepare[1] 0
- -- Deploy[1] 5ms
- -- DeployLockInternalTime[1] 5ms
- -- DeploySerializeConcurrencyTime[2] 0
- -- DeployStageByStageTime[6] 0
- -- DeployWaitTime[6] 4ms
- -- DeployAsyncSendTime[17] 0
- -- DeploySerializeTime[5] 0
- -- DeployScanRanges[1] 0
- MVGlobalCacheStats
- my_mv: Rewrite Succeed
- MVPlanCacheStats: CacheStats{hitCount=1768260, missCount=41, loadSuccessCount=41, loadFailureCount=0, totalLoadTime=122151674000, evictionCount=0, evictionWeight=0}
- DeployDataSize: 101514Rocky
09/08/2026, 4:46 PMAnalyzeTable phase of the Analyzer, which occurs before the Optimizer even attempts to rewrite the query using a Materialized View.
Even though your MVPlanCache is hitting (1.7M hits), the FE must still perform a structural analysis of your base tables in the original query to ensure the schemas match and to calculate the cache key. In a Shared-data (Lake) cluster, AnalyzeTable is often slow because the FE is fetching partition/file metadata or statistics from the object store (S3).
To cache this metadata longer and skip the 16s analysis, apply the following settings:
1. Enable Global Query Plan Cache (Recommended)
If your application sends the same or similar SQL strings, you can cache the entire result of the Analyzer and Optimizer. This bypasses the AnalyzeTable phase entirely for subsequent hits.
* Variable: SET GLOBAL enable_query_plan_cache = true;
* Effect: The FE will store the completed execution plan in memory, indexed by the SQL string. This is the most effective way to eliminate a 16s "Analyze" delay.
2. Enable MV Text-Match Rewrite
If your query matches the MV definition (or a sub-query of it) exactly, StarRocks can skip heavy structural analysis by comparing the SQL text/AST directly.
* Variable: SET GLOBAL enable_materialized_view_text_match_rewrite = true; (Available in v3.2.5+, v3.3+)
* Effect: Significantly reduces the time the Analyzer spends resolving table structures if the text matches.
3. Increase the MV Plan Cache Size
Your profile shows 41 misses. If you have a large number of MVs or different query variations, the default cache size (1000) might be too small, causing evictions.
* FE Config (fe.conf): mv_plan_cache_max_size = 5000 (Default is 1000).
* Variable: Ensure enable_materialized_view_plan_cache = true; is set.
4. Optimize Statistics Fetching
The AnalyzeTable phase is often slow because it's trying to fetch or update statistics for the base tables.
* Check Sync vs Async: Ensure your statistics are not being collected synchronously during query time.
* SHOW ANALYZE STATUS; — Check if there are failed or long-running tasks.
* Reduce Column Stats: If you have thousands of columns, the FE spends time fetching stats for all of them. Consider only analyzing columns used in joins/filters:
sql
CREATE ANALYZE TABLE <table_name> (col1, col2) ...
5. Shared-Data (Lake) Specifics
Since you are using Lake tables, the FE caches tablet and partition metadata in its JVM heap.
* FE Memory: Ensure your FE has enough memory (-Xmx). If the number of tablets/partitions in your base tables is in the millions, the 16s delay is likely the FE paging metadata from S3 because it was evicted from the heap.
_ _Rule of thumb:* 16GB for <1M tablets, 64GB for 2-5M tablets.
* Lake Metadata Cache: In v3.3+, you can enable the enable_mv_query_context_cache to further speed up the rewrite context.
Summary Checklist:
1. Run SET GLOBAL enable_query_plan_cache = true; to skip the Analyzer for repeated queries.
2. Run SET GLOBAL enable_materialized_view_text_match_rewrite = true; to speed up structural matching.
3. Check SHOW FRONTENDS to ensure the FE is not hitting a "High Memory" state, which would cause it to evict the metadata you are trying to cache.
References
• administration/management/FE_configuration.md
• sql-reference/System_variable.md
• using_starrocks/async_mv/feature-support-asynchronous-materialized-views.md
• using_starrocks/caching/query_cache.md
ReferencesRocky
09/08/2026, 4:46 PMKenneth Oh
09/08/2026, 6:00 PMRocky
09/08/2026, 6:00 PMAnalyzeTable duration, this is likely a combination of Iceberg metadata scanning slowness exacerbated by FE metadata cache evictions.
Here is how to determine which one is the primary culprit and how to fix it:
1. How to tell if it's Iceberg Metadata Slowness
The AnalyzeTable phase for Iceberg involves two heavy tasks: fetching the table snapshot from the Metastore (HMS/Glue) and parsing the manifest files from S3.
* The Symptom: Only queries hitting large Iceberg tables or Materialized Views (MVs) based on them are slow.
* The Cause: If your Iceberg table has thousands of small manifest files or frequent updates, the FE must download and parse these before it can even begin the "Optimizer" phase.
* Diagnostic: Run SHOW FRONTENDS and look at the LastHeartbeat and Status. If the FE is otherwise healthy but the query is slow, it's a metadata scanning issue.
Fixes for Iceberg Slowness:
* Enable Disk Cache for Metadata (v3.3+): By default, metadata is only in memory. Enable disk caching to persist parsed manifests across FE restarts and memory pressure:
properties
-- In fe.conf
enable_iceberg_metadata_disk_cache = true
iceberg_metadata_memory_cache_capacity = 2147483648 -- Increase to 2GB (default 512MB)
* Use Distributed Planning (v3.3+): If your Iceberg table has millions of files, set plan_mode = 'distributed'. This offloads the heavy manifest parsing from the single FE to the BE/CN nodes.
2. How to tell if it's FE Overload (Memory/GC)
If the FE's JVM heap is nearly full, the "Analyzer" phase slows down because every new metadata object created triggers a Garbage Collection (GC) cycle.
* The Symptom: Even simple DESCRIBE TABLE or queries on small tables start taking several seconds.
* The Cause: Your FE might be hitting the -Xmx limit. Your AnalyzeTable time of 16s is a classic sign of the JVM "thrashing" (spending all its time in GC).
* Diagnostic: Run this on your FE node:
bash
jstat -gcutil <FE_PID> 1000 5
If the O (Old Generation) column is >90% and FGCT (Full GC Time) is increasing, your FE is overloaded.
Fixes for FE Overload:
* Increase JVM Heap: MVs and Lake metadata require significant memory. Increase -Xmx and -Xms in fe.conf to at least 32GB or 64GB if you have millions of tablets/files.
* Enable Query Plan Cache: This is the "silver bullet" for your specific problem. It caches the entire analyzed plan, bypassing the 16s AnalyzeTable phase for identical queries:
sql
SET GLOBAL enable_query_plan_cache = true;
3. Check for "Statistics Fetching" Bottleneck
The AnalyzeTable phase also fetches column statistics. If your base table has thousands of columns, the FE may be spending seconds just loading the stats for those columns.
* Fix: Ensure you only collect statistics for columns used in filters or joins. Use SHOW ANALYZE STATUS to see if there are massive background statistics tasks consuming FE resources.
Summary Recommendation
1. Immediate relief: Run SET GLOBAL enable_query_plan_cache = true;. If the 16s disappears on the 2nd run, the bottleneck is the Analyzer/Metadata phase.
2. Long-term: Increase FE Memory (-Xmx) and enable the Iceberg disk cache (enable_iceberg_metadata_disk_cache = true) in fe.conf.
References
• data_source/catalog/iceberg/iceberg_catalog.md
• knowledge/trouble_shooting/fe_memory_problems.md
• using_starrocks/caching/query_cache.md
• faq/fe_mem_faq.md
References
• data_source/catalog/iceberg/iceberg_catalog.mdRocky
09/08/2026, 6:00 PMKenneth Oh
09/08/2026, 6:02 PMenable_query_plan_cache how do i avoid a single bad cache avoid using MV after it has been fixedRocky
09/08/2026, 6:02 PMAnalyzeTable phase), you can use the following methods to force a fresh analysis and ensure your fixed Materialized View (MV) is picked up.
1. Manual Bypass via SQL Comment (Easiest)
The Query Plan Cache is indexed by a hash of the exact SQL string. If you change the text of the query, the hash changes, and the FE is forced to perform a full analysis.
* Action: Add a unique comment to your query.
sql
-- Add a random string or timestamp to force a cache miss
SELECT /_ refresh_fix_123 _/ * FROM my_table WHERE ...
2. Disable the Cache for the Current Session
If you want to ensure your current session always sees the most up-to-date metadata while you are debugging, disable the plan cache temporarily.
* Variable:
sql
SET enable_query_plan_cache = false;
-- Run your query to ensure it rewrites correctly
SET enable_query_plan_cache = true;
* Inline Hint: You can also disable it for a single execution using a hint:
sql
SELECT /_+ SET_VAR(enable_query_plan_cache=false) _/ * FROM my_table ...
3. Force Invalidation via Metadata Change
The plan cache is designed to invalidate automatically when the schema of a base table or the definition of an MV changes. If the cache is "stuck" even after you think you've fixed the MV, you can "nudge" the metadata:
* Toggle MV Status: Briefly set the MV to inactive and back to active. This forces the FE to clear its cached metadata state for that object.
sql
ALTER MATERIALIZED VIEW my_mv_name INACTIVE;
ALTER MATERIALIZED VIEW my_mv_name ACTIVE;
* Refresh Statistics: Sometimes a "bad plan" is chosen because of stale statistics. Running a manual ANALYZE can sometimes trigger a cache refresh:
sql
ANALYZE TABLE base_table_name;
4. Ensure MV Timeliness (Grace Period)
If your "fix" was refreshing the MV, the cache might still consider the plan "valid" if the query's query_rewrite_consistency or mv_rewrite_staleness_limit settings allow for some staleness.
* Action: Ensure your session variable materialized_view_rewrite_mode is set to FORCE or DEFAULT to ensure it checks for the latest data version.
Summary of Differences
* enable_query_plan_cache: Caches the entire FE plan (Parser + Analyzer + Optimizer). If this is on, StarRocks doesn't even look at the MV logic—it just returns the old plan. Use Option 1 or 2 to bypass this.
* enable_materialized_view_plan_cache: Only caches the rewrite logic within the Optimizer. This cache is more intelligent and usually invalidates when the MV version changes, but if it doesn't, Option 3 (toggling INACTIVE/ACTIVE) is the best way to clear it.
References
• using_starrocks/async_mv/use_cases/query_rewrite_with_materialized_views.md
• sql-reference/System_variable.md
• using_starrocks/caching/query_cache.md
References
• using_starrocks/caching/query_cache.md
• faq/Sql_faq.md
• using_starrocks/query_feedback.md
• administration/sql_digest.mdKenneth Oh
09/08/2026, 6:49 PMRocky
09/08/2026, 6:49 PMiceberg_metadata_memory_cache_capacity still specifically affects memory (RAM), even when enable_iceberg_metadata_disk_cache is set to true.
StarRocks uses a two-level hierarchical cache for Iceberg metadata. Here is how these settings interact:
1. The Memory Layer (iceberg_metadata_memory_cache_capacity)
* What it does: Sets the maximum RAM (default 512MB) dedicated to storing deserialized Iceberg metadata objects.
* Behavior with Disk Cache: This remains the "Hot" layer. StarRocks always checks memory first. If the metadata is hit here, it is returned instantly without any I/O.
* Impact: If this value is too small, metadata will be frequently evicted from RAM to the disk cache, causing a slight latency penalty as the FE has to reload and deserialize it from the local disk.
2. The Disk Layer (enable_iceberg_metadata_disk_cache)
* What it does: Enables the "Warm" layer on the FE's local storage (default 2GB).
* Interaction: When an item is evicted from the Memory Cache (due to the LRU policy or reaching the memory capacity), it is "spilled" to the Disk Cache rather than being discarded.
* Retrieval flow:
1. Check Memory.
2. If miss, check Disk.
3. If hit on Disk, load it back into Memory (subject to the memory capacity limit) and return it.
4. If miss on Disk, fetch from S3/HDFS and load into Memory.
Summary of Impact
Setting | Affects | Purpose
iceberg_metadata_memory_cache_capacity | Memory (FE Heap) | Defines the size of the fastest access layer. High hits here prevent disk I/O.
iceberg_metadata_disk_cache_capacity | Local Disk | Defines how much metadata can be kept locally to avoid slow S3/HDFS calls.
Recommendation:
If you have a 16s delay in the Analyzer, it means your metadata is likely not in either cache.
1. Keep enable_iceberg_metadata_disk_cache = true.
2. Increase iceberg_metadata_memory_cache_capacity to 2GB or higher (e.g., 2147483648) if your FE has enough JVM heap. This ensures more "hot" metadata stays in RAM and doesn't require even local disk lookups.
References
• data_source/catalog/iceberg/iceberg_catalog.md
• data_source/feature-support-data-lake-analytics.md
References
• data_source/catalog/iceberg/iceberg_catalog.md
• data_source/feature-support-data-lake-analytics.mdKenneth Oh
09/08/2026, 6:52 PMRocky
09/08/2026, 6:52 PM86500 seconds).
* Disk Cache: 7 days (604800 seconds).
If you want to keep metadata longer even for infrequently accessed tables, you can increase these in `fe.conf`:
properties
iceberg_metadata_memory_cache_expiration_seconds = 172800 # 2 days
iceberg_metadata_disk_cache_expiration_seconds = 2592000 # 30 days
2. Active Refresh (The "Auto-Stayout" Logic)
To avoid the slowness of "going to Iceberg" during a query, StarRocks keeps the cache "alive" and updated in the background if the table is frequently used.
* Background Refresh: As long as a table has been accessed within the last 24 hours, StarRocks will poll the Metastore (HMS/Glue) every 10 minutes to see if there are new snapshots.
* Freshness Window: Within the first 60 seconds of a metadata refresh, StarRocks considers the cache "perfectly fresh" and won't even trigger a background check.
3. How to avoid "Going to Iceberg" repeatedly
If you are seeing repeated 16s AnalyzeTable times, it means the metadata is likely being evicted too early (due to size limits) or the background refresh is failing.
A. Increase Capacity (to prevent LRU eviction)
If your metadata is larger than the cache capacity, StarRocks will delete old metadata to make room for new ones, forcing a re-fetch later.
properties
# Increase these if you have many Iceberg tables/partitions
iceberg_metadata_memory_cache_capacity = 2147483648 # 2GB (Default 512MB)
iceberg_metadata_disk_cache_capacity = 10737418240 # 10GB (Default 2GB)
B. Extend the "Active" Window
If you have tables queried once every few days, the background refresh will stop after 24 hours. You can extend this so StarRocks keeps polling for updates indefinitely:
properties
# Keep background refreshing for 7 days after the last access
background_refresh_metadata_time_secs_since_last_access_secs = 604800
Summary Recommendation
To ensure you almost never wait for a remote Iceberg scan:
1. Enable the Disk Cache (enable_iceberg_metadata_disk_cache = true).
2. Increase Memory Capacity to at least 2GB.
3. Ensure Background Refresh is ON (enable_background_refresh_connector_metadata = true).
References
• data_source/catalog/iceberg/iceberg_catalog.md
• data_source/feature-support-data-lake-analytics.md
• administration/management/FE_configuration.md
References
• data_source/catalog/iceberg/iceberg_catalog.md
• data_source/feature-support-data-lake-analytics.md
• administration/management/FE_configuration.mdKenneth Oh
09/08/2026, 7:35 PMRocky
09/08/2026, 7:36 PMmax_external_metadata_scan_concurrency_per_be
* Action: Add/Update this in your fe.conf and restart FE (or use ADMIN SET FRONTEND CONFIG if supported in your version).
properties
# Increase from 20 to 50 or 100 depending on CN resources
max_external_metadata_scan_concurrency_per_be = 100
2. Switch to Local Planning (For Smaller Tables)
If your table is not extremely large but is still hitting this limit, you can force the FE to handle the metadata parsing locally. This bypasses the BE/CN task limit entirely.
* SQL Command:
sql
SET plan_mode = 'local';
-- Then run your query to populate the cache
3. Increase Metadata Collection Timeout
Sometimes the tasks aren't just "too many," they are also taking too long, causing slots to stay "occupied" for longer.
* Session Variable:
sql
SET metadata_collect_query_timeout = 300; -- Increase to 5 minutes
4. Optimize Partition Pruning
The number of "slots" used is proportional to the number of manifest files StarRocks needs to read.
* Check: Ensure your query has WHERE clauses on partition columns. If you are doing a full table scan on a table with thousands of partitions/manifests, you will easily hit the 20-task limit.
Why isn't the metadata being cached?
Metadata is only written to the cache after a successful collection job.
1. Query starts -> FE realizes cache is empty.
2. FE triggers a metadata collection job (distributed to BEs).
3. BEs reject tasks with TOO_MANY_TASKS.
4. The job fails -> FE discards the partial results.
5. Result: The cache remains empty, and the next query starts the failing process all over again.
Recommendation: Temporarily set plan_mode = 'local', run the query once successfully to fill the cache, and then increase max_external_metadata_scan_concurrency_per_be in your FE config to prevent future misses from failing.
References
• data_source/catalog/iceberg/iceberg_catalog.md
• sql-reference/System_variable.md
• administration/management/FE_configuration.md
References
• administration/management/BE_configuration.md
• sql-reference/System_variable.md
• administration/management/FE_configuration.mdKenneth Oh
09/08/2026, 8:09 PMRocky
09/08/2026, 8:09 PMmax_external_metadata_scan_concurrency_per_be is a valid FE configuration in StarRocks 4.1.1 (and versions 3.3+).
The error message you are seeing—`Exceed concurrency limit: 20 backend` and `CN-6 already had all 20 external metadata-collection slots occupied`—confirms that you are hitting the default internal throttle for distributed metadata planning.
Why this happens
In StarRocks 3.x and 4.x, for large Iceberg tables, the FE offloads the parsing of manifest files to the backends (BE/CN). To prevent a single metadata-heavy query (or many concurrent ones) from exhausting BE resources, StarRocks limits each BE to 20 concurrent metadata collection tasks by default.
How to fix it
You can increase this limit by adding the following to your fe.conf and restarting the FE, or by setting it dynamically if your version supports it:
1. Check the current value and exact name:
sql
ADMIN SHOW FRONTEND CONFIG LIKE '%metadata%scan%';
_(In most 4.x versions, the parameter is exactly max_external_metadata_scan_concurrency_per_be)_.
2. Increase the limit in `fe.conf`:
properties
# Increase from 20 to 100 to allow more parallel metadata processing
max_external_metadata_scan_concurrency_per_be = 100
Alternative Workarounds
If you cannot restart the FE immediately, you can use these session-level variables to bypass the issue:
* Switch to Local Planning: For tables where the metadata isn't "massive" (i.e., not millions of files), force the FE to parse metadata locally instead of sending tasks to the BE.
sql
SET plan_mode = 'local';
-- Run your query; the FE will handle metadata parsing without BE slots.
* Increase Metadata Timeout: If the "slots" are occupied because tasks are slow (not just numerous), increase the timeout to allow them to finish rather than piling up:
sql
SET metadata_collect_query_timeout = 300;
Summary
The parameter is valid and is the direct cause of the 20 backend limit. Increasing it to 50 or 100 is a common adjustment for large-scale Iceberg environments in StarRocks 4.1.
References
• administration/management/FE_configuration.md
• data_source/catalog/iceberg/iceberg_catalog.md
• sql-reference/System_variable.md
References
• data_source/catalog/iceberg/iceberg_catalog.md
• faq/resource_isolation_faq.md
• administration/management/FE_configuration.md
• faq/Sql_faq.mdKenneth Oh
09/08/2026, 8:11 PMRocky
09/08/2026, 8:11 PMExceed concurrency limit: 20 backend.
5. Job Aborted: The FE receives the failure from the CN and aborts the entire metadata collection job.
6. No Cache Write: Because the job failed, nothing is written to the memory or disk cache.
7. Repeat: The next query arrives, sees the cache is still empty, and tries the same failing process again.
2. How to break the loop
You must allow at least one metadata collection job to succeed for the cache to be populated. Once the cache is full, subsequent queries will use the cache and won't trigger the "distributed scan" that uses those 20 slots.
Strategy A: Increase the FE Concurrency Limit
This is the most direct fix for your 4.1.1 cluster. This parameter is an FE configuration.
* Parameter: max_external_metadata_scan_concurrency_per_be
* Default: 20
* Action: Increase this to 100 or higher in fe.conf.
properties
max_external_metadata_scan_concurrency_per_be = 100
_Note: After updating fe.conf, you usually need to restart the FE, or try ADMIN SET FRONTEND CONFIG ("max_external_metadata_scan_concurrency_per_be" = "100");._
Strategy B: Use "Local Planning" to Warm the Cache
If you cannot restart the FE right now, force a single query to collect metadata locally on the FE instead of distributing it to the CNs. This avoids the "20 slot" limit on the backends entirely.
1. Run this in your session:
sql
SET plan_mode = 'local';
SELECT count(*) FROM metric_table; -- This will be slow but will populate the cache.
2. Once that query finishes, the metadata is now in the cache.
3. Set it back: SET plan_mode = 'auto';. Subsequent queries will now hit the cache and be fast.
Strategy C: Check Background Refresh
Ensure your FE is trying to keep the cache alive in the background so you don't hit this during user queries.
* enable_background_refresh_connector_metadata = true (Default is true).
* If your metadata is very large, the background refresh might also be hitting the same 20-slot limit. Increasing the configuration in Strategy A is the permanent fix.
Summary
The metadata isn't being cached because partial metadata is never cached. If the task hits the 20-slot limit on even one CN, the entire "metadata load" is discarded. You must increase max_external_metadata_scan_concurrency_per_be to allow these large metadata loads to finish.
References
• administration/management/BE_configuration.md
• administration/management/FE_configuration.mdKenneth Oh
09/08/2026, 8:12 PMRocky
09/08/2026, 8:13 PMConfig 'max_external_metadata_scan_concurrency_per_be' does not exist or is not mutable indicates that this specific configuration in StarRocks 4.1.1 is Immutable.
Immutable parameters cannot be changed at runtime using ADMIN SET FRONTEND CONFIG. They must be added to the fe.conf file and require an FE restart to take effect.
1. Permanent Fix: Update fe.conf
The default limit of 20 concurrent metadata scan tasks per backend is often too low for high-concurrency environments or very large Iceberg tables.
1. Open fe/conf/fe.conf on your leader FE.
2. Add or update the following line:
properties
# Increase the limit to 100 to allow more parallel metadata tasks
max_external_metadata_scan_concurrency_per_be = 100
3. Restart the FE.
2. Immediate Workaround: Use Local Planning
To address the issue immediately without a restart and allow the cache to populate, you can force the FE to parse the metadata locally. This bypasses the distributed task slots on the Compute Nodes (CNs).
Run this in your session before querying the table:
sql
-- Force the FE to handle metadata locally (bypasses the 20-slot BE limit)
SET plan_mode = 'local';
-- Run a query to trigger metadata collection and fill the cache
SELECT count(*) FROM metric_table;
-- Optional: Set it back to auto once the cache is warmed up
SET plan_mode = 'auto';
Note: Local planning is slower for the very first query on massive tables, but it will successfully finish and write the metadata to the cache.
Why the metadata isn't being cached
Metadata is only cached after a successful collection job.
1. Cache Miss: Your query triggers a "Distributed Metadata Scan."
2. Task Rejection: The FE sends tasks to the CNs, but they are rejected because the "20 slots" are already full.
3. Failure: The collection job fails and returns the error you see.
4. No Cache Write: Because the job failed, StarRocks does not save any partial metadata to the cache.
5. Cycle: Every subsequent query experiences a cache miss and fails again, preventing the cache from ever being populated.
Verification
To see the current value and check if it is mutable in your specific build, run:
sql
ADMIN SHOW FRONTEND CONFIG LIKE 'max_external_metadata_scan_concurrency_per_be';
If the IsMutable column is false, you must use the fe.conf method above.
References
• administration/management/FE_configuration.md
• data_source/catalog/iceberg/iceberg_catalog.md
• sql-reference/System_variable.md
References
• using_starrocks/Cost_based_optimizer.md
• data_source/catalog/iceberg/iceberg_catalog.md
• sql-reference/System_variable.md
• data_source/feature-support-data-lake-analytics.mdKenneth Oh
09/08/2026, 8:24 PMRocky
09/08/2026, 8:24 PMr8gd.4xlarge nodes (16 vCPUs, 128 GB RAM) querying Iceberg on S3, a realistic and safe value for max_external_metadata_scan_concurrency_per_be is 100 to 128.
Why the default (20) is too low for you
The "Distributed Metadata Plan" works by breaking down a large Iceberg table's manifest list into many small tasks (parsing individual manifest files).
* The Burst Effect: If a query needs to scan 200 manifest files, StarRocks tries to distribute these tasks across your backends.
* The Rejection: Even with a single query, if the FE sends more than 20 tasks to a single BE at once, that BE will reject the 21st task with the error you saw.
* The Failure: When one task is rejected, the entire metadata collection job fails, which prevents the metadata from being cached, leading to a "failure loop."
Logic for the Recommended Value (100–128)
For r8gd.4xlarge nodes, here is how to calculate a realistic limit:
1. CPU Core Count: You have 16 vCPUs. Metadata scan tasks are primarily CPU-bound (parsing Avro/Parquet) and I/O-bound (waiting for S3).
2. Concurrency per Core: In StarRocks, it is standard to allow 4 to 8 concurrent I/O-heavy tasks per CPU core.
_ _Calculation:* 16 vCPUs × 8 tasks = 128.
3. Memory Impact: Metadata parsing is very memory-efficient. At a concurrency of 128, you are unlikely to see any significant memory pressure on a 128 GB node.
Suggested Configuration
Since your cluster reported the config is not mutable at runtime, you must add it to your fe.conf on the leader FE and restart the FE process:
properties
# Add to fe.conf
max_external_metadata_scan_concurrency_per_be = 128
When to go higher?
If you have very high query concurrency (e.g., 50+ users querying different Iceberg tables simultaneously), you can safely push this to 256. Because these tasks spend most of their time waiting for S3 data to arrive, the actual CPU utilization remains manageable even at higher concurrency levels.
Summary of Benefits
* Populates Cache: Allows large metadata loads to actually finish so they can be stored in the FE's memory/disk cache.
* Stability: Stops the "Exceed concurrency limit" errors that are currently killing your queries.
* Performance: Leverages the full parallel parsing power of your 16-core r8gd nodes.
References
• administration/management/FE_configuration.md
• data_source/catalog/iceberg/iceberg_catalog.md
• administration/management/BE_configuration.md
• using_starrocks/Cost_based_optimizer.md
References
• administration/management/BE_configuration.md
• administration/management/FE_configuration.mdKenneth Oh
09/08/2026, 9:26 PMRocky
09/08/2026, 9:27 PMmax_external_metadata_scan_concurrency_per_be valid in 4.1.1?
No. If it does not appear in ADMIN SHOW FRONTEND CONFIG, it means that exact parameter name is not a valid configuration for the StarRocks 4.1.1 FE.
While this parameter existed in some 3.x/4.x development branches and older versions to control the number of manifest-parsing tasks sent to each backend, it may have been renamed or the logic was changed in the official 4.1 release. In 4.1, many metadata-related tasks were integrated into the newer unified scanning framework.
2. Would adding it to fe.conf break the deployment?
No, it will not break the deployment.
StarRocks FE is designed to be resilient to configuration errors in the fe.conf file.
* Behavior: If you add an unknown key to fe.conf, the FE will simply log a warning in fe.log (e.g., Unknown configuration: max_external_metadata_scan_concurrency_per_be) and continue to start normally.
* Exception: The only time a config breaks a deployment is if you misconfigure a critical system parameter (like priority_networks or rpc_port) or use a malformed value (like text for a number). Adding an unrecognized string is safe.
3. How to address the "20 backend" concurrency limit in 4.1.1
Since you are seeing errors about a concurrency limit of 20, you should look for these parameters in ADMIN SHOW FRONTEND CONFIG instead:
* max_external_metadata_scan_concurrency: This is the more common name for the total global concurrency of metadata scans.
* metadata_scan_concurrency: Check if this is available as a session variable (SHOW VARIABLES LIKE 'metadata_scan_concurrency';). If it is, you can set it globally without a restart:
sql
SET GLOBAL metadata_scan_concurrency = 128;
* max_hdfs_scanner_num (BE Config): On the Backend side, this limits concurrent remote scanners. Check your be.conf or run SHOW BACKEND CONFIG LIKE 'max_hdfs_scanner_num';.
Recommendation
1. Check variables first: Run SHOW VARIABLES LIKE '%metadata%'; and ADMIN SHOW FRONTEND CONFIG LIKE '%metadata%'; to see the actual names used in your version.
2. Warm the cache locally: Since your "constant queries" are failing due to the distributed scan limit, use the "Local Planning" workaround to get the first successful metadata load. This bypasses the BE-side limit entirely:
sql
SET plan_mode = 'local';
SELECT count(*) FROM iceberg_table; -- This will load metadata into cache
SET plan_mode = 'auto';
3. Check fe.log: If you add a config and are unsure if it's working, search your fe.log for that parameter name. It will tell you if it's being used or ignored.
References
• faq/Deploy_faq.md
• administration/Meta_recovery.md
• administration/management/FE_configuration.mdKenneth Oh
09/08/2026, 9:59 PMRocky
09/08/2026, 9:59 PMSELECT * FROM iceberg_table), the metadata tasks typically run within the Resource Group assigned to that query.
* How it's matched: StarRocks uses classifiers (user, role, db, etc.) to map your query to a specific resource group (like default_wg or a custom one you created).
* Distributed Planning: In 4.1.1, when the FE performs distributed metadata planning (parsing Iceberg manifests on BEs), those tasks are executed on the Backends. These tasks inherit the resource group context of the parent query so that the CPU and memory used for parsing metadata are accounted for against the user's quota.
2. Background Statistics Collection
If the metadata scan is part of the automatic background statistics collection (used by the CBO):
* These tasks often run in the default_wg or are managed by internal system schedulers that do not strictly follow user-defined resource group limits unless specified.
* In some configurations, background tasks can be mapped to a specific group, but by default, they fall into the system's catch-all group.
3. Materialized View Refreshes
If the metadata scan is part of an asynchronous Materialized View refresh:
* It runs in the default_mv_wg (unless you manually assigned a different resource group to that MV using the resource_group property).
Regarding your specific Error
The error you saw earlier (Config 'max_external_metadata_scan_concurrency_per_be' does not exist) and the limit of 20 you are hitting are likely related to an internal hard-coded limit or a different FE configuration rather than a Resource Group quota.
In StarRocks 4.1.x, look for these instead:
* max_remote_file_background_scan_concurrency: An FE config that might control background metadata tasks.
* Session Variable: Try SET metadata_scan_concurrency = 100; before your query. This variable often overrides the default limit for the duration of your session.
How to verify which group is being used:
You can verify which resource group a specific metadata-heavy query used by checking the audit log:
sql
SELECT queryId, ResourceGroup, ErrorCode, ErrorMsg
FROM starrocks_audit_db__.starrocks_audit_tbl__
WHERE queryId = 'your_failed_query_id';
If the ResourceGroup column shows default_wg, then your metadata tasks were competing for resources in the default pool.
References
• administration/management/resource_management/resource_group.mdKenneth Oh
09/08/2026, 10:01 PMRocky
09/08/2026, 10:01 PMetl resource group.
Here is the breakdown of how StarRocks 4.1.1 handles this:
1. Synchronous Query Planning (User-triggered)
When User A submits a query, StarRocks first assigns it to a resource group (e.g., etl) based on the classifier. If the query requires a "Distributed Plan" (where BEs parse Iceberg manifests):
* Inheritance: The FE dispatches metadata scan tasks to the BEs. These tasks carry the resource_group_id of the originating query.
* Resource Accounting: The BEs execute these tasks using the CPU and memory quotas allocated to the etl group.
* Concurrency Limits: Even though it is in the etl group, it is still subject to internal task limits (like the one you are hitting). The concurrency limit of 20 is likely a backend-level safeguard for that specific task type, regardless of which group it belongs to.
2. Asynchronous / Background Tasks
If the "metadata collection" is not part of a specific query but is instead a background process, it does not use the etl group:
* Background Metadata Refresh: If you have enable_background_refresh_connector_metadata set to true, the FE polls and refreshes metadata periodically. These tasks typically run in the default_wg.
* Statistics Collection: Automatic background stats collection for the CBO (Cost-Based Optimizer) also typically runs in the default_wg.
How to verify
You can confirm which resource group a specific metadata task used by looking at the BE logs or the Audit Log:
1. Audit Log: Check the ResourceGroup column for the query ID that triggered the collection.
sql
SELECT ResourceGroup, QueryId, PlanCpuCost, PlanMemCost
FROM starrocks_audit_db*.starrocks_audit_tbl*
WHERE User = 'User A';
2. Explain Verbose: Before running a large query, use EXPLAIN VERBOSE <query>. It will show the Estimating Resource Group at the top of the plan.
Summary
* Query-linked metadata scan: Runs in etl.
* System/Background refresh: Runs in default_wg.
Since you are hitting a concurrency limit of 20, the system is essentially saying, "Even though the etl group has CPU available, I will not allow more than 20 concurrent manifest-parsing tasks per BE to prevent a single query from overwhelming the I/O subsystem." This is why increasing that concurrency limit (as discussed in the previous turn) is necessary even if your resource group has plenty of cpu_weight.
References
• administration/management/resource_management/resource_group.md
• administration/management/monitoring/metrics.md
• faq/resource_isolation_faq.mdKenneth Oh
09/08/2026, 10:05 PMRocky
09/08/2026, 10:05 PMmax_external_metadata_scan_concurrency_per_be, was an experimental name in some development branches. In the official 4.1.1 release, the parameter is typically:
* max_external_metadata_scan_concurrency (Global FE config)
* It defaults to 20 in many versions.
The reason it does not show up in ADMIN SHOW FRONTEND CONFIG is that it is a static configuration. You must add it to your fe.conf and restart the FE for it to take effect. It is not a dynamic variable that can be changed via SQL.
2. Why are you hitting the default_wg limit?
Even though your main query starts in the etl_wg, the "Metadata Collection Job" is a separate internal process:
* Internal Execution: In 4.1.1, when the FE performs a "Distributed Plan," it generates internal sub-tasks to parse Iceberg manifests on the BEs.
* Resource Group Mapping: These internal metadata tasks are often treated as system-level tasks or internal queries. If they do not explicitly carry the session context of the parent query (which can happen in certain code paths in 4.1.1), they fall back to the default_wg.
* The "20" Limit: If you have manually capped your default_wg at 20, and these metadata tasks are falling into it, you will hit that ceiling. Furthermore, the global FE limit for these jobs also defaults to 20, which matches the behavior you are seeing.
3. The null at org.apache.iceberg.MetadataParser.parse Error
This specific stack trace indicates that the Backend (BE) failed to parse the Iceberg metadata file.
* Cause: When the concurrency limit is hit or the BE is under high I/O pressure, the input stream passed to the Iceberg parser can become null or the connection to the object store (S3/HDFS) can be dropped.
* Result: The Iceberg library throws a NullPointerException inside MetadataParser.parse, which StarRocks reports as "Failed to execute metadata collection job."
Recommended Actions
1. Increase Global Concurrency: Add the following to your fe.conf and restart the FE:
properties
max_external_metadata_scan_concurrency = 100
2. Check the Audit Log: To confirm if these metadata jobs are hitting default_wg, run:
sql
SELECT ResourceGroup, queryType, ErrorMsg
FROM starrocks_audit_db*.starrocks_audit_tbl*
WHERE ErrorMsg LIKE '%metadata collection%'
ORDER BY timestamp DESC;
If ResourceGroup shows default_wg, you need to either increase the concurrency_limit of default_wg or create a classifier that catches these internal tasks (though increasing the global FE config is usually the proper fix).
3. Workaround (No Restart): You can force the FE to parse metadata locally (bypassing the distributed collection job) by setting this session variable:
sql
SET plan_mode = 'local';
Note: This is only recommended for tables with a manageable number of manifest files, as it uses FE memory for parsing.
Summary
The error occurs because the "Metadata Collection Job" is hitting a concurrency limit (likely the global default of 20) and is potentially being throttled by your default_wg settings. Increasing max_external_metadata_scan_concurrency in fe.conf is the standard solution.
References
• faq/resource_isolation_faq.md
• administration/management/resource_management/resource_group.md
• data_source/catalog/iceberg/iceberg_catalog.mdKenneth Oh
09/08/2026, 10:07 PMmax_external_metadata_scan_concurrency in 4.1.1Rocky
09/08/2026, 10:07 PMdefault_wg (default resource group).
Here is the breakdown of why this is happening and why it is conflicting with your etl_wg query:
1. Why it uses default_wg
While your query is initiated by a user in the etl_wg, the metadata collection job is an internal task generated by the Frontend (FE) to scan Iceberg manifest files.
* In current versions, these internal "Distributed Planning" sub-tasks are often executed as system-level tasks.
* Because they are treated as internal system maintenance or background planning tasks, they do not inherit the resource group of the parent session. Instead, they fall back to the default_wg.
* Since you have a 20 query concurrency limit on your default_wg, these metadata jobs are being queued or rejected by the resource group manager, causing the "Failed to execute metadata collection job" error.
2. The Internal Limit of 20
Independent of your default_wg settings, StarRocks has a hard-coded or static configuration limit for these jobs.
* The parameter is max_external_metadata_scan_concurrency.
* It defaults to 20 in many 4.x/3.x releases.
* This limit is cluster-wide or per-FE. When your default_wg is also set to 20, you are hitting a double bottleneck.
3. How to fix this
To resolve the StarRocksConnectorException, you should move these tasks out of the bottleneck or increase the limits:
* Option A: Increase default_wg Concurrency
If you must use Distributed Planning, you need to increase the concurrency of the default_wg to accommodate both normal queries and these internal metadata jobs.
sql
ALTER RESOURCE GROUP default_wg WITH ('concurrency_limit' = '100');
* Option B: Adjust FE Static Config (Requires Restart)
Add the following to your fe.conf to increase the internal job pool size:
properties
max_external_metadata_scan_concurrency = 100
* Option C: Bypass Distributed Planning (Session Level)
If your Iceberg table metadata isn't massive (e.g., fewer than a few thousand manifest files), you can force the FE to parse the metadata locally. This avoids the "metadata collection job" (BE-side scan) entirely:
sql
SET plan_mode = 'local';
-- Then run your query
SELECT * FROM iceberg_table ...;
Summary of the Error
The null at org.apache.iceberg.MetadataParser.parse error occurs because the concurrency limit (20) was reached. When the limit is hit, the internal task scheduler fails to provide a valid execution context or stream to the Iceberg parser, leading to a NullPointerException (reported as null).
References
• administration/management/FE_configuration.mdKenneth Oh
09/09/2026, 2:18 AMRocky
09/09/2026, 2:19 AMsql
-- Check current value
ADMIN SHOW FRONTEND CONFIG LIKE 'mv_plan_cache_thread_pool_size';
-- Increase it in fe.conf (requires restart) to speed up cache building on new nodes
mv_plan_cache_thread_pool_size = 10
* Ensure Cache is Enabled:
Verify that the plan cache hasn't reached its limit.
sql
ADMIN SHOW FRONTEND CONFIG LIKE 'mv_plan_cache_max_size'; -- Default is 1000
* Post-Image Reload (v3.5+ / 4.x):
Ensure enable_mv_post_image_reload_cache is set to true (default). This ensures that whenever an FE node loads a metadata image (which happens when a new node joins or restarts), it triggers a reload of the MV cache.
3. Troubleshooting & Verification
To confirm why a specific FE is not rewriting, connect directly to that node and run:
1. Check MV Status:
Ensure the MV is seen as is_active = true on the new node.
sql
SHOW MATERIALIZED VIEWS LIKE 'your_mv_name';
2. Run EXPLAIN:
Use EXPLAIN on the query. If the rewrite fails, check the "Reason" in the output (in newer versions, this is more detailed).
3. Check FE Logs:
Search the fe.log on the new node for "MvPlanCache" or "MaterializedView" to see if there are errors during the background plan building process (e.g., timeouts or OOMs).
Summary of Actionable Steps
If you frequently add FE nodes and want them ready faster:
1. Increase mv_plan_cache_thread_pool_size in fe.conf.
2. Check if enable_materialized_view_plan_cache is true.
3. Wait: Depending on the number of MVs, it can take several minutes for a new FE to be "fully warm" and capable of rewriting queries.
References
• administration/management/FE_configuration.md
• using_starrocks/async_mv/troubleshooting_asynchronous_materialized_views.md
• using_starrocks/async_mv/use_cases/query_rewrite_with_materialized_views.md
References
• administration/management/FE_configuration.md
• using_starrocks/async_mv/feature-support-asynchronous-materialized-views.mdKenneth Oh
09/09/2026, 4:04 AMRocky
09/09/2026, 4:05 AM.log) is missing from your S3 bucket.
1. Breakdown of the Error
* Fail to publish version: This occurs during the final stage of a transaction (like an MV refresh or data load). The FE has committed the transaction, but when it asks the BE to make that data visible ("publish"), the BE cannot find the instructions.
* Not found: starlet err ... The specified key does not exist: The StarRocks storage abstraction (Starlet) tried to fetch a metadata file from S3 (.../log/00000000004180DC_00000000001E6EDD.log) and received a 404 error.
* tablet_id: 4292828: This is the specific tablet of the Materialized View (MV) that is corrupted or inconsistent.
2. Why it occurred during an MV Query Rewrite
When your query is rewritten to a Materialized View, the engine attempts to read data from the MV's internal tablets. The error suggests that the MV's data is currently in a "broken" state due to a failed refresh or a race condition:
1. Interrupted Refresh: The MV was likely being refreshed. The transaction was started, but the metadata log file was either never successfully written to S3 or was deleted prematurely.
2. FE Leader Shift: If the Leader FE changed recently, the new Leader might be trying to "clean up" or "finish" a transaction initiated by the old Leader, but the associated .log metadata file is missing.
3. Aggressive Metadata GC: In some cases, the background Garbage Collection (GC) for shared-data metadata might be too aggressive, deleting transaction logs before all BEs have finished the publish phase.
3. Immediate Recommended Actions
Because the query was rewritten to this MV, the query will continue to fail as long as this specific tablet/version is in limbo.
A. Refresh the MV manually
Try to force a new, clean refresh of the MV. This often generates a new transaction and bypasses the broken log file:
sql
REFRESH MATERIALIZED VIEW your_mv_name;
B. Identify the specific partition
Check which partition of the MV is failing. If the error persists, you may need to drop and recreate that specific partition:
sql
-- Check for inactive or failed MVs
SHOW MATERIALIZED VIEWS LIKE 'your_mv_name';
-- If a specific partition is stuck
ALTER MATERIALIZED VIEW your_mv_name DROP PARTITION partition_name;
REFRESH MATERIALIZED VIEW your_mv_name PARTITIONS (partition_name);
C. Check FE Health
Check if your FE nodes are stable. If you see frequent "Leader change" messages in fe.log, that is likely the root cause.
bash
grep "master changed" fe.log
D. Check Compaction Status
As noted in similar bugs for StarRocks shared-data versions, sometimes "stuck" compaction tasks cause publish failures. Check for any tasks with no `FinishTime`:
sql
SHOW PROC '/compactions';
Summary
The query failed because the Materialized View's metadata on S3 is missing a transaction log. This is a server-side storage issue, not a query syntax issue. Re-running the MV refresh or repairing the affected partition is the standard fix. If you are on an experimental version (like the 4.1.1 mentioned earlier), this may be a bug related to metadata persistence in the new shared-data logic.
References
• faq/Deploy_faq.md
• administration/management/monitoring/metrics.md
• administration/management/BE_configuration.md
• administration/management/FE_configuration.md
• administration/Meta_recovery.mdRocky
09/09/2026, 4:05 AMKenneth Oh
09/09/2026, 4:13 AMRocky
09/09/2026, 4:13 AMtablet_id: 4292828).
* Why some succeed: If a query's filters (the WHERE clause) allow the engine to prune partitions or if the data it needs resides in other healthy tablets, the query will succeed.
* Why some fail: Only queries that are forced to scan the specific "broken" tablet (4292828) will encounter the 404 Not Found error on S3.
2. Query Rewrite vs. Base Table Scan
Not every query against the base tables is automatically rewritten to the MV.
* Success: A query might look similar but fail the optimizer's rewrite criteria (e.g., it requires a column not present in the MV, or uses an unsupported function). In this case, StarRocks scans the base tables directly. Since the base tables are likely healthy, the query succeeds.
* Failure: A query that matches the MV structure perfectly is rewritten to scan the MV. It then hits the missing metadata file and fails.
* How to check: Run EXPLAIN on a successful query and a failing one. Look for OlapScanNode. If you see the MV name in the failing one and the base table name in the successful one, this is the cause.
3. Metadata Cache Inconsistency (Shared-Data)
In a shared-data (Lakehouse) cluster, BE nodes cache metadata locally to avoid constant S3 calls.
* Success: A query might be handled by a BE node that still has the "old" healthy metadata for that tablet in its memory cache.
* Failure: A different BE node (or the same node after a cache eviction) might try to fetch the latest metadata from S3, find it missing, and throw the error.
4. Versioning and "Dirty" Reads
StarRocks uses Multi-Version Concurrency Control (MVCC).
* If an MV refresh was partially successful or interrupted, the "Visible Version" of the MV might be pointing to a set of files where one .log file is missing.
* If you have query_rewrite_consistency = 'loose' set on the MV, the optimizer might try to use an "in-progress" or "stale" version of the MV metadata, which could be in an inconsistent state.
How to verify
To see exactly which queries are hitting the MV and which are not, use the Trace feature (available in your version):
sql
-- This will tell you why a query was NOT rewritten
TRACE REASON MV <your_query>;
-- This will show the detailed rewrite process
TRACE LOGS MV <your_query>;
Recommendation
Since you have a confirmed missing file in S3 for a specific tablet, the MV is effectively "wounded." Even if some queries work now, others will fail unpredictably.
1. Identify the tablet: You already have it (4292828).
2. Repair: The safest way to fix this in a shared-data cluster is to force a full refresh or drop and recreate the MV to ensure a clean metadata state is written to S3.
sql
REFRESH MATERIALIZED VIEW your_mv_name;
References
• administration/management/monitoring/metrics-shared-data.md
• faq/shared_data_faq.md
• knowledge/admin_and_operation/shared_data_compaction.mdKenneth Oh
09/09/2026, 4:16 AMRocky
09/09/2026, 4:16 AM.log file) will eventually be deleted by the background vacuum process.
2. If it is a Partitioned MV
Maybe not automatically.
StarRocks only refreshes partitions where the base table data has changed.
* If the base data for the "broken" partition changes: The scheduler will trigger a refresh for that partition, which creates new healthy files and fixes the issue.
* If the base data is static: The scheduler will see that the partition is "up-to-date" relative to the base table and skip it. The broken tablet will remain in the "Visible Version," and queries hitting that partition will continue to fail.
3. Will the refresh itself fail?
The refresh task (the "Write" phase) should not fail because it reads from the base tables, not the MV itself. However, if the metadata inconsistency is severe enough that the FE cannot determine the MV's current state, the refresh task might fail during the "Commit/Publish" phase.
Recommended Action to "Force" a Repair
To ensure the repair happens regardless of the schedule or data changes, you should manually trigger a refresh with the FORCE keyword. This tells StarRocks to ignore consistency checks and rebuild the data:
* To repair the entire MV:
sql
REFRESH MATERIALIZED VIEW your_mv_name FORCE;
* To repair only the specific failing partition (if you know it):
sql
REFRESH MATERIALIZED VIEW your_mv_name
PARTITION START ("2023-09-01") END ("2023-09-02") FORCE;
Why you shouldn't just wait:
While a refresh might fix it, the missing file error (404 Not Found) in a shared-data cluster often indicates that the metadata vacuuming logic and the transaction publishing logic got out of sync. Waiting for a scheduled task might lead to:
1. Stuck Tasks: The FE might repeatedly try to "clean up" the old failed transaction and fail, potentially blocking the scheduler.
2. Intermittent Query Failures: As long as that tablet is part of the "Active" set, any user query hitting it will fail with an InternalError.
Conclusion: Don't wait for the schedule. Run a REFRESH ... FORCE manually to clear the bad state and guarantee the creation of healthy metadata.
References
• using_starrocks/async_mv/troubleshooting_asynchronous_materialized_views.md
• sql-reference/sql-statements/materialized_view/REFRESH_MATERIALIZED_VIEW.md
• faq/shared_data_faq.md
References
• administration/management/resource_management/Replica.md
• knowledge/usage/best-practice.md
• faq/shared_data_faq.md
• using_starrocks/async_mv/troubleshooting_asynchronous_materialized_views.md
• deployment/shared_data/azure.mdKenneth Oh
09/09/2026, 4:38 AMenable_trace_historical_node entailRocky
09/09/2026, 4:38 AMenable_trace_historical_node (introduced in v3.5.1) is a key setting for enabling Cache Sharing in StarRocks shared-data (Lakehouse) clusters.
Here is a breakdown of what it entails:
1. The Core Purpose: Mitigating "Cache Jitter"
In a shared-data cluster, Compute Nodes (CNs) cache hot data from remote storage (S3/HDFS) on local disks. When you scale the cluster up or down, the consistent hashing or data routing often shifts. This causes "cache misses" because the data a node needs is now sitting on a different node’s disk.
enable_trace_historical_node allows the Frontend (FE) to keep track of which nodes recently held specific data.
2. How it Works (Peer-to-Peer Cache Sharing)
When this parameter is enabled alongside the system variable `enable_datacache_sharing`:
* Historical Mapping: The FE maintains a "trace" of historical node assignments.
* Network Fetch: If a node needs a data block that it doesn't have locally (a cache miss), it doesn't immediately go to slow remote storage (S3). Instead, it uses the "historical trace" to identify which other node in the cluster likely has that block in its local cache.
* Sub-second Recovery: The node fetches the data over the internal network from its peer. This is significantly faster than re-downloading from S3, ensuring query performance remains stable even during active scaling events.
3. Requirements and Activation
To use this feature, you must configure both the FE and the session/global variables:
1. FE Configuration (fe.conf):
enable_trace_historical_node = true
2. System Variable:
SET GLOBAL enable_datacache_sharing = true;
3. Version: Requires StarRocks v3.5.1 or higher.
4. Monitoring the Effect
Once enabled, you can see if it's working by looking at the Query Profile. You will see new metrics under the DataCache section:
* DataCacheReadPeerCounter: How many times data was read from a peer node.
* DataCacheReadPeerBytes: The volume of data transferred between nodes instead of from S3.
* DataCacheReadPeerTimer: The time spent performing these peer-to-peer network reads.
Summary
In short, enable_trace_historical_node tells the FE to remember where cache was previously located so that nodes can share data over the network during scaling, rather than suffering from the performance drop of cold caches.
References
• administration/management/FE_configuration.md
• developers/trace-tools/Trace.md
• sql-reference/System_variable.md
• using_starrocks/SQL_plan_manager.mdKenneth Oh
09/09/2026, 4:39 AMRocky
09/09/2026, 4:39 AMenable_trace_historical_node can be enabled in a static cluster, it is specifically designed to be dormant unless a scaling event occurs.
For permanent, static compute nodes, here is how it behaves:
1. It is "Event-Triggered"
The feature is designed to bridge the gap when data routing changes. In StarRocks, data-to-node mapping is determined by consistent hashing.
* In a static cluster: The mapping never changes. Each node always knows exactly which data it is responsible for caching. It will find that data on its own local disk, so it never needs to "ask" a peer.
* During scaling: When you add or remove a node, the hash ring shifts. Data that was on Node A might now be assigned to Node B. Node B will have a "cold" cache for that data.
2. The Time-Limited Window (datacache_sharing_work_period)
The system variable datacache_sharing_work_period (default 600 seconds) controls how long this feature stays active.
* The peer-to-peer cache fetching only kicks in for the first 10 minutes after a scaling operation is detected.
* Once that window expires, even if the feature is "enabled," nodes stop trying to fetch from peers and resume normal behavior (reading from S3 if the local cache is missing).
3. Does it affect permanent nodes during a restart?
Yes. If a "permanent" node crashes and you replace it with a new node, or if the cluster is restarted in a way that the FE perceives as a membership change, the feature will trigger. This is actually beneficial because the "new" node can pull cache from the other healthy nodes rather than hammering your S3 bucket to rebuild its local cache from scratch.
4. Overhead for Static Clusters
There is virtually no overhead for keeping this enabled in a static cluster:
* FE side: The "historical trace" is a small metadata map in the FE memory. If the cluster membership hasn't changed, this map is identical to the current map.
* BE side: Nodes will only attempt a peer-to-peer read if they have a local cache miss and the scaling timer is active. In a static cluster, the timer is not active.
Summary
If your compute nodes are truly permanent and you never change the cluster size, this feature will effectively do nothing. However, it is recommended to keep it enabled as a safety net. If a node ever fails and needs to be replaced, this feature will prevent a "performance cliff" while the new node's cache is warming up.
References
• data_source/data_cache.md
• sql-reference/System_variable.md
• administration/management/FE_configuration.md
References
• data_source/data_cache.md
• administration/management/BE_configuration.md
• deployment/shared_data/feature-support-shared-data.md
• sql-reference/System_variable.md
• administration/management/FE_configuration.md
• using_starrocks/caching/block_cache.mdKenneth Oh
09/09/2026, 4:49 AMRocky
09/09/2026, 4:49 AMCREATE MATERIALIZED VIEW and SUBMIT TASK ... AS CACHE SELECT into one atomic command or property.
While StarRocks has significantly unified the management of these two features, they remain distinct objects in the system:
1. Unified Metadata Management
As of v3.x and continuing into v4.1, asynchronous Materialized Views (MVs) and SUBMIT TASK jobs are both managed by the Task Manager. You can "manage them in one place" by querying the same metadata views:
* `information_schema.tasks`: Shows both MV refresh tasks and your CACHE SELECT warmup tasks.
* `information_schema.task_runs`: Shows the execution history for both.
2. Current Workflow (Two-Step Process)
To achieve "managed" cache warmup for an MV, you currently follow the standard best practice (as documented in v4.1 guides):
1. Create the MV:
sql
CREATE MATERIALIZED VIEW my_mv
REFRESH ASYNC EVERY (INTERVAL 1 DAY)
AS SELECT ...;
2. Submit a Warmup Task (Scheduled):
sql
SUBMIT TASK mv_warmup
SCHEDULE EVERY (INTERVAL 1 DAY) -- Offset this to run after the refresh
AS CACHE SELECT * FROM my_mv;
3. Why they aren't one statement yet
* Decoupled Logic: A Materialized View is a data object (storage + refresh logic), whereas CACHE SELECT is an ephemeral action (pulling data into the local NVMe/SSD cache of a specific Compute Node/BE).
* Resource Management: Warmup tasks often need different resource groups or lower priority (DOP) than the actual data refresh to avoid impacting production queries. Keeping them as separate tasks allows you to set specific PROPERTIES (like pipeline_dop) for the warmup task without slowing down the MV refresh itself.
4. New in 4.1.1 Relevant to this
While a combined syntax doesn't exist, StarRocks 4.1.1 introduced Adaptive Layout and improved Incremental MV logic. These features reduce the need for manual warmup by:
* Optimizing the physical layout of the MV automatically so that the first query after a refresh is naturally faster.
* Supporting better "Data Cache" persistence, so that even after a refresh, older cached blocks may still be valid for unchanged partitions.
Summary
You still need to manage two statements, but you can monitor and control them both via the Unified Task Framework (information_schema.tasks). There is no "CACHE SELECT" property inside the CREATE MATERIALIZED VIEW syntax in the 4.1.x release.
References
• data_source/block_cache_warmup.md
• sql-reference/sql-statements/loading_unloading/ETL/SUBMIT_TASK.md
• using_starrocks/async_mv/Materialized_view.md
• release_notes/release-3.3.md
References
• release_notes/release-3.3.md
• release_notes/release-3.1.md
• using_starrocks/async_mv/use_cases/query_rewrite_with_materialized_views.mdKenneth Oh
09/12/2026, 9:20 AMRocky
09/12/2026, 9:20 AMmysql.user table. This information is tracked as part of StarRocks' password management and expiration features (introduced in recent versions like v3.1+).
Command
To view the last password change time for all users, run:
sql
SELECT User, password_last_changed FROM mysql.user;
* User: The username.
* password_last_changed: The timestamp indicating when the password was most recently updated.
Important Notes
1. Privileges: You must have the user_admin role or equivalent system-level privileges to query the mysql system database.
2. Native Authentication: This field is only relevant for users using Native Authentication (passwords stored in StarRocks). If you are using external authentication like LDAP or Kerberos, the password lifecycle is managed by the external system, and this field will typically be NULL or show when the user was initially mapped.
3. Visibility: Standard commands like SHOW USERS or SHOW AUTHENTICATION only display user identities and authentication methods; they do not currently expose metadata timestamps like password age.
Related: Password Expiration Properties
If you are tracking password changes for security compliance, you can also check if a user has a specific password expiration policy set by using:
sql
SHOW PROPERTY FOR 'username' LIKE 'password_expire_interval';
References
• administration/user_privs/authentication/native_authentication.md
• sql-reference/sql-statements/account-management/SHOW_AUTHENTICATION.md
• sql-reference/sql-statements/account-management/SHOW_USERS.md
References
• sql-reference/sql-statements/account-management/SHOW_AUTHENTICATION.md
• administration/user_privs/authentication/native_authentication.md
• sql-reference/sql-statements/account-management/ALTER_USER.md
• administration/management/monitoring/metrics.mdKenneth Oh
09/12/2026, 9:25 AMRocky
09/12/2026, 9:25 AMmysql database in the default_catalog. While StarRocks is MySQL-compatible at the protocol level, it uses its own internal metadata system and does not replicate the standard MySQL system tables (like mysql.user).
As of the current version (including 4.1.1), there is no direct SQL command or system view (in information_schema or sys) that displays the "password last changed" timestamp.
Why you see the error
The mysql database and user table are specific to the MySQL server itself. StarRocks stores user identities and credentials in its own FE (Frontend) metadata, which is not exposed as a queryable table for security and architectural reasons.
How to check password-related info
While you cannot see the exact "last changed" timestamp via SQL, you can use these commands for related information:
1. Check if a password is set:
sql
SHOW ALL AUTHENTICATION;
This shows the user identity and whether a password exists (`Yes`/`No`), but not the date.
2. Check Password Expiration Policy:
If you have configured password expiration, you can see the interval, but not the start date:
sql
SHOW PROPERTY FOR 'username' LIKE 'password_expire_interval';
Workaround: Audit Logs
If you have Audit Logging enabled (which is highly recommended for production), you can find when a password was last changed by searching the FE audit logs for the ALTER USER or SET PASSWORD commands.
* Log Location: fe/log/fe.audit.log
* Search Command:
bash
grep -E "ALTER USER|SET PASSWORD" fe.audit.log
Summary
* Is there a SQL command? No.
* Is there a system table? No (the mysql database does not exist in StarRocks).
* Recommended approach: Check your FE audit logs for the last occurrence of the password update command for that specific user.
References
• administration/user_privs/authentication/native_authentication.md
• sql-reference/sql-statements/account-management/SHOW_AUTHENTICATION.md
• administration/user_privs/authorization/privilege_faq.md
• administration/user_privs/authorization/User_privilege.md
• administration/management/FE_configuration.mdKenneth Oh
09/12/2026, 7:39 PMRocky
09/12/2026, 7:39 PMALTER CATALOG statement with the SET property clause.
Syntax
sql
ALTER CATALOG <catalog_name> SET (
"aws.s3.access_key" = "<new_access_key>",
"aws.s3.secret_key" = "<new_secret_key>",
"aws.s3.region" = "<aws_region>"
);
Common S3 Property Fields
Depending on your catalog type (Hive, Iceberg, Hudi, Delta Lake, or Unified), the following property keys are standard for S3 access:
* aws.s3.access_key: The new AWS IAM user access key.
* aws.s3.secret_key: The new AWS IAM user secret key.
* aws.s3.session_token: Required if you are using temporary credentials.
* aws.s3.region: The AWS region where your bucket is located (e.g., us-east-1).
* aws.s3.use_instance_profile: Set to "false" if you are switching from IAM Role to Access Keys.
Example: Updating a Hive Catalog
sql
ALTER CATALOG my_hive_catalog SET (
"aws.s3.access_key" = "AKIAEXAMPLE123",
"aws.s3.secret_key" = "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
);
Important Considerations
1. Catalog "Recreation": Internally, StarRocks may recreate the catalog object when credentials are modified. While this is transparent to your metadata, it may briefly affect active queries that were already in the planning phase using the old credentials.
2. Masking: When you run SHOW CREATE CATALOG <name>, StarRocks masks sensitive information like the secret_key. However, when performing the ALTER command, you must provide the values in plaintext.
3. Privileges: You must have the ALTER privilege on the catalog or the SYSTEM-level administrative privileges to perform this operation.
4. Verification: After updating, you can verify the connection by attempting to list the databases or tables:
sql
SHOW DATABASES FROM <catalog_name>;
References
• sql-reference/sql-statements/Catalog/CREATE_EXTERNAL_CATALOG.md
• data_source/catalog/hive_catalog.md
• data_source/catalog/iceberg_catalog.md
References
• sql-reference/sql-statements/table_bucket_part_index/ALTER_TABLE.md
• sql-reference/sql-statements/Catalog/CREATE_EXTERNAL_CATALOG.md
• sql-reference/sql-statements/loading_unloading/pipe/ALTER_PIPE.md
• sql-reference/sql-statements/Resource/ALTER_RESOURCE.md
• sql-reference/sql-statements/account-management/ALTER_USER.md
• data_source/catalog/maxcompute_catalog.mdKenneth Oh
09/13/2026, 11:32 PMRocky
09/13/2026, 11:33 PMconcurrency_limit is reached, new queries fail immediately. Enabling the queue allows these tasks to wait instead.
Step 1: Enable Query Queuing Globally
You must enable the query queue for "load" operations (since MV refreshes are INSERT tasks) and enable the group-level queuing logic.
sql
-- Enable queuing for INSERT/load operations (required for MV refreshes)
SET GLOBAL enable_query_queue_load = true;
-- Enable queuing at the resource group level
SET GLOBAL enable_group_level_query_queue = true;
Step 2: Create a Dedicated Resource Group
Create a resource group with a specific concurrency_limit. This limit is applied per BE node.
sql
CREATE RESOURCE GROUP mv_app_group
TO
(user='mv_user') -- Option A: Catch all refreshes by a specific user
WITH (
"concurrency_limit" = "2", -- Only 2 concurrent refreshes per BE
"cpu_weight" = "10", -- Lower priority for CPU
"mem_limit" = "0.2" -- Limit memory to 20%
);
Step 3: Bind Materialized Views to the Group
You can bind specific MVs to this group regardless of the user by setting the resource_group property.
* For new MVs:
sql
CREATE MATERIALIZED VIEW my_mv
REFRESH ASYNC
PROPERTIES (
"resource_group" = "mv_app_group"
)
AS SELECT ...;
* For existing MVs:
sql
ALTER MATERIALIZED VIEW my_mv SET ("resource_group" = "mv_app_group");
Step 4: Configure Queue Depth and Timeout (Optional)
If the queue itself gets too full or a task waits too long, it will eventually fail. You can tune these global variables:
* query_queue_max_queued_queries: Maximum number of tasks that can sit in the queue (default 1024).
* query_queue_pending_timeout_second: How long a task waits before failing (default 300s).
Summary of Behavior
1. Under Limit: MV refreshes run immediately.
2. At Limit: Subsequent refresh tasks enter the queue (status: Pending in show processlist).
3. Queue Full: If the number of pending tasks exceeds query_queue_max_queued_queries, the next task fails immediately.
4. Timeout: If a task stays in the queue longer than query_queue_pending_timeout_second, it fails.
Troubleshooting
To see how many queries are currently queued in your group:
sql
SHOW USAGE RESOURCE GROUPS;
References
• administration/management/resource_management/query_queues.md
• administration/management/resource_management/resource_group.md
• best_practices/audit_log_resource_group.md
• sql-reference/sql-statements/Catalog/CREATE_EXTERNAL_CATALOG.md
References
• administration/management/resource_management/query_queues.md
• sql-reference/System_variable.md
• faq/resource_isolation_faq.mdKenneth Oh
09/14/2026, 4:22 PMRocky
09/14/2026, 4:23 PMsql
ALTER MATERIALIZED VIEW your_mv_name
SET ("mv_rewrite_staleness_second" = "60"); -- 1 minute threshold
* Disable Consistency Checks Entirely: If you don't care if the MV is out of sync with the base table during rewrites:
sql
ALTER MATERIALIZED VIEW your_mv_name
SET ("query_rewrite_consistency" = "LOOSE");
2. Enable Asynchronous Background Metadata Refresh
StarRocks can poll your external metastore (HMS/Glue) in the background so that the metadata is already in the FE cache when a query arrives.
Ensure these FE configurations are set (use ADMIN SET FRONTEND CONFIG):
* enable_background_refresh_connector_metadata = true: Enables the background poller.
* background_refresh_metadata_interval_millis = 60000: Sets the polling interval (e.g., 60 seconds).
* metastore_cache_refresh_interval_sec = 60: How long a cache entry is considered "fresh" before StarRocks triggers an async refresh.
3. Set an Optimizer Timeout
To prevent a slow metadata fetch from completely hanging your query, you can set a time limit for the MV rewrite logic. If the time is exceeded, the optimizer will stop trying to rewrite and just run the query against the base table.
sql
-- Session variable (default is 1000ms)
SET optimizer_materialized_view_timelimit = 300; -- 300ms limit
4. Why it happens "constantly"
Even if metadata is cached, it has a TTL (Time To Live).
* If your query frequency is low, the cache might expire between queries.
* If your metastore_cache_refresh_interval_sec is set to 0 (or a very low value), StarRocks will always fetch from the remote source.
* If the number of tables/partitions is massive, the FE may be evicting metadata from its internal LRU cache. You can increase iceberg_metadata_memory_cache_capacity or hive_meta_cache_ttl_second if necessary.
Summary Checklist
1. Use mv_rewrite_staleness_second to stop synchronous checks on every query.
2. Verify enable_background_refresh_connector_metadata is true for your catalog.
3. Check your *Metastore (HMS/Glue) latency*; background refresh only works if the metastore responds within a reasonable window.
References
• using_starrocks/async_mv/use_cases/query_rewrite_with_materialized_views.md
• using_starrocks/async_mv/troubleshooting_asynchronous_materialized_views.md
• administration/management/FE_configuration.md
• data_source/catalog/iceberg/iceberg_catalog.md
References
• data_source/catalog/deltalake_catalog.mdKenneth Oh
09/14/2026, 4:23 PMRocky
09/14/2026, 4:24 PMenable_background_refresh_connector_metadata = true. This makes the FE poll the remote metastore every minute in the background so the "version" is already in FE memory when your query arrives.
2. Use Staleness Tolerance: Set mv_rewrite_staleness_second. This tells the optimizer: "If I have a cached version from the last 60 seconds, use it. Do not go to S3/Glue to verify it during the query."
In short: The consistency logic (comparing versions) is identical, but the fetch is "shared-memory" for internal tables and "over-the-wire" for external tables.
References
• using_starrocks/async_mv/use_cases/query_rewrite_with_materialized_views.md
• using_starrocks/async_mv/use_cases/data_lake_query_acceleration_with_materialized_views.md
• using_starrocks/async_mv/Materialized_view.md