{"record":{"id":"6a2309f58908a032","repo":"cube-js/cube","slug":"cachestore-cannot-be-used-on-the-worker-node-wipe","errorCode":null,"errorMessage":"CacheStore cannot be used on the worker node! wipe was used.","messagePattern":"CacheStore cannot be used on the worker node! wipe was used\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"rust/cubestore/cubestore/src/cachestore/cache_rocksstore.rs","lineNumber":2100,"sourceCode":"\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> {\n        init_test_logger().await;\n\n        let (_, cachestore) = RocksCacheStore::prepare_test_cachestore_from_fixtures(\n            \"cachestore-migration\",","sourceCodeStart":2082,"sourceCodeEnd":2118,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/rust/cubestore/cubestore/src/cachestore/cache_rocksstore.rs#L2082-L2118","documentation":"This is the worker-node stub for `CacheStore::wipe()`, which deletes the local cache. Workers do not own a RocksDB cache instance, so calling `wipe()` there cannot do anything meaningful and panics by design. Wiping the cache is an operation reserved for the node that actually stores the data.","triggerScenarios":"Invoking `wipe()` on `CacheStore` in a Cube Store worker process, e.g. a cache-invalidation or maintenance command executed against a worker instead of the data node.","commonSituations":"Ops automation (cron jobs, kubectl exec into the wrong pod) issuing cache wipes to every cluster member; clients broadcasting admin commands cluster-wide; single-node scripts reused unchanged in a multi-node deployment.","solutions":["Execute the cache wipe only on the data/master node that owns the RocksDB store.","Filter worker nodes out of any script or job that performs CacheStore maintenance.","Use the cluster's admin/control-plane API (which routes to the correct node) instead of calling the store directly."],"exampleFix":"// before: wiping cache on all nodes\nfor node in cluster.nodes {\n    node.cache_store().wipe();\n}\n\n// after: wipe only where the cache lives\nfor node in cluster.nodes.iter().filter(|n| !n.is_worker) {\n    node.cache_store().wipe();\n}","handlingStrategy":"validation","validationCode":"if node.is_worker() {\n    eprintln!(\"skipping cache wipe: workers hold no local cache\");\n    return Ok(());\n}\nnode.cache_store().wipe()?;","typeGuard":"fn can_wipe_cache(node: &CubeStoreNode) -> bool {\n    !node.is_worker()\n}","tryCatchPattern":"let result = std::panic::catch_unwind(AssertUnwindSafe(|| node.cache_store().wipe()));\nif result.is_err() {\n    eprintln!(\"wipe is unsupported on worker nodes; run it on the data node\");\n}","preventionTips":["Gate cache maintenance jobs on node role before executing them.","Restrict wipe/invalidation tooling to the master/data node's endpoint.","Update legacy single-node scripts with a role check before reuse in clusters."],"tags":["rust","panics","configuration","worker-node","cache"],"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"}