I think this new code needs to go before the UnlockReleaseBuffer() calls above. Calling BufferGetBlockNumber() on an already-released buffer is not cool.
- Heikki
I know that. This is the old version of the patch. I had sent updated patch later. Please have a look at updated patch.
I took a look on this patch.
In gistdoinsert() you do CheckForSerializableConflictIn() only if page wasn't exclusively locked before (xlocked is false).
However, page might be exclusively locked before. And in this case CheckForSerializableConflictIn() would be skipped. That happens very rarely (someone fixes incomplete split before we did), but nevertheless.
I agree with Andrey Borodin's view on locks. I am quoting his message
"if xlocked = true, page was already checked for conflict after setting exclusive lock on it's buffer. I still do not see any problem here..."