citusdata / citusdata/citus

Colocation groups might get concurrently deleted when creating distributed tables

Open
#6,871 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

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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.