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

storage: expose etcd's transaction as LowLevelTxn interface to kv.Base #9016

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

MyonKeminta
Copy link
Contributor

@MyonKeminta MyonKeminta commented Jan 20, 2025

What problem does this PR solve?

Issue Number: Ref #8978
Split out from #8989

What is changed and how does it work?

Exposes etcd's transactoin API to kv.Base layer. The behavior is also simulated in `MemKV` and `LevelDBKV` to provide the same interface.

Check List

Tests

  • Unit test

Code changes

Side effects

  • Increased code complexity

Related changes

Release note

None.

…te the behavior in memkv and leveldb

Signed-off-by: MyonKeminta <MyonKeminta@users.noreply.github.com>
Copy link
Contributor

ti-chi-bot bot commented Jan 20, 2025

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ti-chi-bot ti-chi-bot bot added 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. dco-signoff: yes Indicates the PR's author has signed the dco. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jan 20, 2025
@MyonKeminta MyonKeminta marked this pull request as ready for review January 20, 2025 10:17
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 20, 2025
Signed-off-by: MyonKeminta <MyonKeminta@users.noreply.github.com>
Signed-off-by: MyonKeminta <MyonKeminta@users.noreply.github.com>
Copy link
Member

@JmPotato JmPotato left a comment

Choose a reason for hiding this comment

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

LGTM. Let's wait for #8919.

@JmPotato
Copy link
Member

/retest

Copy link

codecov bot commented Feb 12, 2025

Codecov Report

Attention: Patch coverage is 83.00654% with 52 lines in your changes missing coverage. Please review.

Project coverage is 76.25%. Comparing base (75cdec4) to head (a93a181).
Report is 1129 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9016      +/-   ##
==========================================
+ Coverage   74.91%   76.25%   +1.33%     
==========================================
  Files         416      469      +53     
  Lines       42103    71735   +29632     
==========================================
+ Hits        31543    54703   +23160     
- Misses       7810    13611    +5801     
- Partials     2750     3421     +671     
Flag Coverage Δ
unittests 76.25% <83.00%> (+1.33%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Feb 12, 2025
Copy link
Contributor

ti-chi-bot bot commented Feb 12, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JmPotato

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

Copy link
Contributor

ti-chi-bot bot commented Feb 12, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-02-12 06:01:55.148072924 +0000 UTC m=+422757.544294986: ☑️ agreed by JmPotato.

@ti-chi-bot ti-chi-bot bot added the approved label Feb 12, 2025
If(conditions ...LowLevelTxnCondition) LowLevelTxn
Then(ops ...LowLevelTxnOp) LowLevelTxn
Else(ops ...LowLevelTxnOp) LowLevelTxn
Commit(ctx context.Context) (LowLevelTxnResult, error)
Copy link
Member

Choose a reason for hiding this comment

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

Do we need ctx?

Signed-off-by: MyonKeminta <MyonKeminta@users.noreply.github.com>
@@ -147,3 +155,132 @@ func (txn *levelDBTxn) commit() error {

return txn.kv.Write(txn.batch, nil)
}

type levelDBLowLevelTxnSimulator struct {
Copy link
Member

Choose a reason for hiding this comment

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

Why name it *Simulator?


succeeds := true
for _, condition := range t.condition {
value, err := t.kv.DB.Get([]byte(condition.Key), nil)
Copy link
Member

Choose a reason for hiding this comment

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

I think kv.DB.Get is not right.

}
}

if !condition.CheckOnValue(valueStr, exists) {
Copy link
Member

Choose a reason for hiding this comment

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

Shall we use Has?

Copy link
Contributor

ti-chi-bot bot commented Feb 13, 2025

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

Test name Commit Details Required Rerun command
pull-integration-realcluster-test a93a181 link true /test pull-integration-realcluster-test

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.

@MyonKeminta
Copy link
Contributor Author

/hold

@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved dco-signoff: yes Indicates the PR's author has signed the dco. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. needs-1-more-lgtm Indicates a PR needs 1 more LGTM. 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants