Subject Re: [Firebird-Architect] Bi-directional indexes
Author Jim Starkey
Dmitry Yemanov wrote:

>"Ann W. Harrison" <aharrison@...> wrote:
>>So why does compression alter all this? If while page 124 was
>>splitting, page 125 was compressed and released from the index, the
>>backward walker can walk forward all day and will never find its
>>starting point. Or, page 125 could have been released from one part of
>>the index, then reused somewhere else in the same index.
>The backward reader keeps a read lock on page 125, then:
>1) tries a no wait handoff to the left sibling page
>2) if successful, we're done
>3) otherwise, refetch the current page (125) for write
No can do. Upgrading a shared lock to an exclusive lock is the formula
for a deadlock. You have to release it completely before asking for an
exclusive lock. But if you release it, you can't simply refetch it
because it might have been deleted. You have to go back to a "safe"
pointer and refollow the page chain. Unless somebody has a really good
idea on how to maintain a "safe" pointer/page, this means going back to
the index root and trying again.

The probability is that the conditional handoff to the left, but if it
fails, and from time to time it will, re-establishing the context is
extremely expensive if you permit bucket recombinations. I'm not going
to say that a good solution is impossible, just that I haven't heard on
that works yet.