citusdata / citusdata/citus

run_command_on_shards doesn't comply with citus.cluster_name and citus.use_secondary_nodes

Open
#2,042 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C
Stars
12.8k
Forks
794
Avg merge
2d 14h
Merged PRs (30d)
31

Description

When `run_command_on_shards` is run from coordinator of a follower cluster, Citus tries to forward the queries to the shards on the primary cluster, instead of the follower workers in the follower cluster.

This is mainly because `run_command_on_shards` uses `pg_dist_shard_placement` view, which uses `pg_dist_node` table and [always looks for the primary nodes](https://github.com/citusdata/citus/blob/master/src/backend/distributed/citus--7.0-4--7.0-5.sql#L26), instead of `master_get_active_worker_nodes()`.

We can either
1. consider making `pg_dist_shard_placement` cluster aware
2. replace pg_dist_shard_placement with `pg_dist_placement JOIN master_get_active_worker_nodes()`

Note: this has been reported by a Citus user.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.