citusdata / citusdata/citus

master_get_active_worker_nodes doesn't include coordinator

Open
#4,232 0 comments 1 reaction 0 assignees View on GitHub
bug single node
Dominant language
C
Stars
12.8k
Forks
794
Avg merge
2d 14h
Merged PRs (30d)
31

Description

We don't include coordinator if it is added as a worker to the cluster in master_get_active_worker_nodes:

```
[local] talha@talha:9700-5673=# select * from pg_dist_node;
nodeid | groupid | nodename | nodeport | noderack | hasmetadata | isactive | noderole | nodecluster | m
etadatasynced | shouldhaveshards
--------+---------+-----------+----------+----------+-------------+----------+----------+-------------+--
--------------+------------------
1 | 1 | localhost | 9701 | default | f | t | primary | default | f
| t
2 | 2 | localhost | 9702 | default | f | t | primary | default | f
| t
35 | 0 | localhost | 9700 | default | t | t | primary | default | t
| t
(3 rows)

Time: 4.534 ms
[local] talha@talha:9700-5673=# select master_get_active_worker_nodes();
master_get_active_worker_nodes
--------------------------------
(localhost,9701)
(localhost,9702)
(2 rows)
```

This is also used by `run_command_on_workers` which means that `run_command_on_workers` will not be useful in single node and it will be misleading in case coordinator is added to the cluster when there are other nodes.

The fix is to change this line: https://github.com/citusdata/citus/blob/93764a3782591ff0c680121a9ae4ee398541eef7/src/backend/distributed/operations/node_protocol.c#L466

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.