mirror of
https://github.com/postgres/postgres.git
synced 2025-08-24 09:27:52 +03:00
Fix a serious bug introduced into GIN in 8.4: now that MergeItemPointers()
is supposed to remove duplicate heap TIDs, we have to be sure to reduce the tuple size and posting-item count accordingly in addItemPointersToTuple(). Failing to do so resulted in the effective injection of garbage TIDs into the index contents, ie, whatever happened to be in the memory palloc'd for the new tuple. I'm not sure that this fully explains the index corruption reported by Tatsuo Ishii, but the test case I'm using no longer fails.
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
*
|
||||
* Copyright (c) 2006-2009, PostgreSQL Global Development Group
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/access/gin.h,v 1.32 2009/06/05 18:50:47 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/include/access/gin.h,v 1.33 2009/06/06 02:39:40 tgl Exp $
|
||||
*--------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef GIN_H
|
||||
@@ -435,6 +435,7 @@ extern void findParents(GinBtree btree, GinBtreeStack *stack, BlockNumber rootBl
|
||||
/* ginentrypage.c */
|
||||
extern IndexTuple GinFormTuple(GinState *ginstate, OffsetNumber attnum, Datum key,
|
||||
ItemPointerData *ipd, uint32 nipd);
|
||||
extern void GinShortenTuple(IndexTuple itup, uint32 nipd);
|
||||
extern void prepareEntryScan(GinBtree btree, Relation index, OffsetNumber attnum,
|
||||
Datum value, GinState *ginstate);
|
||||
extern void entryFillRoot(GinBtree btree, Buffer root, Buffer lbuf, Buffer rbuf);
|
||||
@@ -442,7 +443,7 @@ extern IndexTuple ginPageGetLinkItup(Buffer buf);
|
||||
|
||||
/* gindatapage.c */
|
||||
extern int compareItemPointers(ItemPointer a, ItemPointer b);
|
||||
extern void MergeItemPointers(ItemPointerData *dst,
|
||||
extern uint32 MergeItemPointers(ItemPointerData *dst,
|
||||
ItemPointerData *a, uint32 na,
|
||||
ItemPointerData *b, uint32 nb);
|
||||
|
||||
|
Reference in New Issue
Block a user