Colocation groups might get concurrently deleted when creating distributed tables
- Dominant language
- C
- Stars
- 12.8k
- Forks
- 794
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 31
Description
It's possible to create a distributed table belonging to a concurrently-dropped colocation group.
For example, putting a breakpoint right after FindColocateWithColocationId in create_distributed_table, and then dropping the table to-be-colocated-with results in assigning a colocation id --that doesn't exist in pg_dist_colocation-- to the new table.
The following lock cannot help us because it's too late, but it's interesting that to see that it doesn't even fail if the table was dropped already.
https://github.com/citusdata/citus/blob/a7689c3/src/backend/distributed/operations/create_shards.c#L236
Contributor guide
Research direction
Start with create_distributed_table and FindColocateWithColocationId, then inspect the lock referenced in src/backend/distributed/operations/create_shards.c around line 236. Reproduce the breakpoint scenario while dropping the table used for colocation. Done means a new distributed table cannot retain a colocation ID that no longer exists in pg_dist_colocation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, postgresql
- Domain
- databases, distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100