Export reads one row at a time without a snapshot, and import crashes on a locale for a non-localized type

未关闭
#3,305 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
csharp, sql

调研方向

Start with the named transfer paths under src/FluentCMS.Core/: Content/EntryTransfer.cs, Transfer/TransferExporter.cs, Transfer/TransferImporter.cs, and the referenced store, service, import, and authorization files. Trace export queries and transaction handling, then follow how import handles locales and author fields; check the tests for each acceptance item. Done means all four behaviors meet the acceptance criteria and each has a test.

由索引模型根据 Issue 内容生成。

描述

area:content performance type:bug

Problem

  1. Export reads entries one row at a time. Only cms_document is read in chunks of 100 (Content/EntryTransfer.cs:67-69). Each locale row then calls store.ReadAsync per state (:82-83), 2–3 queries each (Content/EntryStore.cs:143-153): up to 6 queries per locale row.
  2. Export is not a snapshot. Transfer/TransferExporter.cs:125-140 opens no transaction; ids, document rows and field rows are separate statements. A save during the export can pair an old version with new fields, or leave a reference to an entry missing from the package.
  3. A non-localized item that carries a locale crashes. The locale is kept as sent (Transfer/TransferImporter.cs:424-427) but the row is written under "" (Content/ContentService.cs:1256), so written.Find(...)! throws a NullReferenceException (Content/ContentService.Import.cs:113-116). The item is reported as an unexpected failure. Only hand-made packages do this.
  4. The package decides who owns imported entries. Keeping the author fields is specified (spec 4.14), but the own-entries rule keys on CreatedBy (Authorization/AuthorizationBuilder.cs:16), and there is no way to import as oneself.

Paths are under src/FluentCMS.Core/.

Proposal

  • Read shared rows, locale rows and references per chunk with IN (ids).
  • Run the export in one snapshot or repeatable-read transaction.
  • Refuse the line as an invalid item, with a message.
  • Add authors=keep|importer to import, default keep.

Acceptance

  • Exporting N entries issues a number of queries proportional to N / chunk size
  • A save during an export does not change what the package contains
  • A non-localized item with a locale is reported as invalid, not as an unexpected failure
  • authors=importer records the importer as creator and updater
  • Tests for each

Found in the code review of 17 Nov 2026.

主要语言
C#
星标
567
派生
107
平均合并
1 小时 19 分钟
30 天内合并 PR
353

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

fluentcms/FluentCMS 的其他 Issue

查看 fluentcms/FluentCMS 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。