{"record":{"id":"02b11edc15ca2dcf","repo":"cube-js/cube","slug":"cachestore-cannot-be-used-on-the-worker-node-rock","errorCode":null,"errorMessage":"CacheStore cannot be used on the worker node! rocksdb_properties was used.","messagePattern":"CacheStore cannot be used on the worker node! rocksdb_properties was used\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"rust/cubestore/cubestore/src/cachestore/cache_rocksstore.rs","lineNumber":2096,"sourceCode":"\n    async fn info(&self) -> Result<CachestoreInfo, CubeError> {\n        panic!(\"CacheStore cannot be used on the worker node! info was used.\")\n    }\n\n    async fn eviction(&self) -> Result<EvictionResult, CubeError> {\n        panic!(\"CacheStore cannot be used on the worker node! eviction was used.\")\n    }\n\n    async fn persist(&self) -> Result<(), CubeError> {\n        panic!(\"CacheStore cannot be used on the worker node! persist was used.\")\n    }\n\n    async fn healthcheck(&self) -> Result<(), CubeError> {\n        panic!(\"CacheStore cannot be used on the worker node! healthcheck was used.\")\n    }\n\n    async fn rocksdb_properties(&self) -> Result<Vec<RocksPropertyRow>, CubeError> {\n        panic!(\"CacheStore cannot be used on the worker node! rocksdb_properties was used.\")\n    }\n\n    async fn wipe(&self) -> Result<(), CubeError> {\n        panic!(\"CacheStore cannot be used on the worker node! wipe was used.\")\n    }\n}\n\ncrate::di_service!(ClusterCacheStoreClient, [CacheStore]);\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n    use crate::cachestore::{CacheEvictionPolicy, EvictionFinishedResult};\n    use crate::config::{init_test_logger, ConfigObjImpl, CubeServices};\n    use crate::CubeError;\n\n    #[tokio::test]\n    async fn test_cachestore_migration() -> Result<(), CubeError> {","sourceCodeStart":2078,"sourceCodeEnd":2114,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/rust/cubestore/cubestore/src/cachestore/cache_rocksstore.rs#L2078-L2114","documentation":"Cube Store's worker node uses a stub `CacheStore` implementation in which every `CacheStore` trait method is an unconditional `panic!`. Calling `rocksdb_properties()` (which reads RocksDB statistics like compaction/CF properties) on a worker node — a process that does not own the RocksDB instance — intentionally aborts, because cache operations and metadata inspection are only meaningful on the node hosting the data.","triggerScenarios":"Calling the `rocksdb_properties()` method of `CacheStore` on a Cube Store worker node, e.g. an admin/diagnostics request for RocksDB properties routed to a worker instead of the master/data node.","commonSituations":"Running a Cube Store cluster where the node answering a stats/inspection request is a worker; load balancers or client code pointed at worker ports; tooling that assumes a single-node deployment and calls cache diagnostics without checking the node's role.","solutions":["Route the rocksdb_properties call to the Cube Store node that hosts the data (the master/data node), not a worker.","Check the node's configured role before issuing CacheStore diagnostics; skip or redirect the call on workers.","If clients auto-discover nodes, point them at the correct master address instead of any cluster member."],"exampleFix":"// before: sending cache diagnostics to whichever node the LB picks\nstore.rocksdb_properties();\n\n// after: only the data node implements the real CacheStore\nif !node_config.is_worker {\n    store.rocksdb_properties();\n} else {\n    eprintln!(\"rocksdb_properties is only available on the data node\");\n}","handlingStrategy":"validation","validationCode":"if let Some(role) = node.role() {\n    if role == NodeRole::Worker {\n        return Err(anyhow!(\"rocksdb_properties is only available on the data node; current node is a worker\"));\n    }\n}\nnode.cache_store().rocksdb_properties()?;","typeGuard":"fn is_data_node(node: &CubeStoreNode) -> bool {\n    !matches!(node.role(), Some(NodeRole::Worker))\n}","tryCatchPattern":"match std::panic::catch_unwind(AssertUnwindSafe(|| node.cache_store().rocksdb_properties())) {\n    Ok(props) => println!(\"{:?}\", props),\n    Err(_) => eprintln!(\"node is a worker; query the data node for RocksDB properties\"),\n}","preventionTips":["Determine the node's role (master vs worker) from config before issuing any CacheStore calls.","Send cache/rocksdb diagnostics exclusively to the data node's address.","Do not broadcast admin commands to all cluster members; use role-aware routing."],"tags":["rust","panics","configuration","worker-node","rocksdb"],"backgroundTag":"cache-store-on-worker-node","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}