Skip to content

support write proxy data to uni ps#6848

Merged
ti-chi-bot merged 13 commits intomasterfrom
add-proxy-uni-ps-ffi
Feb 24, 2023
Merged

support write proxy data to uni ps#6848
ti-chi-bot merged 13 commits intomasterfrom
add-proxy-uni-ps-ffi

Conversation

@lidezhu
Copy link
Contributor

@lidezhu lidezhu commented Feb 19, 2023

What problem does this PR solve?

Issue Number: close #6728

Problem Summary: need support write proxy data to the global uni ps instance.

What is changed and how it works?

Add some ffi to support write proxy data to uni ps, mainly including write, delete, read, scan.

Check List

Tests

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

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

None

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Feb 19, 2023

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • CalvinNeo
  • JaySon-Huang
  • flowbehappy

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.

Details

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/needs-linked-issue release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Feb 19, 2023
@lidezhu lidezhu force-pushed the add-proxy-uni-ps-ffi branch 3 times, most recently from d1cdd24 to a756b5b Compare February 20, 2023 14:01
@lidezhu lidezhu force-pushed the add-proxy-uni-ps-ffi branch from a756b5b to 871089a Compare February 20, 2023 15:33
@lidezhu lidezhu changed the title [WIP] support write proxy data to uni ps support write proxy data to uni ps Feb 21, 2023
@ti-chi-bot ti-chi-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 21, 2023
@lidezhu lidezhu force-pushed the add-proxy-uni-ps-ffi branch from dde459d to 3d91ea6 Compare February 22, 2023 04:07
@lidezhu
Copy link
Contributor Author

lidezhu commented Feb 22, 2023

/run-all-tests

@lidezhu lidezhu requested a review from CalvinNeo February 23, 2023 09:00
Comment on lines +39 to +41
// For example, suppose a key in tikv to be {0x01, 0x02, 0x03}.
// If it is written by raft engine, then actual key uni ps see is the same as in tikv.
// But if it is written by kv engine, the actual key uni ps see will be {0x01, 0x01, 0x02, 0x03}.
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this cause problems with scanning raft keys? If raft-engine scan with '\x01' prefix, it will unexpectedly see some keys actually written to the kv engine.

Copy link
Contributor

Choose a reason for hiding this comment

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

what about this?

  • prepend another '\x01' for raft engine keys
  • prepend '\x02' for kv engine keys

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Prepend will cause a memory allocation. And there will be many raft log written to raft engine. So I suggest not change the format of raft engine key.
But we should prepend '\x02' instead of '\0x01` for kv engine keys to avoid they scan keys written by other one.

Copy link
Contributor

Choose a reason for hiding this comment

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

Then we should let the tikv's raft-engine project be aware of '\x02' prefix is reserved, and not to use this prefix in the future. /cc @CalvinNeo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should not be difficult. The convention that all raft keys in tikv start with 0x01 won't easily be changed.

@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 24, 2023
@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 24, 2023
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
option(ENABLE_UNI_PS_FFI "Enable write proxy data to uni ps" OFF)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the behavior "write proxy data to uni ps" controlled by this compile config but not a runtime config?

Copy link
Contributor Author

@lidezhu lidezhu Feb 24, 2023

Choose a reason for hiding this comment

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

Yes, but change it to a runtime config requires non-trivial change in proxy part. We may do it in another pr.

Copy link
Contributor

@JaySon-Huang JaySon-Huang left a comment

Choose a reason for hiding this comment

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

Are my comments correct?

@lidezhu
Copy link
Contributor Author

lidezhu commented Feb 24, 2023

Are my comments correct?

Good catch. Almost correct.

Copy link
Contributor

@JaySon-Huang JaySon-Huang 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 added the status/LGT1 Indicates that a PR has LGTM 1. label Feb 24, 2023
Copy link
Contributor

@flowbehappy flowbehappy left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@CalvinNeo CalvinNeo 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 added status/LGT2 Indicates that a PR has LGTM 2. status/LGT1 Indicates that a PR has LGTM 1. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Feb 24, 2023
@CalvinNeo
Copy link
Member

/merge

@ti-chi-bot
Copy link
Member

@CalvinNeo: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

You only need to trigger /merge once, and if the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

If you have any questions about the PR merge process, please refer to pr process.

Details

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 ti-community-infra/tichi repository.

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

DetailsCommit hash: ef80fd9

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Feb 24, 2023
@ti-chi-bot ti-chi-bot merged commit 8d2736a into master Feb 24, 2023
@lidezhu lidezhu deleted the add-proxy-uni-ps-ffi branch February 24, 2023 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT1 Indicates that a PR has LGTM 1. status/LGT2 Indicates that a PR has LGTM 2.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

support storing all data in UniversalPageStorage

5 participants