-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
add db-upgrade V3 #3417
add db-upgrade V3 #3417
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3417 +/- ##
==========================================
+ Coverage 85.19% 85.22% +0.02%
==========================================
Files 1304 1307 +3
Lines 121308 122545 +1237
==========================================
+ Hits 103352 104433 +1081
- Misses 17956 18112 +156
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally LGTM, write a storage version mark to each rocksdb.
We will check meta's version when we call waitForMetadReady
, after meta is upgraded to V3, you could check it later, the PR is coming.
BTW, better rename upgrade_version
.
key.resize(key.size() - sizeof(TagID)); | ||
return key; | ||
} | ||
std::string NebulaKeyUtilsV3::dataVersionKey() { return "\xFF\xFF\xFF\xFF"; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could move it to NebulaKeyUtils
src/tools/db-upgrade/DbUpgrader.cpp
Outdated
"", | ||
"When the value is 1:2, upgrade the data from 1.x to 2.0 GA. " | ||
"When the value is 2RC:2, upgrade the data from 2.0 RC to 2.0 GA." | ||
"When the value is 2:3, upgrade the data from "); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from what?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My mistake
} | ||
auto code = readEngine_->ingest(ingest_sst_file_, true); | ||
if (code != ::nebula::cpp2::ErrorCode::SUCCEEDED) { | ||
LOG(FATAL) << "Faild upgrade 2:3 when ingest sst file:" << static_cast<int>(code); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LOG(FATAL)
will cause crash ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, and if ingest failed, upgrader can do nothing except crash.
6399d5a
@@ -83,7 +86,7 @@ Status UpgraderSpace::initSpace(const std::string& sId) { | |||
|
|||
// Use readonly rocksdb | |||
readEngine_.reset(new nebula::kvstore::RocksEngine( | |||
spaceId_, spaceVidLen_, srcPath_, "", nullptr, nullptr, true)); | |||
spaceId_, spaceVidLen_, srcPath_, "", nullptr, nullptr, false)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This rocksdb is originally a read-only
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because upgrade to 3.0 just need append new data by ingest sst file and write a dataVersionKey
to identity the data encode version. So there is no need to write a new rocksdb, just upgrade in place
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confused about readEngine_.reset
a writeable one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
read
means source and write
means destnation
What type of PR is this?
What does this PR do?
Which issue(s)/PR(s) this PR relates to?
Special notes for your reviewer, ex. impact of this fix, etc:
Additional context:
Checklist:
Release notes:
Please confirm whether to reflect in release notes and how to describe: