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

Problem: versiondb don't support restore from local snapshot #1108

Merged
merged 8 commits into from
Jul 26, 2023

Conversation

yihuang
Copy link
Collaborator

@yihuang yihuang commented Jul 25, 2023

to setup a pruned versiondb node, we need to restore versiondb from local snapshot.

Solution:

  • implement a new subcommand for that.

👮🏻👮🏻👮🏻 !!!! REFERENCE THE PROBLEM YOUR ARE SOLVING IN THE PR TITLE AND DESCRIBE YOUR SOLUTION HERE !!!! DO NOT FORGET !!!! 👮🏻👮🏻👮🏻

PR Checklist:

  • Have you read the CONTRIBUTING.md?
  • Does your PR follow the C4 patch requirements?
  • Have you rebased your work on top of the latest master?
  • Have you checked your code compiles? (make)
  • Have you included tests for any non-trivial functionality?
  • Have you checked your code passes the unit tests? (make test)
  • Have you checked your code formatting is correct? (go fmt)
  • Have you checked your basic code style is fine? (golangci-lint run)
  • If you added any dependencies, have you checked they do not contain any known vulnerabilities? (go list -json -m all | nancy sleuth)
  • If your changes affect the client infrastructure, have you run the integration test?
  • If your changes affect public APIs, does your PR follow the C4 evolution of public contracts?
  • If your code changes public APIs, have you incremented the crate version numbers and documented your changes in the CHANGELOG.md?
  • If you are contributing for the first time, please read the agreement in CONTRIBUTING.md now and add a comment to this pull request stating that your PR is in accordance with the Developer's Certificate of Origin.

Thank you for your code, it's appreciated! :)

to setup a pruned versiondb node, we need to restore versiondb from local snapshot.

Solution:
- implement a new subcommand for that.
defer batch.Destroy()

var ts [TimestampSize]byte
binary.LittleEndian.PutUint64(ts[:], uint64(version))

Check failure

Code scanning / gosec

Potential integer overflow by integer type conversion

Potential integer overflow by integer type conversion
}
}()

return versionDB.Import(int64(height), ch)

Check failure

Code scanning / gosec

Potential integer overflow by integer type conversion

Potential integer overflow by integer type conversion
return err
}

snapshot, chChunks, err := store.Load(height, uint32(format))

Check failure

Code scanning / gosec

Potential integer overflow by integer type conversion

Potential integer overflow by integer type conversion
@yihuang yihuang marked this pull request as ready for review July 25, 2023 04:10
@yihuang yihuang requested a review from a team as a code owner July 25, 2023 04:10
@yihuang yihuang requested review from mmsqe and calvinaco and removed request for a team July 25, 2023 04:10
CHANGELOG.md Outdated Show resolved Hide resolved
Signed-off-by: yihuang <huang@crypto.com>
Copy link
Collaborator

@mmsqe mmsqe left a comment

Choose a reason for hiding this comment

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

we can remove tempfile now

@codecov
Copy link

codecov bot commented Jul 25, 2023

Codecov Report

Merging #1108 (c44216d) into main (7d97a76) will increase coverage by 23.95%.
The diff coverage is 0.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #1108       +/-   ##
===========================================
+ Coverage   22.24%   46.19%   +23.95%     
===========================================
  Files          47       82       +35     
  Lines        3044     7386     +4342     
===========================================
+ Hits          677     3412     +2735     
- Misses       2300     3612     +1312     
- Partials       67      362      +295     
Files Changed Coverage Δ
versiondb/client/cmd.go 0.00% <0.00%> (ø)
versiondb/client/restore.go 0.00% <0.00%> (ø)
versiondb/tsrocksdb/store.go 51.76% <0.00%> (ø)

... and 48 files with indirect coverage changes

@yihuang yihuang added this pull request to the merge queue Jul 25, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Jul 25, 2023
Signed-off-by: mmsqe <mavis@crypto.com>
@mmsqe mmsqe enabled auto-merge July 25, 2023 11:02
@mmsqe mmsqe added this pull request to the merge queue Jul 26, 2023
Merged via the queue into crypto-org-chain:main with commit 2ec31fe Jul 26, 2023
@yihuang yihuang deleted the version-restore branch July 26, 2023 05:30
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.

2 participants