Skip to content

๐Ÿ›(backend) stop using add_sibling method to create sandbox document#2084

Merged
lunika merged 2 commits intomainfrom
test/onboarding-docs
Mar 19, 2026
Merged

๐Ÿ›(backend) stop using add_sibling method to create sandbox document#2084
lunika merged 2 commits intomainfrom
test/onboarding-docs

Conversation

@lunika
Copy link
Member

@lunika lunika commented Mar 19, 2026

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

  • ๐Ÿ›(backend) stop using add_sibling method to create sandbox document

@lunika lunika requested review from Ash-Crow and jmaupetit March 19, 2026 07:53
@lunika lunika self-assigned this Mar 19, 2026
@lunika lunika added the bug Something isn't working label Mar 19, 2026
@virgile-dev
Copy link
Collaborator

Wow good job debugging this.

Copy link

@jmaupetit jmaupetit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"clap"

lunika added 2 commits March 19, 2026 10:14
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
@lunika lunika force-pushed the test/onboarding-docs branch from 34cdb47 to b3ae6e1 Compare March 19, 2026 09:15
@lunika lunika merged commit b3ae6e1 into main Mar 19, 2026
26 checks passed
@lunika lunika deleted the test/onboarding-docs branch March 19, 2026 09:23
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants