set enable_profile=true.
Slow HDFS DataNodes
Issue description
When you access the data files stored in your HDFS cluster, you may find a huge difference between the values of the__MAX_OF_FSIOTime and __MIN_OF_FSIOTime metrics from the profiles of the SQL queries you run. This indicates that some DataNodes in the HDFS cluster are slow. The following example is a typical profile that indicates a slow HDFS DataNode issue:
Solution
You can use one of the following solutions to resolve this issue:- [Recommended] Enable the data cache feature, which eliminates the impact of slow HDFS DataNodes on queries by automatically caching the data from external storage systems to the BEs or CNs of your cluster.
- [Recommended] Shorten the timeout duration between the HDFS client and DataNode. This solution is suitable when Data Cache cannot help resolve the slow HDFS DataNode issue.
- Enable the Hedged Read feature. With this feature enabled, if a read from a block is slow, the database starts up a new read, which runs in parallel to the original read, to read against a different block replica. Whenever one of the two reads returns, the other read is cancelled. The Hedged Read feature can help accelerate reads, but it also significantly increases heap memory consumption on Java virtual machines (JVMs). Therefore, if your physical machines provide a small memory capacity, we recommend that you do not enable the Hedged Read feature.
[Recommended] Data Cache
See Data Cache.[Recommended] Shorten timeout duration between HDFS client and DataNode
Configure thedfs.client.socket-timeout property in the hdfs-site.xml file to shorten the timeout duration between the HDFS client and DataNode. (The default timeout duration is 60s, which is a bit long.) As such, when the database encounters a slow DataNode, the connection request from it can time out within a very short period of time and then be forwarded to another DataNode. The following example sets a 5-second timeout duration:
Hedged Read
Use the following parameters (supported from v3.0 onwards) in the BE or CN configuration filebe.conf to enable and configure the Hedged Read feature in your HDFS cluster.
If the value of any of the following metrics in your query profiles exceeds
0, the Hedged Read feature is enabled.
How do I resolve the error “ERROR 1064 (HY000): Type mismatches on column [is_refund], JDBC result type is Integer, please set the type to one of tinyint,smallint,int,bigint” when querying a table in the Hive Catalog?
This issue is caused by an incorrect JDBC connection configuration. Add the parametertinyInt1isBit=false to your JDBC URI to prevent this issue:
Why can’t I query the latest updated data in the Iceberg Catalog (even after refresh or catalog rebuild), and how should I troubleshoot this?
First check whether the issue is caused by Data Cache being enabled. Follow these steps to verify:-
Compare the scanned data files between the database and Spark:
- In the database:
select file_path, spec_id from db.table_name$files; - In Spark:
select file_path, spec_id from db.table_name.files;
- In the database:
- If the results are consistent, continue troubleshooting by disabling Data Cache and querying again to see whether the issue persists.
FE constantly crashes after queries against tables in external catalog integrated with JuiceFS. How can I solve this?
To solve this, restart FE after adding the following configuration items to fe.conf:Why does writing to Hive use so much space under /tmp/starrocks? What should I set for ViewFS?
/tmp/starrocks is the default temporary directory for writes to Hive tables on HDFS or ViewFS. The database writes files there first, then moves them to the table or partition directory at commit time. Large writes or several writes running at once can use a lot of space there. This /tmp is on HDFS or ViewFS, not on the local disk of an FE or BE.
The database tries to clean up the temporary directory when a write finishes. A process exit or cleanup failure can leave files behind. Before deleting a directory, check that the write using it has finished.
With ViewFS, also check whether /tmp and the table directory are under the same mount point. Even paths starting with viewfs://cluster/ can point to different HDFS namespaces. A commit can then fail because files cannot be renamed across those mounts.
You can put the temporary directory inside the table directory by running this before the write:
viewfs://cluster/warehouse/db/table, temporary files go to viewfs://cluster/warehouse/db/table/.sr_staging/<UUID>/. This takes the load off the shared /tmp/starrocks directory and avoids a different ViewFS mount between that directory and the table. If a partition has a separate location, check that files can also be renamed there from the temporary directory. The write still needs the same temporary space; only the location changes. You can use another path, but the database needs permission to create, rename, and delete files there.
Before using .sr_staging, check your overwrite workload. For INSERT OVERWRITE on non-partitioned tables, use a release containing the relative-staging fix. That fix does not make concurrent writes safe. Do not run an overwrite alongside other writes to the same table, including writes from Hive or Spark: the other writes’ temporary files can be moved or deleted with the table directory.
This SET applies only to the current connection. Set it again if you retry on a new connection.