From dba12d6111db8e757ba0f13e7c32b4ec1107c926 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Sun, 8 Jan 2023 22:57:53 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E8=87=AA=E5=8A=A8=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E7=B4=A2=E5=BC=95=20https://github.?= =?UTF-8?q?com/siyuan-note/siyuan/issues/7016?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/transaction.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/model/transaction.go b/kernel/model/transaction.go index e330791f2..7c70ada93 100644 --- a/kernel/model/transaction.go +++ b/kernel/model/transaction.go @@ -1230,11 +1230,13 @@ func autoFixIndex() { for rootID, updated := range rootUpdated { root := sql.GetBlock(rootID) if nil == root { + logging.LogWarnf("not found tree [%s] in database, reindex it", rootID) reindexTree(rootID) continue } if "" == updated { + // BlockTree 迁移,v2.6.3 之前没有 updated 字段 reindexTree(rootID) continue } @@ -1242,12 +1244,15 @@ func autoFixIndex() { btUpdated, _ := time.Parse("20060102150405", updated) dbUpdated, _ := time.Parse("20060102150405", root.Updated) if dbUpdated.Before(btUpdated.Add(-1 * time.Minute)) { + logging.LogWarnf("tree [%s] is not up to date, reindex it", rootID) reindexTree(rootID) continue } roots := sql.GetBlockRedundant(rootID) if 1 < len(roots) { + logging.LogWarnf("exist more than one tree [%s], reindex it", rootID) + sql.RemoveTreeQueue(root.Box, rootID) reindexTree(rootID) continue }