浏览代码

lib/db: Remove all sequences related to the folder (fixes #4928) (#4929)

xjtdy888 7 年之前
父节点
当前提交
506181599c
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8 0
      lib/db/leveldb_dbinstance.go

+ 8 - 0
lib/db/leveldb_dbinstance.go

@@ -539,6 +539,14 @@ func (db *Instance) dropFolder(folder []byte) {
 	}
 	}
 	dbi.Release()
 	dbi.Release()
 
 
+	// Remove all sequences related to the folder
+	sequenceKey := db.sequenceKey([]byte(folder), 0)
+	dbi = t.NewIterator(util.BytesPrefix(sequenceKey[:4]), nil)
+	for dbi.Next() {
+		db.Delete(dbi.Key(), nil)
+	}
+	dbi.Release()
+
 	// Remove all items related to the given folder from the global bucket
 	// Remove all items related to the given folder from the global bucket
 	dbi = t.NewIterator(util.BytesPrefix([]byte{KeyTypeGlobal}), nil)
 	dbi = t.NewIterator(util.BytesPrefix([]byte{KeyTypeGlobal}), nil)
 	for dbi.Next() {
 	for dbi.Next() {