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

metabase: store version #1521

Merged
merged 2 commits into from
Jun 21, 2022
Merged

metabase: store version #1521

merged 2 commits into from
Jun 21, 2022

Conversation

fyrchik
Copy link
Contributor

@fyrchik fyrchik commented Jun 16, 2022

Close #1483.
Signed-off-by: Evgenii Stratonikov evgeniy@nspcc.ru

@codecov
Copy link

codecov bot commented Jun 16, 2022

Codecov Report

Merging #1521 (24d4dff) into master (78ea450) will increase coverage by 0.12%.
The diff coverage is 89.47%.

@@            Coverage Diff             @@
##           master    #1521      +/-   ##
==========================================
+ Coverage   35.56%   35.69%   +0.12%     
==========================================
  Files         307      308       +1     
  Lines       18230    18266      +36     
==========================================
+ Hits         6484     6520      +36     
+ Misses      11201    11198       -3     
- Partials      545      548       +3     
Impacted Files Coverage Δ
pkg/local_object_storage/metabase/db.go 73.15% <ø> (ø)
pkg/local_object_storage/metabase/version.go 88.88% <88.88%> (ø)
pkg/local_object_storage/metabase/control.go 82.14% <90.00%> (+3.19%) ⬆️
pkg/local_object_storage/metabase/shard_id.go 28.57% <0.00%> (+28.57%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 78ea450...24d4dff. Read the comment docs.

pkg/local_object_storage/metabase/version.go Outdated Show resolved Hide resolved
pkg/local_object_storage/metabase/version.go Outdated Show resolved Hide resolved
pkg/local_object_storage/metabase/select.go Outdated Show resolved Hide resolved

- Container ID is encoded as base58 string
- Object ID is encoded as base58 string
- Address is encoded as object ID + "/" + container ID
Copy link
Member

Choose a reason for hiding this comment

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

are you sure? not as "container ID + "/" + obejct ID"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

The main problem is to distinguish the case of initial initialization
and update from version 0. We can't do this at `Open`, because of
`resync_metabase` flag. Thus, the following approach was taken:
1. During `Open` check whether the metabase was initialized.
2. Check for the version in `Init` or write the new one if the metabase
   is new.
3. Update version in `Reset`.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
@fyrchik fyrchik merged commit 633b4e7 into nspcc-dev:master Jun 21, 2022
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.

Support simple versioning for the metabase
3 participants