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][ASH] Function and view for yb_tablet_info #19132

Closed
1 task done
hbhanawat opened this issue Sep 17, 2023 · 0 comments
Closed
1 task done

[YSQL][ASH] Function and view for yb_tablet_info #19132

hbhanawat opened this issue Sep 17, 2023 · 0 comments
Assignees
Labels
area/ysql Yugabyte SQL (YSQL) kind/enhancement This is an enhancement of an existing feature priority/medium Medium priority issue

Comments

@hbhanawat
Copy link
Contributor

hbhanawat commented Sep 17, 2023

Jira Link: DB-7930

Description

- A native view which gives more details about tablets on a tserver. This info can be used to join with the yb_auh function
- Ensure that the view is part of the system view

Warning: Please confirm that this issue does not contain any sensitive information

  • I confirm this issue does not contain any sensitive information.
@hbhanawat hbhanawat added area/ysql Yugabyte SQL (YSQL) status/awaiting-triage Issue awaiting triage area/active-history Active history of sessions labels Sep 17, 2023
@yugabyte-ci yugabyte-ci added kind/enhancement This is an enhancement of an existing feature priority/medium Medium priority issue labels Sep 17, 2023
@yugabyte-ci yugabyte-ci removed area/active-history Active history of sessions status/awaiting-triage Issue awaiting triage labels Sep 17, 2023
@hbhanawat hbhanawat added the area/active-history Active history of sessions label Sep 18, 2023
@hbhanawat hbhanawat changed the title [YSQL][ActiveHistory] Function and view for yb_tablet_info [YSQL][ASH] Function and view for yb_tablet_info Jan 3, 2024
@yugabyte-ci yugabyte-ci removed the area/active-history Active history of sessions label Mar 15, 2024
abhinab-yb added a commit that referenced this issue Apr 17, 2024
Summary:
This diff exposes all the local tablets (including YCQL tablets) of a tserver
through a YSQL view `yb_local_tablets`.

| Column | Type | Description |
| tablet_id | text | Id of the tablet |
| table_id | text | Id of the table the tablet is part of |
| table_type | text | Type of the table the tablet is part of. It can be YSQL, YCQL, System or Unknown |
| namespace_name | text | Namespace of the table the tablet is part of |
| ysql_schema_name | text | Schema of the table the tablet is part of |
| table_name | text | Name of the table the tablet is part of |
| partition_key_start | bytea | Start key of the partition (inclusive) |
| partition_key_end | bytea | End key of the partition (exclusive) |

For a table, the extreme left and right partition keys are null.

```
yugabyte=# create table a(id int, v text, primary key (id asc, v asc)) split at values ((1, 'a'), (2, 'b'), (3, 'c'));
CREATE TABLE
yugabyte=# create table b(id int);
CREATE TABLE
yugabyte=# select * from yb_local_tablets order by table_name, partition_key_start asc nulls first;
            tablet_id             |             table_id             | table_type | namespace_name | ysql_schema_name |  table_name  |  partition_key_start   |   partition_key_end
----------------------------------+----------------------------------+------------+----------------+------------------+--------------+------------------------+------------------------
 10ef53e820484245906d1e4ec6158cad | 000033c3000030008000000000004000 | YSQL       | yugabyte       | public           | a            |                        | \x48800000015361000021
 7ca1a1c505ea41019120de071631629a | 000033c3000030008000000000004000 | YSQL       | yugabyte       | public           | a            | \x48800000015361000021 | \x48800000025362000021
 72911ec96b864b25ac38d7a848b87372 | 000033c3000030008000000000004000 | YSQL       | yugabyte       | public           | a            | \x48800000025362000021 | \x48800000035363000021
 ac58a564f62b4b3a8f7f8d77a54a8a81 | 000033c3000030008000000000004000 | YSQL       | yugabyte       | public           | a            | \x48800000035363000021 |
 a0398e93339740ccbb9baed5be224f6d | 000033c3000030008000000000004005 | YSQL       | yugabyte       | public           | b            |                        | \x8000
 abf3882f81f94af0b6f448f1d82b207d | 000033c3000030008000000000004005 | YSQL       | yugabyte       | public           | b            | \x8000                 |
 03a5dbb5580346988c9886fef479c775 | e538fa8479cd4e44b51400f2f51d4696 | System     | system         |                  | transactions |                        | \x2000
 4701e00850864222bb5a8a5234b55441 | e538fa8479cd4e44b51400f2f51d4696 | System     | system         |                  | transactions | \x2000                 | \x4000
 aa459e3b918048cc8397b0deb2a949c0 | e538fa8479cd4e44b51400f2f51d4696 | System     | system         |                  | transactions | \x4000                 | \x6000
 488c999f3cbb4372b1c80f0aeb454412 | e538fa8479cd4e44b51400f2f51d4696 | System     | system         |                  | transactions | \x6000                 | \x8000
 5a75e61508ff4b66863899be99295ce1 | e538fa8479cd4e44b51400f2f51d4696 | System     | system         |                  | transactions | \x8000                 | \xa000
 82b69e10b92048aebec5c6efab0e1cf8 | e538fa8479cd4e44b51400f2f51d4696 | System     | system         |                  | transactions | \xa000                 | \xc000
 d1b1cb8ab9124ec6af8097c99a2d2612 | e538fa8479cd4e44b51400f2f51d4696 | System     | system         |                  | transactions | \xc000                 | \xe000
 ad3aa65273ad49c5b690c0cc1264789d | e538fa8479cd4e44b51400f2f51d4696 | System     | system         |                  | transactions | \xe000                 |
(14 rows)
```

Upgrade/Rollback safety:
This feature only accesses data inside the local tserver from YSQL, and doesn't communicate with other tservers and masters. This should be safe to upgrade/rollback
Jira: DB-7930

Test Plan:
./yb_build.sh --java-test TestPgRegressMisc#testPgRegressMiscIndependent
./yb_build.sh --java-test 'org.yb.pgsql.TestPgRegressRules#testPgRegressRules'
./yb_build.sh --java-test TestYsqlUpgrade

Reviewers: amitanand, jason, hsunder

Reviewed By: jason, hsunder

Subscribers: yql, hbhanawat, ybase, hsunder, bogdan

Differential Revision: https://phorge.dev.yugabyte.com/D31843
abhinab-yb added a commit that referenced this issue Apr 18, 2024
…lets

Summary:
Original commit: bf5fb1a / D31843
This diff exposes all the local tablets (including YCQL tablets) of a tserver
through a YSQL view `yb_local_tablets`.

| Column | Type | Description |
| tablet_id | text | Id of the tablet |
| table_id | text | Id of the table the tablet is part of |
| table_type | text | Type of the table the tablet is part of. It can be YSQL, YCQL, System or Unknown |
| namespace_name | text | Namespace of the table the tablet is part of |
| ysql_schema_name | text | Schema of the table the tablet is part of |
| table_name | text | Name of the table the tablet is part of |
| partition_key_start | bytea | Start key of the partition (inclusive) |
| partition_key_end | bytea | End key of the partition (exclusive) |

For a table, the extreme left and right partition keys are null.

```
yugabyte=# create table a(id int, v text, primary key (id asc, v asc)) split at values ((1, 'a'), (2, 'b'), (3, 'c'));
CREATE TABLE
yugabyte=# create table b(id int);
CREATE TABLE
yugabyte=# select * from yb_local_tablets order by table_name, partition_key_start asc nulls first;
            tablet_id             |             table_id             | table_type | namespace_name | ysql_schema_name |  table_name  |  partition_key_start   |   partition_key_end
----------------------------------+----------------------------------+------------+----------------+------------------+--------------+------------------------+------------------------
 10ef53e820484245906d1e4ec6158cad | 000033c3000030008000000000004000 | YSQL       | yugabyte       | public           | a            |                        | \x48800000015361000021
 7ca1a1c505ea41019120de071631629a | 000033c3000030008000000000004000 | YSQL       | yugabyte       | public           | a            | \x48800000015361000021 | \x48800000025362000021
 72911ec96b864b25ac38d7a848b87372 | 000033c3000030008000000000004000 | YSQL       | yugabyte       | public           | a            | \x48800000025362000021 | \x48800000035363000021
 ac58a564f62b4b3a8f7f8d77a54a8a81 | 000033c3000030008000000000004000 | YSQL       | yugabyte       | public           | a            | \x48800000035363000021 |
 a0398e93339740ccbb9baed5be224f6d | 000033c3000030008000000000004005 | YSQL       | yugabyte       | public           | b            |                        | \x8000
 abf3882f81f94af0b6f448f1d82b207d | 000033c3000030008000000000004005 | YSQL       | yugabyte       | public           | b            | \x8000                 |
 03a5dbb5580346988c9886fef479c775 | e538fa8479cd4e44b51400f2f51d4696 | System     | system         |                  | transactions |                        | \x2000
 4701e00850864222bb5a8a5234b55441 | e538fa8479cd4e44b51400f2f51d4696 | System     | system         |                  | transactions | \x2000                 | \x4000
 aa459e3b918048cc8397b0deb2a949c0 | e538fa8479cd4e44b51400f2f51d4696 | System     | system         |                  | transactions | \x4000                 | \x6000
 488c999f3cbb4372b1c80f0aeb454412 | e538fa8479cd4e44b51400f2f51d4696 | System     | system         |                  | transactions | \x6000                 | \x8000
 5a75e61508ff4b66863899be99295ce1 | e538fa8479cd4e44b51400f2f51d4696 | System     | system         |                  | transactions | \x8000                 | \xa000
 82b69e10b92048aebec5c6efab0e1cf8 | e538fa8479cd4e44b51400f2f51d4696 | System     | system         |                  | transactions | \xa000                 | \xc000
 d1b1cb8ab9124ec6af8097c99a2d2612 | e538fa8479cd4e44b51400f2f51d4696 | System     | system         |                  | transactions | \xc000                 | \xe000
 ad3aa65273ad49c5b690c0cc1264789d | e538fa8479cd4e44b51400f2f51d4696 | System     | system         |                  | transactions | \xe000                 |
(14 rows)
```

Upgrade/Rollback safety:
This feature only accesses data inside the local tserver from YSQL, and doesn't communicate with other tservers and masters. This should be safe to upgrade/rollback
Jira: DB-7930

Test Plan:
./yb_build.sh --java-test TestPgRegressMisc#testPgRegressMiscIndependent
./yb_build.sh --java-test 'org.yb.pgsql.TestPgRegressRules#testPgRegressRules'
./yb_build.sh --java-test TestYsqlUpgrade

Reviewers: amitanand, jason, hsunder

Reviewed By: jason

Subscribers: bogdan, hsunder, ybase, hbhanawat, yql

Tags: #jenkins-ready

Differential Revision: https://phorge.dev.yugabyte.com/D34227
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/enhancement This is an enhancement of an existing feature priority/medium Medium priority issue
Projects
None yet
Development

No branches or pull requests

3 participants