Refactor router planner to defer reading placement metadata
- 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
Assessment
This issue has not been assessed yet.