Delete existing message index when loading from snapshot
This commit is contained in:
parent
48c57d394b
commit
b8137f6b4d
@ -176,8 +176,12 @@ func PopulateAfterSnapshot(lctx context.Context, basePath string, cs ChainStore)
|
|||||||
}
|
}
|
||||||
|
|
||||||
dbPath := path.Join(basePath, dbName)
|
dbPath := path.Join(basePath, dbName)
|
||||||
|
|
||||||
|
// if a database already exists, we try to delete it and create a new one
|
||||||
if _, err := os.Stat(dbPath); err == nil {
|
if _, err := os.Stat(dbPath); err == nil {
|
||||||
return xerrors.Errorf("msgindex already exists at %s", dbPath)
|
if err = os.Remove(dbPath); err != nil {
|
||||||
|
return xerrors.Errorf("msgindex already exists at %s and can't be deleted", dbPath)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
db, err := sql.Open("sqlite3", dbPath)
|
db, err := sql.Open("sqlite3", dbPath)
|
||||||
|
Loading…
Reference in New Issue
Block a user