An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: An issue that caused cloud data corruption https://github.com/siyuan-note/siyuan/issues/9846
Daniel94077b908b33
diff --git a/kernel/filesys/tree.go b/kernel/filesys/tree.goindex 5209b78e22..f75930baa4 100644--- a/kernel/filesys/tree.go+++ b/kernel/filesys/tree.go@@ -114,22 +114,6 @@ func LoadTreeByData(data []byte, boxID, p string, luteEngine *lute.Lute) (ret *preturn}-func WriteTreeWithoutChangeTime(tree *parse.Tree) (err error) {- data, filePath, err := prepareWriteTree(tree)- if nil != err {- return- }-- if err = filelock.WriteFileWithoutChangeTime(filePath, data); nil != err {- msg := fmt.Sprintf("write data [%s] failed: %s", filePath, err)- logging.LogErrorf(msg)- return errors.New(msg)- }-- afterWriteTree(tree)- return-}-func WriteTree(tree *parse.Tree) (err error) {data, filePath, err := prepareWriteTree(tree)if nil != err {diff --git a/kernel/go.mod b/kernel/go.modindex 27239306c4..22bc6d41de 100644--- a/kernel/go.mod+++ b/kernel/go.mod@@ -8,7 +8,7 @@ require (code.sajari.com/docconv v1.3.8github.com/88250/clipboard v0.1.5github.com/88250/epub v0.0.0-20230830085737-c19055cd1f48- github.com/88250/gulu v1.2.3-0.20231208041529-dafc64f2bd1d+ github.com/88250/gulu v1.2.3-0.20231209020950-b7b6994e395cgithub.com/88250/lute v1.7.6-0.20231205144411-36eb02d113a6github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720cgithub.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1@@ -50,10 +50,10 @@ require (github.com/rqlite/sql v0.0.0-20221103124402-8f9ff0ceb8f0github.com/sashabaranov/go-openai v1.17.9github.com/shirou/gopsutil/v3 v3.23.11- github.com/siyuan-note/dejavu v0.0.0-20231208142721-8ee5cca6b637+ github.com/siyuan-note/dejavu v0.0.0-20231209022337-1ab041167449github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75github.com/siyuan-note/eventbus v0.0.0-20230804030110-cf250f838c80- github.com/siyuan-note/filelock v0.0.0-20231206081043-b75b363ddb1b+ github.com/siyuan-note/filelock v0.0.0-20231209021753-ecf23a6be73bgithub.com/siyuan-note/httpclient v0.0.0-20231120083123-750db4d28b38github.com/siyuan-note/logging v0.0.0-20231208035918-61f884c854f0github.com/siyuan-note/riff v0.0.0-20231128081053-0cd7a5fa0076@@ -78,7 +78,7 @@ require (github.com/andybalholm/brotli v1.0.6 // indirectgithub.com/andybalholm/cascadia v1.3.2 // indirectgithub.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef // indirect- github.com/aws/aws-sdk-go v1.48.15 // indirect+ github.com/aws/aws-sdk-go v1.48.16 // indirectgithub.com/bytedance/sonic v1.10.2 // indirectgithub.com/cespare/xxhash/v2 v2.2.0 // indirectgithub.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirectdiff --git a/kernel/go.sum b/kernel/go.sumindex dc8c54c564..3d06471a7e 100644--- a/kernel/go.sum+++ b/kernel/go.sum@@ -8,8 +8,8 @@ github.com/88250/epub v0.0.0-20230830085737-c19055cd1f48 h1:qiE88Pw/9GG8hvMfpfB4github.com/88250/epub v0.0.0-20230830085737-c19055cd1f48/go.mod h1:UgVSq5iO9pOvqs3hIGNVk6WXDiAB0v3Dlg4nssQJ7W4=github.com/88250/go-sqlite3 v1.14.13-0.20220714142610-fbbda1ee84f5 h1:8HdZozCsXSiEXYAo8Zbi/r2Ld6Dd4MmGHgir3EaSuHQ=github.com/88250/go-sqlite3 v1.14.13-0.20220714142610-fbbda1ee84f5/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=-github.com/88250/gulu v1.2.3-0.20231208041529-dafc64f2bd1d h1:5v2fUykQ2LHVLjYH6hitmpGQ4q9NIFTzdncnI7TNkaY=-github.com/88250/gulu v1.2.3-0.20231208041529-dafc64f2bd1d/go.mod h1:pTWnjt+6qUqNnP9xltswsJxgCBVu3C7eW09u48LWX0k=+github.com/88250/gulu v1.2.3-0.20231209020950-b7b6994e395c h1:Fas3hxqP33xA9KKDV50jUmppiiOukk5bdV00Hk5VSSk=+github.com/88250/gulu v1.2.3-0.20231209020950-b7b6994e395c/go.mod h1:pTWnjt+6qUqNnP9xltswsJxgCBVu3C7eW09u48LWX0k=github.com/88250/lute v1.7.6-0.20231205144411-36eb02d113a6 h1:nCZMMQB5XqhX2jJYegnmrlBAYKotE7Cwex17Kz24rko=github.com/88250/lute v1.7.6-0.20231205144411-36eb02d113a6/go.mod h1:+wUqx/1kdFDbWtxn9LYJlaCOAeol2pjSO6w+WJTVQsg=github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c h1:Dl/8S9iLyPMTElnWIBxmjaLiWrkI5P4a21ivwAn5pU0=@@ -49,8 +49,8 @@ github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de h1:FxWPpzIjnTlhPgithub.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de/go.mod h1:DCaWoUhZrYW9p1lxo/cm8EmUOOzAPSEZNGF2DK1dJgw=github.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef h1:2JGTg6JapxP9/R33ZaagQtAM4EkkSYnIAlOG5EI8gkM=github.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef/go.mod h1:JS7hed4L1fj0hXcyEejnW57/7LCetXggd+vwrRnYeII=-github.com/aws/aws-sdk-go v1.48.15 h1:Gad2C4pLzuZDd5CA0Rvkfko6qUDDTOYru145gkO7w/Y=-github.com/aws/aws-sdk-go v1.48.15/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk=+github.com/aws/aws-sdk-go v1.48.16 h1:mcj2/9J/MJ55Dov+ocMevhR8Jv6jW/fAxbrn4a1JFc8=+github.com/aws/aws-sdk-go v1.48.16/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk=github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=github.com/bytedance/sonic v1.10.0-rc/go.mod h1:ElCzW+ufi8qKqNW0FY314xriJhyJhuoJ3gFZdAHF7NM=github.com/bytedance/sonic v1.10.2 h1:GQebETVBxYB7JGWJtLBi07OVzWwt+8dWA00gEVW2ZFE=@@ -356,14 +356,14 @@ github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRgithub.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d h1:lvCTyBbr36+tqMccdGMwuEU+hjux/zL6xSmf5S9ITaA=github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw=github.com/simplereach/timeutils v1.2.0/go.mod h1:VVbQDfN/FHRZa1LSqcwo4kNZ62OOyqLLGQKYB3pB0Q8=-github.com/siyuan-note/dejavu v0.0.0-20231208142721-8ee5cca6b637 h1:wn/tFUTCIpISY1l8IgDoAES7O3geASvnHHJJGY7snU8=-github.com/siyuan-note/dejavu v0.0.0-20231208142721-8ee5cca6b637/go.mod h1:JFtbncCYIJft4Krp7U8wdxfqmV7DzpVpfBwz/KGUjX4=+github.com/siyuan-note/dejavu v0.0.0-20231209022337-1ab041167449 h1:gyS0N7IxhBu73K8ROhvMhXAEGKuqV7yKH41usbA2G3c=+github.com/siyuan-note/dejavu v0.0.0-20231209022337-1ab041167449/go.mod h1:3rwKzSj5NnzhJ181Ln3BIQdOyYBskR/z7j88MjqXgLY=github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75 h1:Bi7/7f29LW+Fm0cHc0J1NO1cZqyJwljSWVmfOqVZgaE=github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75/go.mod h1:H8fyqqAbp9XreANjeSbc72zEdFfKTXYN34tc1TjZwtw=github.com/siyuan-note/eventbus v0.0.0-20230804030110-cf250f838c80 h1:XghjHKJd+SiL0DkGYFVC+UGUDFtnR4v9gkAbPeh9Eq8=github.com/siyuan-note/eventbus v0.0.0-20230804030110-cf250f838c80/go.mod h1:Sqo4FYX5lAXu7gWkbEdJF0e6P57tNNVV4WDKYDctokI=-github.com/siyuan-note/filelock v0.0.0-20231206081043-b75b363ddb1b h1:zl/gZ/6emGWvyIQSrs/au/2K4pnVnu0hgGjH29RfoXM=-github.com/siyuan-note/filelock v0.0.0-20231206081043-b75b363ddb1b/go.mod h1:4teUA+79ESPDbagztng2dJfyv66pGrri5ldGJQG/saI=+github.com/siyuan-note/filelock v0.0.0-20231209021753-ecf23a6be73b h1:IKSZ7xR5ks7bUpxbfwBPb9lgFuLTrgpNXtzMfTKBlV8=+github.com/siyuan-note/filelock v0.0.0-20231209021753-ecf23a6be73b/go.mod h1:++qrlYXSLss5AtNrHm3MNtDAQSI2gT8m3m15zLPjWJg=github.com/siyuan-note/httpclient v0.0.0-20231120083123-750db4d28b38 h1:deUrbUOwmsNYRT0x12GHaJ8exxmDMwXFL/1J4dVnLMM=github.com/siyuan-note/httpclient v0.0.0-20231120083123-750db4d28b38/go.mod h1:QOTSBBSeKU90Kb4aeDVcQ0G+2zJcNuhkwAlsJ2cnmkQ=github.com/siyuan-note/logging v0.0.0-20231208035918-61f884c854f0 h1:+XjUr9UMXsczdO2bGA72p/k9wa2ShPb8ybi7CDBJ7HQ=diff --git a/kernel/model/blockial.go b/kernel/model/blockial.goindex 527cf36d1e..9b78068e3f 100644--- a/kernel/model/blockial.go+++ b/kernel/model/blockial.go@@ -122,15 +122,8 @@ func setNodeAttrs(node *ast.Node, tree *parse.Tree, nameValues map[string]stringreturn}- if 1 == len(nameValues) && "" != nameValues["scroll"] {- // 文档滚动状态不产生同步冲突 https://github.com/siyuan-note/siyuan/issues/6076- if err = indexWriteJSONQueueWithoutChangeTime(tree); nil != err {- return- }- } else {- if err = indexWriteJSONQueue(tree); nil != err {- return- }+ if err = indexWriteJSONQueue(tree); nil != err {+ return}IncSync()diff --git a/kernel/model/file.go b/kernel/model/file.goindex e5355743b1..3708e12348 100644--- a/kernel/model/file.go+++ b/kernel/model/file.go@@ -967,24 +967,11 @@ func writeJSONQueue(tree *parse.Tree) (err error) {return}-func writeJSONQueueWithoutChangeTime(tree *parse.Tree) (err error) {- if err = filesys.WriteTreeWithoutChangeTime(tree); nil != err {- return- }- sql.UpsertTreeQueue(tree)- return-}-func indexWriteJSONQueue(tree *parse.Tree) (err error) {treenode.IndexBlockTree(tree)return writeJSONQueue(tree)}-func indexWriteJSONQueueWithoutChangeTime(tree *parse.Tree) (err error) {- treenode.IndexBlockTree(tree)- return writeJSONQueueWithoutChangeTime(tree)-}-func renameWriteJSONQueue(tree *parse.Tree) (err error) {if err = filesys.WriteTree(tree); nil != err {return