Skip to content

Commit e305ed5

Browse files
committed
Fix corruption when entry->buffer changed to nonleaf while unlocked.
1 parent b6e5430 commit e305ed5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/rumget.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,14 @@ entryGetNextItem(RumState * rumstate, RumScanEntry entry, Snapshot snapshot)
889889

890890
LockBuffer(entry->buffer, RUM_SHARE);
891891
page = BufferGetPage(entry->buffer);
892-
892+
if (!RumPageIsLeaf(page))
893+
{
894+
/*
895+
* Root page becomes non-leaf while we unlock it. just return.
896+
*/
897+
LockBuffer(entry->buffer, RUM_UNLOCK);
898+
return;
899+
}
893900
PredicateLockPage(rumstate->index, BufferGetBlockNumber(entry->buffer), snapshot);
894901

895902
if (scanPage(rumstate, entry, &entry->curItem, false))

0 commit comments

Comments
 (0)