Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BACKPORT 2.14.10][#17712] DocDB: Fix system partitions query to not …
…return empty namespace name when its not set at table level Summary: Original commit: 218253c / D26033 Tables created before version 2.3 will have empty namespace name in master state, which in turn breaks the client partition routing since client receive empty namespace name. This change fixes the issue by resolving the namespace id to namespace name when namespace name is not set. Thanks @jhe for your help with validating the fix. Jira: DB-6814 Test Plan: Jenkins @jhe helped validate this change by creating a table in older version 2.2 and then upgrading the system. Before fix (notice that only the newly created table has a keyspace_name): ``` ycqlsh> select * from system.partitions; keyspace_name | table_name | start_key | end_key | id | replica_addresses ---------------+---------------------------------+-----------+---------+--------------------------------------+------------------------- | resource_role_permissions_index | 0x | 0x | 536e2bf0-825f-7283-9746-471b31c671c7 | {'127.0.0.1': 'LEADER'} | columns | 0x | 0x | 4418bfc9-dc72-72b4-894c-0112777c724c | {'127.0.0.1': 'LEADER'} | aggregates | 0x | 0x | 7c150dd2-a045-c495-8c4c-d2c966b6b11a | {'127.0.0.1': 'LEADER'} | size_estimates | 0x | 0x | 18e36d79-fb60-9c93-534d-8a21a1f10e98 | {'127.0.0.1': 'LEADER'} | keyspaces | 0x | 0x | f99f0aa3-1cc8-ad85-c544-b88dbe4c7d36 | {'127.0.0.1': 'LEADER'} | types | 0x | 0x | 1f94be70-fb7d-e6a4-6a47-187b194841b9 | {'127.0.0.1': 'LEADER'} jhe | test_after | 0x | 0x8000 | 27fabca6-ae97-55bc-5c41-3899f4891790 | {'127.0.0.1': 'LEADER'} jhe | test_after | 0x8000 | 0x | 8644a3cd-4c6f-bba7-fd47-f7761c24c5bb | {'127.0.0.1': 'LEADER'} | partitions | 0x | 0x | c3abda51-6757-ffb1-d14e-466c4d912cd9 | {'127.0.0.1': 'LEADER'} | triggers | 0x | 0x | e656d4d5-ce96-3b89-d94c-f4e913cc1fac | {'127.0.0.1': 'LEADER'} | role_permissions | 0x | 0x | 8bd3a5af-71ea-f6a2-0f42-a4027e760c30 | {'127.0.0.1': 'LEADER'} | views | 0x | 0x | 5d3c58c3-2ecc-4eb7-374f-88d4fa49efe0 | {'127.0.0.1': 'LEADER'} | peers | 0x | 0x | 178e5231-95bb-739d-aa46-f5497f2adb3b | {'127.0.0.1': 'LEADER'} | local | 0x | 0x | 3fc04471-ae7a-2a9c-8a4f-e173b41aabeb | {'127.0.0.1': 'LEADER'} | functions | 0x | 0x | c8b1b8ec-69f7-13a9-d741-a8617a7aed38 | {'127.0.0.1': 'LEADER'} | roles | 0x | 0x | d65d943f-65d4-93be-3d41-2669a0d323d2 | {'127.0.0.1': 'LEADER'} | tables | 0x | 0x | a2447e71-a6b9-bea4-f147-036c487133ac | {'127.0.0.1': 'LEADER'} | indexes | 0x | 0x | 91891ec0-8bb3-d281-2e4c-6f7062879838 | {'127.0.0.1': 'LEADER'} | test | 0x | 0x7fff | 491d7947-4fd1-6685-da40-7da00ad14d93 | {'127.0.0.1': 'LEADER'} | test | 0x7fff | 0x | 16d0567a-90cb-99a0-f645-89db0e90f473 | {'127.0.0.1': 'LEADER'} ``` With the fix (all tables have a keyspace_name): ``` ycqlsh> select * from system.partitions; keyspace_name | table_name | start_key | end_key | id | replica_addresses ---------------+---------------------------------+-----------+---------+--------------------------------------+--------------------------- system_auth | resource_role_permissions_index | 0x | 0x | 536e2bf0-825f-7283-9746-471b31c671c7 | {'127.0.0.1': 'LEADER'} system_schema | columns | 0x | 0x | 4418bfc9-dc72-72b4-894c-0112777c724c | {'127.0.0.1': 'LEADER'} system_schema | aggregates | 0x | 0x | 7c150dd2-a045-c495-8c4c-d2c966b6b11a | {'127.0.0.1': 'LEADER'} system | size_estimates | 0x | 0x | 18e36d79-fb60-9c93-534d-8a21a1f10e98 | {'127.0.0.1': 'LEADER'} system_schema | keyspaces | 0x | 0x | f99f0aa3-1cc8-ad85-c544-b88dbe4c7d36 | {'127.0.0.1': 'LEADER'} system_schema | types | 0x | 0x | 1f94be70-fb7d-e6a4-6a47-187b194841b9 | {'127.0.0.1': 'LEADER'} jhe | test_after | 0x | 0x8000 | 27fabca6-ae97-55bc-5c41-3899f4891790 | {'127.0.0.1': 'FOLLOWER'} jhe | test_after | 0x8000 | 0x | 8644a3cd-4c6f-bba7-fd47-f7761c24c5bb | {'127.0.0.1': 'FOLLOWER'} system | partitions | 0x | 0x | c3abda51-6757-ffb1-d14e-466c4d912cd9 | {'127.0.0.1': 'LEADER'} system_schema | triggers | 0x | 0x | e656d4d5-ce96-3b89-d94c-f4e913cc1fac | {'127.0.0.1': 'LEADER'} system_auth | role_permissions | 0x | 0x | 8bd3a5af-71ea-f6a2-0f42-a4027e760c30 | {'127.0.0.1': 'LEADER'} system_schema | views | 0x | 0x | 5d3c58c3-2ecc-4eb7-374f-88d4fa49efe0 | {'127.0.0.1': 'LEADER'} system | peers | 0x | 0x | 178e5231-95bb-739d-aa46-f5497f2adb3b | {'127.0.0.1': 'LEADER'} system | local | 0x | 0x | 3fc04471-ae7a-2a9c-8a4f-e173b41aabeb | {'127.0.0.1': 'LEADER'} system_schema | functions | 0x | 0x | c8b1b8ec-69f7-13a9-d741-a8617a7aed38 | {'127.0.0.1': 'LEADER'} system_auth | roles | 0x | 0x | d65d943f-65d4-93be-3d41-2669a0d323d2 | {'127.0.0.1': 'LEADER'} system_schema | tables | 0x | 0x | a2447e71-a6b9-bea4-f147-036c487133ac | {'127.0.0.1': 'LEADER'} system_schema | indexes | 0x | 0x | 91891ec0-8bb3-d281-2e4c-6f7062879838 | {'127.0.0.1': 'LEADER'} jhe | test | 0x | 0x7fff | 491d7947-4fd1-6685-da40-7da00ad14d93 | {'127.0.0.1': 'LEADER'} jhe | test | 0x7fff | 0x | 16d0567a-90cb-99a0-f645-89db0e90f473 | {'127.0.0.1': 'FOLLOWER'} ``` Reviewers: jhe, bogdan, slingam Reviewed By: bogdan Subscribers: bogdan, jhe, ybase, yql Differential Revision: https://phorge.dev.yugabyte.com/D26161
- Loading branch information