Skip to content
This repository has been archived by the owner on Apr 1, 2023. It is now read-only.

code refactor - considering removing table_id in current connector code #237

Open
jerryhfeng opened this issue Apr 28, 2021 · 0 comments
Open
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers sz_2w

Comments

@jerryhfeng
Copy link
Contributor

Currently, the table_id(and index_id) in pggate/connector layer is a string presentation of of UUID hardcoded from database oid(uint32) and table oid. An optimization is to remove it and replace with original oid only for following two reasons.

  1. Reducing multiple IDs confusion. For same db object, e.g. table, there are quite a few different Ids. - oid(uint32), pgobjectId(uint32 db_oid +uint32 table_oid), uuid(crafted from pgobjectId), table_id(string format of uuid). They all come from oid and thus redundant to some degree.
  2. The usage of table_id is now in two places, first it is used as the unique SKV schema name, second it is used as the unique key for catalog cache in catalog manager. For first usage, the table oid (in string) is enough as it is unique within a collection(database). For second usage, the table cataloge cache now mingles tables from all different database in one map (thus need table_id which contains db oid, as table oid is not unique across databases). This need to be changed in the future as this would be a scalability issue as well as cross user account security issue. A seeming better way is to have table map/cache per database, then only table oid is unique in such context and can be used as key to the map. This will potentially save memory as well, as most client will operate only in one DB.
@jerryhfeng jerryhfeng added enhancement New feature or request good first issue Good for newcomers sz_2w labels Apr 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request good first issue Good for newcomers sz_2w
Projects
None yet
Development

No branches or pull requests

2 participants