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

[Persistence] Update KVStore to use Badger wrapper functions #838

Merged
merged 4 commits into from
Jun 23, 2023

Conversation

h5law
Copy link
Contributor

@h5law h5law commented Jun 17, 2023

Description

This PR introduces unit tests to cover the KVStore's functionality as well as updating the KVStore logic to use the Badger wrapper functions update, view, etc.

This fixes the issues around deleting keys from the KVStore.

Issue

Fixes N/A

Type of change

Please mark the relevant option(s):

  • New feature, functionality or library
  • Bug fix
  • Code health or cleanup
  • Major breaking change
  • Documentation
  • Other

List of changes

  • Update KVStore to use badger's wrapper functions
  • Add KVStore unit tests

Testing

  • make develop_test; if any code changes were made
  • make test_e2e on k8s LocalNet; if any code changes were made
  • e2e-devnet-test passes tests on DevNet; if any code was changed
  • Docker Compose LocalNet; if any major functionality was changed or introduced
  • k8s LocalNet; if any infrastructure or configuration changes were made

Required Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added, or updated, godoc format comments on touched members (see: tip.golang.org/doc/comment)
  • I have tested my changes using the available tooling
  • I have updated the corresponding CHANGELOG

If Applicable Checklist

  • I have updated the corresponding README(s); local and/or global
  • I have added tests that prove my fix is effective or that my feature works
  • I have added, or updated, mermaid.js diagrams in the corresponding README(s)
  • I have added, or updated, documentation and mermaid.js diagrams in shared/docs/* if I updated shared/*README(s)

@h5law h5law added persistence Persistence specific changes e2e-devnet-test Runs E2E tests on devnet labels Jun 17, 2023
@h5law h5law requested review from Olshansk and dylanlott June 17, 2023 23:29
@h5law h5law self-assigned this Jun 17, 2023
@reviewpad reviewpad bot added large Pull request is large waiting-for-review labels Jun 17, 2023
@codecov
Copy link

codecov bot commented Jun 17, 2023

Codecov Report

Patch coverage: 77.08% and project coverage change: +0.33 🎉

Comparison is base (2d4f789) 31.52% compared to head (9198c7a) 31.86%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #838      +/-   ##
==========================================
+ Coverage   31.52%   31.86%   +0.33%     
==========================================
  Files         107      108       +1     
  Lines        9034     9126      +92     
==========================================
+ Hits         2848     2908      +60     
- Misses       5846     5874      +28     
- Partials      340      344       +4     
Impacted Files Coverage Δ
persistence/kvstore/kvstore.go 65.21% <77.08%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@h5law h5law mentioned this pull request Jun 18, 2023
20 tasks
Copy link
Member

@Olshansk Olshansk left a comment

Choose a reason for hiding this comment

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

PTAL at couple tiny comments and feel free to merge after

persistence/kvstore/kvstore_test.go Show resolved Hide resolved
key: invalidKey[:],
value: []byte("bar"),
fail: true,
expected: errors.Errorf("Key with size 65001 exceeded 65000 limit. Key:\n%s", hex.Dump(invalidKey[:1<<10])),
Copy link
Member

Choose a reason for hiding this comment

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

hex.Dump(invalidKey[:1<<10])),

🆒

persistence/kvstore/kvstore_test.go Outdated Show resolved Hide resolved
@h5law
Copy link
Contributor Author

h5law commented Jun 22, 2023

NOTE @Olshansk, @dylanlott is currently working on savepoints/rollbacks that touches the same code and this PR will probably only be used as a reference as he is changing the logic their. The new wrapper functions fix the bug with Delete() but need to be integrated with savepoints. Will wait on merging this until @dylanlott gives an update

@Olshansk
Copy link
Member

This PR is already complete and ready to be merged in, while savepoints & rollbacks PR is 1+ weeks away.

IMO we should merge this in and iterate on top of it. However, I will defer to @dylanlott to decide.

@dylanlott
Copy link
Contributor

This PR is already complete and ready to be merged in, while savepoints & rollbacks PR is 1+ weeks away.

IMO we should merge this in and iterate on top of it. However, I will defer to @dylanlott to decide.

I agree with merging this and addressing the logic changes necessary for savepoints later. It shouldn't hold this up.

@h5law h5law merged commit 0600ce7 into main Jun 23, 2023
9 checks passed
bryanchriswhite added a commit that referenced this pull request Jun 23, 2023
* pokt/main:
  [Persistence] Update KVStore to use Badger wrapper functions (#838)
  [Persistence] Adds TreeStore Module (#851)
bryanchriswhite added a commit that referenced this pull request Jun 23, 2023
* refactor/unicast-router:
  [Persistence] Update KVStore to use Badger wrapper functions (#838)
  fix: gofmt
  [Persistence] Adds TreeStore Module (#851)
bryanchriswhite added a commit that referenced this pull request Jun 23, 2023
* feat/integrate-bg-router:
  [Persistence] Update KVStore to use Badger wrapper functions (#838)
  fix: gofmt
  [Persistence] Adds TreeStore Module (#851)
bryanchriswhite added a commit that referenced this pull request Jun 23, 2023
* feat/integrate-bg-router:
  [Persistence] Update KVStore to use Badger wrapper functions (#838)
  fix: gofmt
  [Persistence] Adds TreeStore Module (#851)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e2e-devnet-test Runs E2E tests on devnet large Pull request is large persistence Persistence specific changes waiting-for-review
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants