Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[YSQL] Add UUID to yb_servers() function #11906

Closed
xenown opened this issue Mar 28, 2022 · 2 comments
Closed

[YSQL] Add UUID to yb_servers() function #11906

xenown opened this issue Mar 28, 2022 · 2 comments
Labels
area/ysql Yugabyte SQL (YSQL) kind/bug This issue is a bug priority/medium Medium priority issue

Comments

@xenown
Copy link

xenown commented Mar 28, 2022

Jira Link: DB-2753

Context

This is the 1st change in a series of diffs for porting the Postgres extension pg_cron to yugabyte. The following summary assumes you understand how the original pg cron extension worked.

Unlike the original extension, we intend for this port to have all Postgres instances act as workers as opposed to a single worker which will complete the scheduled pg cron jobs. A job runs on one of the workers in a YB cluster. The cron.job_run_details table shows information about each individual job run. Example:

system_platform=# SELECT * from cron.job_run_details;
 jobid | runid | job_pid |    database     | username |        command         |  status   | return_message |          start_time           |           end_time            |  node_uuid        
-------+-------+---------+-----------------+----------+------------------------+-----------+----------------+-------------------------------+-------------------------------+-------------
     1 |   212 | 3820788 | system_platform | yugabyte | select pg_sleep(20), 1 | succeeded | SELECT 1       | 2022-07-21 19:36:02.241619+00 | 2022-07-21 19:36:24.754601+00 |  aedf2-dfs
     2 |   211 | 3820766 | system_platform | yugabyte | select pg_sleep(20), 1 | succeeded | SELECT 1       | 2022-07-21 19:36:02.069145+00 | 2022-07-21 19:36:24.712906+00 |  sedf7-bbs

The cron.job_run_details table exists in the original extension. However, we add a node_uuid column, which is the UUID of the node on which a job ran. The purpose behind this extra column is it'll be easier for the user to find which logs to look at in the case of a job failure/issue/debugging/etc.

Problem

However, the UUID field is currently not accessible in YB Managed. As an open-source feature, YB support for the pg_cron extension should be available across all tiers (YB OSS/Anywhere/Managed).

Solution

We will add a node_uuid column to the yb_servers() function so users can map UUIDs to a specific node.

yugabyte=# select * from yb_servers();
   host    | port | uuid                                 | node_type | cloud  |   region    | zone  | public_ip 
-----------+------+--------------------------------------+-------------+-------+-------------------------------
 127.0.0.2 | 5433 | 123e4567-e89b-12d3-a456-426614174000 | primary   | cloud1 | datacenter1 | rack1 | 13.512.12
(3 rows)
@sushantrmishra
Copy link

Testing

@sushantrmishra sushantrmishra added area/ysql Yugabyte SQL (YSQL) and removed area/ysql Yugabyte SQL (YSQL) labels Jun 23, 2022
@tverona1 tverona1 changed the title [YSQL] Master learns the node name of all Tservers [YSQL] Master learns the node name of all Tservers Jun 24, 2022
@tverona1 tverona1 changed the title [YSQL] Master learns the node name of all Tservers [YSQL] Master learns the node name of all Tservers Jun 24, 2022
@yugabyte-ci yugabyte-ci added kind/bug This issue is a bug priority/medium Medium priority issue labels Jun 24, 2022
@paullee-yb paullee-yb changed the title [YSQL] Master learns the node name of all Tservers [YSQL] Add UUID to yb_servers() function Jul 27, 2022
@paullee-yb
Copy link
Contributor

Resolved here

@yugabyte-ci yugabyte-ci reopened this Aug 16, 2022
paullee-yb added a commit that referenced this issue Aug 26, 2022
Summary: This change resolves an inaccurate comment and removes trailing whitespace.

Test Plan:
./yb_build.sh --java-test TestLoadBalance#testYBServersFunction
./yb_build.sh --java-test TestYsqlUpgrade#migratingIsEquivalentToReinitdb
./yb_build.sh --java-test TestYsqlUpgrade#upgradeIsIdempotent
./yb_build.sh --java-test TestUsingOlderSnapshot
./bin/yb-ctl create --rf 3
./bin/ysqlsh -c 'select yb_servers()'

Reviewers: jason

Reviewed By: jason

Subscribers: yql

Differential Revision: https://phabricator.dev.yugabyte.com/D19170
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ysql Yugabyte SQL (YSQL) kind/bug This issue is a bug priority/medium Medium priority issue
Projects
None yet
Development

No branches or pull requests

4 participants