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

fix: market client crush caused by migrate a nil ds/market-client迁移了空的ds导致panic. #215

Merged
merged 1 commit into from
Oct 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions models/badger/migrate/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,19 +252,20 @@ func migrateOne(ctx context.Context, name string, mfs migrateFuncSchedule, ds da
func Migrate(ctx context.Context, dss map[string]datastore.Batching) (map[string]datastore.Batching, error) {
var err error
for name, ds := range dss {
if ds == nil {
continue
}
mfs, exist := migrateDs[name]

if !exist {
dss[name] = ds
log.Warnf("no migration sechedules for : %s", name)
continue
}
var versionedDs datastore.Batching
versionedDs, err = migrateOne(ctx, name, mfs, ds)

// todo: version为空同时, 有同时存在两个版本的类型的可能性, 为了兼容, 这里暂时不返回错误.
// 后续的版本升级中如果出错, 应该直接返回.
if err != nil {
dss[name] = ds
log.Warnf("migrate:%s failed:%s", name, err.Error())
continue
}
Expand Down