Bug in concurrency control in temporary GiST indexes
От
Heikki Linnakangas
Тема
Bug in concurrency control in temporary GiST indexes
Дата
Msg-id
4CE1A5FF.8000500@enterprisedb.com
Список
While hacking on the GiST insertion algorithm, I noticed a bug with temporary GiST indexes. The scan algorithm uses LSNs to detect a concurrent page split, but for a temporary index, we just use a constant LSN on the assumption that there can't be anyone else modifying the index concurrently. But that assumption is not true. While a temporary index can't be modified by other backends, it's entirely possible to insert new tuples to the index within the same backend while a scan is in progress. Here's a test case, using btree_gist. If you modify it to use a non-temporary table, it works fine, but with a temporary table the 2nd SELECT misses some rows, when new rows are inserted in the middle of the scan. Operations on temporary tables are not WAL-logged, so we don't have LSNs to use, but we just need a monotonically increasing sequence of numbers for this purpose. Attached patch provides a function to generate such fake LSNs. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com
В списке pgsql-bugs по дате отправления
От: David Fetter
Дата: