citusdata / citusdata/citus

master_drop_all_shards does not reset colocation id

Open
#918 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

Encountered this when testing `mark_tables_colocated()` PR #915

Steps

``` sql
create table t1(a int);
select master_create_distributed_table('t1', 'a', 'hash');
select master_create_worker_shards('t1', 4, 1);

create table t2(a int);
select master_create_distributed_table('t2', 'a', 'hash');
select master_create_worker_shards('t2', 4, 1);
```

two tables are created with colocation id = 0

``` sql
select mark_tables_colocated('t1', ARRAY['t2']);
```

both tables have the same colocation id

``` sql
select master_drop_all_shards('t2'::regclass, 'public', 't2');
```

tables continue to have same colocation id

``` sql
select master_create_worker_shards('t2', 8, 1);
```

tables continue to have same colocation id

``` sql
create table t3(a int);
select master_create_distributed_table('t3', 'a', 'hash');
select master_create_worker_shards('t3', 8, 1);
```

table t3 has preset colocation id = 0;

``` sql
select mark_tables_colocated('t2', ARRAY['t3']);
```

all three tables have the same colocation id, even though they are not colocated.

This situation could be avoided if `master_drop_all_shards` resets colocation id.

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.