Add NOTICE logs for create_distributed_table
- Dominant language
- C
- Stars
- 12.8k
- Forks
- 794
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 31
Description
**Settings**
PostgreSQL version: **14**
Citus version: **11.1**
Coordinator node: **4 vCores / 16 GiB RAM, 512 GiB storage**
Worker nodes: **4 nodes, 16 vCores / 512 GiB RAM, 4096 GiB storage**
**Problem description**
When executing the `create_distributed_table` UDF, no NOTICE logs are shown to the user. This may be OK for small tables, but for some with many partitions and rows this can be annoying and impose difficulties on debugging a possible issue, since there's no feedback on the execution progress.
**How to reproduce**
Execute the following SQL statements:
```
CREATE SCHEMA notice;
CREATE TABLE notice.orders (
id bigint,
order_time timestamp without time zone NOT NULL,
region_id bigint NOT NULL
)
PARTITION BY RANGE (order_time);
SELECT create_time_partitions(
table_name := 'notice.orders',
partition_interval := '1 day',
start_from := now() - '5 days'::interval,
end_at := now()
);
```
Next, execute the `create_distributed_table` statement:
`SELECT create_distributed_table('notice.orders', 'region_id');`
The output can be seen next:
```
citus=> SELECT create_distributed_table('notice.orders', 'region_id');
create_distributed_table
--------------------------
(1 row)
```
After it, execute the `undistribute_table` UDF:
`SELECT undistribute_table('notice.orders');`
You will see that this function has many NOTICE logs, improving visibility on the execution progress:
```
citus=> SELECT undistribute_table('notice.orders');
NOTICE: converting the partitions of notice.orders
NOTICE: creating a new table for notice.orders_p2022_12_16
NOTICE: moving the data of notice.orders_p2022_12_16
NOTICE: dropping the old notice.orders_p2022_12_16
NOTICE: renaming the new table to notice.orders_p2022_12_16
NOTICE: creating a new table for notice.orders_p2022_12_17
NOTICE: moving the data of notice.orders_p2022_12_17
NOTICE: dropping the old notice.orders_p2022_12_17
NOTICE: renaming the new table to notice.orders_p2022_12_17
NOTICE: creating a new table for notice.orders_p2022_12_18
NOTICE: moving the data of notice.orders_p2022_12_18
NOTICE: dropping the old notice.orders_p2022_12_18
NOTICE: renaming the new table to notice.orders_p2022_12_18
NOTICE: creating a new table for notice.orders_p2022_12_19
NOTICE: moving the data of notice.orders_p2022_12_19
NOTICE: dropping the old notice.orders_p2022_12_19
NOTICE: renaming the new table to notice.orders_p2022_12_19
NOTICE: creating a new table for notice.orders_p2022_12_20
NOTICE: moving the data of notice.orders_p2022_12_20
NOTICE: dropping the old notice.orders_p2022_12_20
NOTICE: renaming the new table to notice.orders_p2022_12_20
NOTICE: creating a new table for notice.orders_p2022_12_21
NOTICE: moving the data of notice.orders_p2022_12_21
NOTICE: dropping the old notice.orders_p2022_12_21
NOTICE: renaming the new table to notice.orders_p2022_12_21
NOTICE: creating a new table for notice.orders
NOTICE: dropping the old notice.orders
NOTICE: renaming the new table to notice.orders
undistribute_table
--------------------
(1 row)
```
Contributor guide
Assessment
This issue has not been assessed yet.