4 ms·
Actually immutable btree has a single writer in general since there’s no translation log and the meta page pointing to one latest tree root. Even if two write t
by ww520 3y ago
Actually immutable btree has a single writer in general since there’s no translation log and the meta page pointing to one latest tree root. Even if two write transactions updating different parts of the tree, they both need to update the same meta page, causing a contention. This is one downside (or upside depending on your need since single writer simplifies things a lot and great for sequential writes).
- namibj 3y agoYou could quite easily check if anything you care about was touched by the previous lock holder, so that they could indeed write everything but the root in parallel/concurrently. E.g. note batched operations, like "insert list elements into the immutable container", or transactions where you don't even want to see results that soon.
- ww520 3y agoThe two writers will have two different new root nodes which need to be merged, and that could trigger further merging of lower level new nodes recursively. It becomes a merging of two subtrees. The subtrees can be quite different if node-splitting happens during inserts by the writers. It quickly becomes a complicate problem.