1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-27 23:21:58 +03:00

The GiST scan algorithm uses LSNs to detect concurrent pages splits, but

temporary indexes are not WAL-logged. We used a constant LSN for temporary
indexes, on the assumption that we don't need to worry about concurrent page
splits in temporary indexes because they're only visible to the current
session. But that assumption is wrong, it's possible to insert rows and
split pages in the same session, while a scan is in progress. For example,
by opening a cursor and fetching some rows, and INSERTing new rows before
fetching some more.

Fix by generating fake increasing LSNs, used in place of real LSNs in
temporary GiST indexes.
This commit is contained in:
Heikki Linnakangas
2010-11-16 11:02:11 +02:00
parent add0ea88e7
commit 2edc5cd493
4 changed files with 28 additions and 8 deletions

View File

@ -268,7 +268,7 @@ gistbulkdelete(PG_FUNCTION_ARGS)
pfree(rdata);
}
else
PageSetLSN(page, XLogRecPtrForTemp);
PageSetLSN(page, GetXLogRecPtrForTemp());
END_CRIT_SECTION();
}