cube-js/cube · error

CacheStore cannot be used on the worker node! compaction was

Error message

CacheStore cannot be used on the worker node! compaction was used.

What it means

CacheStore::compaction triggers RocksDB compaction of the cache store. On worker nodes the method is an unconditional panic! stub (cache_rocksstore.rs:2076) because compaction/queue maintenance is a master-side operation. This is a guard against invoking node-management operations on a cache-only store.

Source

Thrown at rust/cubestore/cubestore/src/cachestore/cache_rocksstore.rs:2076

        _external_id: Option<String>,
    ) -> Result<Option<QueueResultResponse>, CubeError> {
        panic!("CacheStore cannot be used on the worker node! queue_result was used.")
    }

    async fn queue_result_blocking(
        &self,
        _key: QueueKey,
        _timeout: u64,
    ) -> Result<Option<QueueResultResponse>, CubeError> {
        panic!("CacheStore cannot be used on the worker node! queue_result_blocking was used.")
    }

    async fn queue_merge_extra(&self, _key: QueueKey, _payload: String) -> Result<(), CubeError> {
        panic!("CacheStore cannot be used on the worker node! queue_merge_extra was used.")
    }

    async fn compaction(&self) -> Result<(), CubeError> {
        panic!("CacheStore cannot be used on the worker node! compaction was used.")
    }

    async fn info(&self) -> Result<CachestoreInfo, CubeError> {
        panic!("CacheStore cannot be used on the worker node! info was used.")
    }

    async fn eviction(&self) -> Result<EvictionResult, CubeError> {
        panic!("CacheStore cannot be used on the worker node! eviction was used.")
    }

    async fn persist(&self) -> Result<(), CubeError> {
        panic!("CacheStore cannot be used on the worker node! persist was used.")
    }

    async fn healthcheck(&self) -> Result<(), CubeError> {
        panic!("CacheStore cannot be used on the worker node! healthcheck was used.")
    }

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Issue compaction only to the master CubeStore node
  2. Filter cluster targets in admin/ops tooling to master-capable nodes
  3. Add role checks in the maintenance code path before calling compaction

Example fix

// before
for node in all_nodes { node.compaction().await?; }
// after
for node in master_nodes { node.compaction().await?; }
Defensive patterns

Strategy: validation

Validate before calling

if !is_master { return Err(CubeError::internal("compaction is master-only")); }
master_client.compaction().await?;

Type guard

fn supports_maintenance(store: &dyn CacheStore) -> bool { node_role == NodeRole::Master }

Try / catch

std::panic::catch_unwind(AssertUnwindSafe(|| master_client.compaction())).map_err(|_| CubeError::internal("compaction called on worker node"))?;

Prevention

When it happens

Trigger: Calling CacheStore::compaction() on a worker-node store, e.g. from a maintenance routine or an admin command routed to the wrong node (cache_rocksstore.rs:2076).

Common situations: Ops scripts issuing compaction to every node in the cluster; monitoring/admin tooling hitting worker nodes with master-only commands.

Related errors


AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02). Data as JSON: /api/errors/89d3da3649074771. Report an issue: GitHub.