title: Inserting into B+ tree using locks
body: <p>I am trying to figure out how to insert an item into a B+ tree using locks and don't really understand the theory behind it.</p>
  
  <p>So for searching, my view is that I put a lock on the root node, and then decide which child node I should go to and lock it, at this point I can release the parent node and continue this operation until I reach the leaf node.</p>
  
  <p>But inserting is a lot more complicated because I can't allow any other threads to interfere with the insertion. My idea is put a lock on each node along the path to the leaf node but putting that many locks is quite expensive, and then the question I have is what happens when the leaf node splits because it is too large?</p>
  
  <p>Does anyone know how to properly insert an item into a B+ tree using locks?</p>