citusdata / citusdata/citus

Refactor router planner to defer reading placement metadata

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

Description

Currently the router planner determines whether a query is router plannable if all distributed table RTE's prune to at most one shard, and there is a worker that contains placements for all shards in the query.

This means the router planner relies on placement information to determine whether a query is router plannable. However, placement metadata may change when a shard is moved or `master_update_node` is called. There are currently no locks preventing this from happening during a query and even if there were, they would not be held until execution time in case of prepared statements.

We should refactor the router planner to only read placement metadata in the executor, similar to what it does for inserts and simple update and delete commands. We should remove the `WorkersContainingAllShards` check and instead just determine whether the shards in the query are co-located.

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.