summaryrefslogtreecommitdiff
path: root/src/backend/access/gist/gist.c
diff options
context:
space:
mode:
authorTeodor Sigaev <teodor@sigaev.ru>2015-09-17 14:22:37 +0300
committerTeodor Sigaev <teodor@sigaev.ru>2015-09-17 14:22:37 +0300
commit22f519c92a45eb017bf2e65f36506a75309f8094 (patch)
tree822983b85ae1ea823bd2da1d6a3b0f707a554a0f /src/backend/access/gist/gist.c
parent7aea8e4f2daa4b39ca9d1309a0c4aadb0f7ed81b (diff)
downloadpostgresql-22f519c92a45eb017bf2e65f36506a75309f8094.tar.gz
Fix bug introduced by microvacuum for GiST
Commit 013ebc0a7b7ea9c1b1ab7a3d4dd75ea121ea8ba7 introduces microvacuum for GiST, deletetion of tuple marked LP_DEAD uses IndexPageMultiDelete while recovery code uses IndexPageTupleDelete in loop. This causes a difference in offset numbers of tuples to delete. Patch introduces usage of IndexPageMultiDelete in GiST except gistplacetopage() where only one tuple is deleted at once. That also slightly improve performance, because IndexPageMultiDelete is more effective. Patch changes WAL format, so bump wal page magic. Bug report from Jeff Janes Diagnostic and patch by Anastasia Lubennikova and me
Diffstat (limited to 'src/backend/access/gist/gist.c')
-rw-r--r--src/backend/access/gist/gist.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/backend/access/gist/gist.c b/src/backend/access/gist/gist.c
index 4edc5a75f2..53bccf6d18 100644
--- a/src/backend/access/gist/gist.c
+++ b/src/backend/access/gist/gist.c
@@ -466,6 +466,11 @@ gistplacetopage(Relation rel, Size freespace, GISTSTATE *giststate,
*/
START_CRIT_SECTION();
+ /*
+ * While we delete only one tuple at once we could mix calls
+ * PageIndexTupleDelete() here and PageIndexMultiDelete() in
+ * gistRedoPageUpdateRecord()
+ */
if (OffsetNumberIsValid(oldoffnum))
PageIndexTupleDelete(page, oldoffnum);
gistfillbuffer(page, itup, ntup, InvalidOffsetNumber);