-
Notifications
You must be signed in to change notification settings - Fork 21
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
Feat: auto migration badger/badger数据自动迁移 #210
Conversation
bf8a845
to
f921dbc
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #210 +/- ##
==========================================
+ Coverage 24.06% 25.32% +1.25%
==========================================
Files 178 181 +3
Lines 19337 20753 +1416
==========================================
+ Hits 4654 5256 +602
- Misses 14117 14676 +559
- Partials 566 821 +255
Flags with carried forward coverage won't be shown. Click here to find out more.
|
305f318
to
be3fc20
Compare
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.
LGTM
d1e7826
to
dc1b684
Compare
) | ||
|
||
const ( | ||
DsNameFundedAddrState = "FundedAddrStateDs" |
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.
下面6个命名是***Ds,开始两个没有
|
||
if !exist { | ||
dss[name] = ds | ||
log.Warnf("no migration sechedules for : %s", name) |
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.
sechedules 拼写错误
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.
是写错了, 应该是'schedule'
} | ||
var versionedDs datastore.Batching | ||
versionedDs, err = migrateOne(ctx, name, mfs, ds) | ||
// todo: version为空同时, 有同时存在两个版本的类型的可能性, 为了兼容, 这里暂时不返回错误. |
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.
“version为空同时” 读不通顺
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.
[doge]原因是, 中间有几个提交, 类型已经升级了, 但是还没有引入自动迁移的功能.为了兼容, 所以这里暂时不返回错误, 等到下个版本之后, 这里就可以直接返回错误了.
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.
是说这句话不通顺,什么是“为空同时”
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.
是说这句话不通顺,什么是“为空同时”
为空时
, hand slipped..
log.Infof("migrate: %s from %s to %s", name, oldVersion, string(targetVersion)) | ||
mfs = mfs.subScheduleFrom(oldVersion) | ||
if len(mfs) == 0 { | ||
return nil, fmt.Errorf("migrate:%s failed, can't find schedule from:%s", name, oldVersion) |
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.
没有可执行的migrate要返回错误吗
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.
这里是开发者需要保证对应的迁移必须存在, 所以, 这里正常情况是肯定存在的, 如果不存在,说明是代码写错了.
关联的Issues (Related Issues)
closes filecoin-project/venus#5283
改动 (Proposed Changes)
附注 (Additional Info)
自查清单 (Checklist)
如果为master分支中commit为如下区间的升级
595369d 2022-10-14 ... 9a21e00 2022-09-09
日志中包含迁移错误信息是正常现象, 因为这几个版本中的数据已经是新的格式了,但在这几个版本中还未加入自动迁移功能.所以会有这样的错误日志:
如果为
9a21e00 2022-09-09
之前的,数据则为老版本, 能看到正常迁移的日志, 不会出现任何迁移失败的错误日志: