On Mon, Mar 5, 2018 at 9:37 PM, Claudio Freire <klaussfre...@gmail.com> wrote: > Assuming the rightmost page is the first page the value could be on, > it already does get an exclusive buffer lock.
That made me check, and: + /* + * Acquire exclusive lock on the buffer before doing any checks. This + * ensures that the index state cannot change, as far as the rightmost + * part of the index is concerned. + */ + LockBuffer(buf, BUFFER_LOCK_EXCLUSIVE); BTree code uses BT_READ and BT_WRITE instead, so that should be: LockBuffer(buf, BT_WRITE)