lib/db: Prevent GC concurrently with migration (fixes #6389) (#6390)

This commit is contained in:
Jakob Borg
2020-02-29 19:51:32 +01:00
committed by GitHub
parent ac19cdb2cd
commit c08e253e7c
2 changed files with 20 additions and 3 deletions
+5
View File
@@ -57,6 +57,11 @@ type schemaUpdater struct {
}
func (db *schemaUpdater) updateSchema() error {
// Updating the schema can touch any and all parts of the database. Make
// sure we do not run GC concurrently with schema migrations.
db.gcMut.Lock()
defer db.gcMut.Unlock()
miscDB := NewMiscDataNamespace(db.Lowlevel)
prevVersion, _, err := miscDB.Int64("dbVersion")
if err != nil {