Repository navigation
Description
Description
Duplicating or copying a folder copies its whole subtree inside one database transaction, and the shipped folder copy reads each folder's file assets, pages and links into memory at once. Both are fine at the sizes most folders are, and neither is fine at the sizes some customers have.
This is existing behaviour, not something #37062 introduced. The Site Browser's copy and every plugin calling FolderAPI.copy go through the same path and have the same limits. It is recorded here as deferred work from #37062 (bulk folder duplicate in Content Drive), which calls bounding this walk "the real work". It is the copy sibling of #37565, which tracks the same for folder delete.
What happens today
FolderAPIImpl.copyis@WrapInTransaction: one transaction covers the folder, every subfolder and everything copied into them. A very large subtree holds one connection and one transaction open for the whole copy.FolderFactoryImpl.saveCopiedFolderlists a folder's file assets (findFileAssetsByFolder), working pages (getWorkingHTMLPages) and links in full, with no paging, before copying them. The cost is per folder, not per tree.- The Content Drive bulk duplicate runs that copy unchanged, then a second pass that copies what it skips (generic content, archived items) inside the same transaction. That pass reads only identifiers, so it adds little, but it inherits the same transaction.
Why #37062 did not change it
Bounding means either changing the copy for every caller, which is a behaviour change and rollback-unsafe, or adding a second copy path that behaves differently depending on how it was called, permanently. Splitting the copy into several transactions also gives up the all-or-nothing guarantee #37062 relies on: today a failed or cancelled folder leaves no partial duplicate. Copy is milder than delete here: it only reads the originals and inserts new rows, so it does not lock or remove anything other authors are using.
Acceptance Criteria
- A folder's file assets, pages and links are read in pages rather than all at once.
- A decision is recorded on the transaction: keep one per top-level folder, or split it. If split, it states what a failed or cancelled copy leaves behind and how the author is told.
- The Site Browser copy, plugins calling
FolderAPI.copyand the Content Drive bulk duplicate keep producing the same result for folders of ordinary size.
Additional Context
- Deferred from: Content Drive: folder copy, async job endpoint and frontend wiring #37062. Delete sibling: Bound the recursive folder walk for delete and copy: page a folder's contents, then decide on the transaction #37565.
- Decision record:
specs/37062-folder-copy-backend/spec.md, D-012 (the copy is left as it is) and D-013 (the all-or-nothing guarantee).
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
zJaaal commentedon Oct 9, 2026
Merged into #37565, which now covers both folder delete and folder copy. Both walk the tree the same way (recursive, one transaction for the whole subtree, each folder's contents read in full), so they should be bounded by one shared, paged folder walk rather than fixed twice.
Everything from this ticket was carried over, including its acceptance criteria and the D-012 / D-013 decision record from
specs/37062-folder-copy-backend/spec.md.One correction carried along: this ticket said the copy's cost is per folder, not per tree. That is not quite right.
FolderFactoryImpl.saveCopiedFolderpasses onecopiedObjectstable through the whole recursion, holding a pair of objects for every file, page and link copied in the tree, so copy memory grows with the whole tree. #37565 now has an acceptance criterion for that.Written by Claude (Claude Code) on behalf of @zJaaal.