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

refactor: system tables in new region server #2344

Conversation

MichaelScofield
Copy link
Collaborator

I hereby agree to the terms of the GreptimeDB CLA

What's changed and what's your intention?

This PR mainly refactor the dependency between system tables and catalog manager. Now system tables (numbers table and information schema table) will be injected to a local memory catalog in FrontendCatalogManager (other ordinary user tables are initialized from kv backend).

I'm trying to get rid of LocalCatalogManager. Will unify catalog managers to FrontendCatalogManager afterwards.

Checklist

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.

Refer to a related PR or issue link (optional)

@codecov
Copy link

codecov bot commented Sep 7, 2023

Codecov Report

❗ No coverage uploaded for pull request base (migrate-region-server@7bb6ac3). Click here to learn what that means.
The diff coverage is n/a.

Additional details and impacted files
@@                   Coverage Diff                    @@
##             migrate-region-server    #2344   +/-   ##
========================================================
  Coverage                         ?   77.54%           
========================================================
  Files                            ?      724           
  Lines                            ?   115145           
  Branches                         ?        0           
========================================================
  Hits                             ?    89292           
  Misses                           ?    25853           
  Partials                         ?        0           

@WenyXu
Copy link
Member

WenyXu commented Sep 11, 2023

There are some conflicts.

@MichaelScofield MichaelScofield force-pushed the refactor/system-catalog-tables branch from 0e82153 to c918887 Compare September 12, 2023 02:35
Copy link
Collaborator

@fengjiachun fengjiachun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fengjiachun fengjiachun added this pull request to the merge queue Sep 12, 2023
Merged via the queue into GreptimeTeam:migrate-region-server with commit 5f7d118 Sep 12, 2023
11 checks passed
@MichaelScofield MichaelScofield deleted the refactor/system-catalog-tables branch September 12, 2023 03:37
Comment on lines +54 to +81
// There are two sources for finding a table: the `local_catalog_manager` and the
// `table_metadata_manager`.
//
// The `local_catalog_manager` is for storing tables that are often transparent, not saving any
// real data. For example, our system tables, the `numbers` table and the "information_schema"
// table.
//
// The `table_metadata_manager`, on the other hand, is for storing tables that are created by users,
// obviously.
//
// For now, separating the two makes the code simpler, at least in the retrieval site. Now we have
// `numbers` and `information_schema` system tables. Both have their special implementations. If we
// put them with other ordinary tables that are created by users, we need to check the table name
// to decide which `TableRef` to return. Like this:
//
// ```rust
// match table_name {
// "numbers" => ... // return NumbersTable impl
// "information_schema" => ... // return InformationSchemaTable impl
// _ => .. // return DistTable impl
// }
// ```
//
// On the other hand, because we use `MemoryCatalogManager` for system tables, we can easily store
// and retrieve the concrete implementation of the system tables by their names, no more "if-else"s.
//
// However, if the system table is designed to have more features in the future, we may revisit
// the implementation here.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • those are not doc comment
  • add ,ignore to the block language, otherwise it will become an uncompileable doc test

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intentionally not made them doc comments because they are not relevant to how to use this FrontendCatalogManager

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does that local mean?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not real tables that will be persisted in the kv backend which the TableMatadataManager in the FrontendCatalogManager proxied to

waynexia pushed a commit that referenced this pull request Sep 12, 2023
refactor: inverse the dependency between system tables and catalog manager
waynexia pushed a commit that referenced this pull request Sep 12, 2023
refactor: inverse the dependency between system tables and catalog manager
waynexia pushed a commit that referenced this pull request Sep 12, 2023
refactor: inverse the dependency between system tables and catalog manager
WenyXu pushed a commit to WenyXu/greptimedb that referenced this pull request Sep 13, 2023
refactor: inverse the dependency between system tables and catalog manager
paomian pushed a commit to paomian/greptimedb that referenced this pull request Oct 19, 2023
refactor: inverse the dependency between system tables and catalog manager
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants