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

docs: RFC for keyspace #39685

Merged
merged 40 commits into from
Oct 30, 2024
Merged

docs: RFC for keyspace #39685

merged 40 commits into from
Oct 30, 2024

Conversation

ystaticy
Copy link
Contributor

@ystaticy ystaticy commented Dec 6, 2022

Signed-off-by: ystaticy y_static_y@sina.com

What problem does this PR solve?

Issue Number: ref #40425

Problem Summary:

What is changed and how it works?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

Signed-off-by: ystaticy <y_static_y@sina.com>
@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has not been approved.

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added do-not-merge/invalid-title release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 6, 2022
@sre-bot
Copy link
Contributor

sre-bot commented Dec 6, 2022

CLA assistant check
All committers have signed the CLA.

@ystaticy ystaticy changed the title add keyspace rfc docs:RFC for keyspace Dec 6, 2022
Signed-off-by: ystaticy <y_static_y@sina.com>
iosmanthus and others added 2 commits December 9, 2022 16:53
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Add client-go and coprocessor section
@ti-chi-bot ti-chi-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 12, 2022
This was referenced Jan 5, 2023
Copy link

codecov bot commented Feb 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.2399%. Comparing base (341503b) to head (16d9467).
Report is 191 commits behind head on master.

Current head 16d9467 differs from pull request most recent head bb2efa7

Please upload reports for the commit bb2efa7 to get more accurate results.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #39685        +/-   ##
================================================
+ Coverage   72.4329%   81.2399%   +8.8069%     
================================================
  Files          1491       2638      +1147     
  Lines        428997     717923    +288926     
================================================
+ Hits         310735     583240    +272505     
- Misses        99002     111483     +12481     
- Partials      19260      23200      +3940     

Signed-off-by: y_static_y@sina.com <y_static_y@sina.com>
Signed-off-by: y_static_y@sina.com <y_static_y@sina.com>
Signed-off-by: y_static_y@sina.com <y_static_y@sina.com>
Signed-off-by: y_static_y@sina.com <y_static_y@sina.com>
Signed-off-by: y_static_y@sina.com <y_static_y@sina.com>
Signed-off-by: y_static_y@sina.com <y_static_y@sina.com>
Copy link

ti-chi-bot bot commented May 11, 2024

@AmoebaProtozoa: adding LGTM is restricted to approvers and reviewers in OWNERS files.

In response to this:

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Signed-off-by: y_static_y@sina.com <y_static_y@sina.com>
Signed-off-by: y_static_y@sina.com <y_static_y@sina.com>

### PD

PD is responsible for managing `Keyspace` metadata. It provides HTTP and RPC interfaces to create, load, and modify `Keyspace` metadata. All other components retrieve the keyspace metadata from PD.
Copy link
Member

Choose a reason for hiding this comment

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

Could you please add a raw list of the HTTP and RPC interfaces?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good, I added links to the two interfaces below.

Copy link
Contributor

Choose a reason for hiding this comment

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

So users need to call the HTTP/RPC interfaces or use pd-ctl instead of SQL?

[**Keyspace Meta**](https://github.com/pingcap/kvproto/blob/d9297553c9009f569eaf4350f68a908f7811ee55/proto/keyspacepb.proto#L26C1-L33C2) is built when a keyspace is created, and the keyspace management interface operates on this metadata. The keyspace state in the metadata changes according to the keyspace state machine. The state change logic is as follows:
![keyspace-state-machine.png](imgs%2Fkeyspace-state-machine.png)

### TiDB
Copy link
Member

@bb7133 bb7133 Oct 28, 2024

Choose a reason for hiding this comment

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

It would be great if you can describe some plans about the observability(metrics, Grafana...) here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I've added the relevant descriptions below. PTAL~

Signed-off-by: y_static_y@sina.com <y_static_y@sina.com>
@ystaticy ystaticy changed the title docs:RFC for keyspace docs: RFC for keyspace Oct 29, 2024
Signed-off-by: y_static_y@sina.com <y_static_y@sina.com>
Signed-off-by: y_static_y@sina.com <y_static_y@sina.com>
Signed-off-by: y_static_y@sina.com <y_static_y@sina.com>
Signed-off-by: y_static_y@sina.com <y_static_y@sina.com>
Copy link
Member

@bb7133 bb7133 left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Oct 29, 2024

### PD

PD is responsible for managing `Keyspace` metadata. It provides HTTP and RPC interfaces to create, load, and modify `Keyspace` metadata. All other components retrieve the keyspace metadata from PD.
Copy link
Contributor

Choose a reason for hiding this comment

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

So users need to call the HTTP/RPC interfaces or use pd-ctl instead of SQL?

- The default GC management type for a keyspace is global GC.
2. Keyspace Level GC:
- Indicates that the keyspace will advance its own GC safe point.
- `Keyspace` GC related data includes: minimum start timestamp, GC safe point, and service safe point, which are stored in the dedicated path of each keyspace in PD.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can the GC parameters (e.g. tidb_gc_life_time) by set by each tenant separately? If so, by what kind of interface? HTTP/RPC?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can the GC parameters (e.g. tidb_gc_life_time) by set by each tenant separately? If so, by what kind of interface? HTTP/RPC?

Keyspace users can set tidb_gc_life_time directly using the SET SQL command just as before. This is because the system variables for each keyspace user are isolated.

Copy link
Contributor Author

@ystaticy ystaticy Oct 29, 2024

Choose a reason for hiding this comment

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

In the keyspace scenario, all SQL operations remain the same as without a configured keyspace.

@ystaticy
Copy link
Contributor Author

So users need to call the HTTP/RPC interfaces or use pd-ctl instead of SQL?
@djshow832 Yes, users need to call PD to create keyspace instead of use SQL, because When using SQL, it is always connected to a specific TiDB, which must belong to either the Null keyspace or a specific keyspace. The Null keyspace corresponds to a TiDB cluster that is not configured with a keyspace.

@djshow832
Copy link
Contributor

So users need to call the HTTP/RPC interfaces or use pd-ctl instead of SQL?

@djshow832 Yes, users need to call PD to create keyspace instead of use SQL, because When using SQL, it is always connected to a specific TiDB, which must belong to either the Null keyspace or a specific keyspace. The Null keyspace corresponds to a TiDB cluster that is not configured with a keyspace.

It's fine for serverless, but it's not friendly to end users IMO.

Why can't you connect to any TiDB?

@ystaticy
Copy link
Contributor Author

So users need to call the HTTP/RPC interfaces or use pd-ctl instead of SQL?

@djshow832 Yes, users need to call PD to create keyspace instead of use SQL, because When using SQL, it is always connected to a specific TiDB, which must belong to either the Null keyspace or a specific keyspace. The Null keyspace corresponds to a TiDB cluster that is not configured with a keyspace.

It's fine for serverless, but it's not friendly to end users IMO.

Why can't you connect to any TiDB?

An active TiDB instance is either in a Null Keyspace or configured with a specific keyspace. However, we should not create new keyspaces through any existing keyspace, as no keyspace has a 'manager' or higher-level status.

@baiyuqing What are your thoughts on this question?

@baiyuqing
Copy link

baiyuqing commented Oct 30, 2024

So users need to call the HTTP/RPC interfaces or use pd-ctl instead of SQL?

@djshow832 Yes, users need to call PD to create keyspace instead of use SQL, because When using SQL, it is always connected to a specific TiDB, which must belong to either the Null keyspace or a specific keyspace. The Null keyspace corresponds to a TiDB cluster that is not configured with a keyspace.

It's fine for serverless, but it's not friendly to end users IMO.
Why can't you connect to any TiDB?

An active TiDB instance is either in a Null Keyspace or configured with a specific keyspace. However, we should not create new keyspaces through any existing keyspace, as no keyspace has a 'manager' or higher-level status.

@baiyuqing What are your thoughts on this question?

Keyspace is aim to introduce ability to provide tenant-isolated space on single TiKV, different tenant's TiDB is invisible to eatch other. All keyspaces are basically equal, without hierarchy design. This doc is mainly about it.

In the real-world, people is able to leverage keyspace mechanism to build multi-tenant db system on single TiKV cluster and hierarchical feature by existing http/grpc interface. SQL is easy to use indeed in most cases. However to provide SQL approach needs another new design and investigation.

Copy link

ti-chi-bot bot commented Oct 30, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: AmoebaProtozoa, baiyuqing, bb7133, djshow832

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Oct 30, 2024
Copy link

ti-chi-bot bot commented Oct 30, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-10-29 06:15:07.365786797 +0000 UTC m=+330420.204942343: ☑️ agreed by bb7133.
  • 2024-10-30 11:03:45.481669102 +0000 UTC m=+434138.320824633: ☑️ agreed by djshow832.

@djshow832
Copy link
Contributor

LGTM

@pingcap pingcap deleted a comment from ti-chi-bot bot Oct 30, 2024
Copy link

tiprow bot commented Oct 30, 2024

@ystaticy: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
tidb_parser_test 9d7af9e link true /test tidb_parser_test
fast_test_tiprow 9d7af9e link true /test fast_test_tiprow

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@ti-chi-bot ti-chi-bot bot merged commit 83f040b into pingcap:master Oct 30, 2024
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants