瀏覽代碼

Merge remote-tracking branch 'origin/dev' into dev

Vanessa 2 年之前
父節點
當前提交
4226b66fd2
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      kernel/model/transaction.go

+ 6 - 1
kernel/model/transaction.go

@@ -1230,11 +1230,13 @@ func autoFixIndex() {
 	for rootID, updated := range rootUpdated {
 	for rootID, updated := range rootUpdated {
 		root := sql.GetBlock(rootID)
 		root := sql.GetBlock(rootID)
 		if nil == root {
 		if nil == root {
+			logging.LogWarnf("not found tree [%s] in database, reindex it", rootID)
 			reindexTree(rootID)
 			reindexTree(rootID)
 			continue
 			continue
 		}
 		}
 
 
 		if "" == updated {
 		if "" == updated {
+			// BlockTree 迁移,v2.6.3 之前没有 updated 字段
 			reindexTree(rootID)
 			reindexTree(rootID)
 			continue
 			continue
 		}
 		}
@@ -1242,12 +1244,15 @@ func autoFixIndex() {
 		btUpdated, _ := time.Parse("20060102150405", updated)
 		btUpdated, _ := time.Parse("20060102150405", updated)
 		dbUpdated, _ := time.Parse("20060102150405", root.Updated)
 		dbUpdated, _ := time.Parse("20060102150405", root.Updated)
 		if dbUpdated.Before(btUpdated.Add(-1 * time.Minute)) {
 		if dbUpdated.Before(btUpdated.Add(-1 * time.Minute)) {
+			logging.LogWarnf("tree [%s] is not up to date, reindex it", rootID)
 			reindexTree(rootID)
 			reindexTree(rootID)
 			continue
 			continue
 		}
 		}
 
 
 		roots := sql.GetBlockRedundant(rootID)
 		roots := sql.GetBlockRedundant(rootID)
 		if 1 < len(roots) {
 		if 1 < len(roots) {
+			logging.LogWarnf("exist more than one tree [%s], reindex it", rootID)
+			sql.RemoveTreeQueue(root.Box, rootID)
 			reindexTree(rootID)
 			reindexTree(rootID)
 			continue
 			continue
 		}
 		}
@@ -1269,5 +1274,5 @@ func reindexTree(rootID string) {
 
 
 	treenode.ReindexBlockTree(tree)
 	treenode.ReindexBlockTree(tree)
 	sql.UpsertTreeQueue(tree)
 	sql.UpsertTreeQueue(tree)
-	logging.LogInfof("reindex tree [%s]", tree.ID)
+	util.PushStatusBar(fmt.Sprintf("Reindexing tree [%s]", tree.HPath))
 }
 }