๐(backend) stop using add_sibling method to create sandbox document#2084
Merged
๐(backend) stop using add_sibling method to create sandbox document#2084
Conversation
Collaborator
|
Wow good job debugging this. |
In a past release we added a feature to create a sandbox document to a newly created used. To create this sandbox document, we duplicate an existing document and this duplicate is using the add_sibling method with the "right" agument on this original document. Adding a sibling at the right to a document involve moving right every root document created after the original document, so the path of all this documents are recalculated and changed. This can lead to the lost of some leaf in a tree because to do this operation, multiple locks are created on the database, creating lot of connection to the database and if the max number connection to the database is reached or if the memory allocated by the database is too hight, the database can close all connections leading to inconsistent paths in the Document table.
When a document is duplicated, it is duplicated at the direct right of the duplicated document. Doing this force to move all the other documents at the right, if it is duplicated at the root this can impact a lot of documents, create lot of locks in the database. If the process is stop for any reason then the paths can be in an inconsistent paths in the Document table
34cdb47 to
b3ae6e1
Compare
lunika
added a commit
that referenced
this pull request
Mar 19, 2026
Changed - โฟ๏ธ(frontend) ensure doc title is h1 for accessibility #2006 - โฟ๏ธ(frontend) add nb accesses in share button aria-label #2017 Fixed - ๐(frontend) fix image resizing when caption #2045 - ๐(docker) add \*\*/.next to .dockerignore #2034 - โฟ๏ธ(frontend) fix share modal heading hierarchy #2007 - โฟ๏ธ(frontend) fix Copy link toast accessibility for screen readers #2029 - โฟ๏ธ(frontend) fix modal aria-label and name #2014 - โฟ๏ธ(frontend) fix language dropdown ARIA for screen readers #2020 - โฟ๏ธ(frontend) fix waffle aria-label spacing for new-window links #2030 - ๐(backend) stop using add_sibling method to create sandbox document #2084 - ๐(backend) duplicate a document as last-sibling #2084
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Purpose
In a past release we added a feature to create a sandbox document to a newly created user. To create this sandbox document, we duplicate an existing document and this duplicate is using the add_sibling method with the "right" agument on this original document. Adding a sibling at the right to a document involve moving right every root document created after the original document, so the path of all this documents are recalculated and changed. This can lead to the lost of some leaf in a tree because to do this operation, multiple locks are created on the database, creating lot of connection to the database and if the max number connection to the database is reached or if the memory allocated by the database is too hight, the database can close all connections leading to inconsistent paths in the Document table.
Proposal