GIN's ItemPointerIsMin, ItemPointerIsMax, and ItemPointerIsLossyPage macros
should use GinItemPointerGetBlockNumber/GinItemPointerGetOffsetNumber, not ItemPointerGetBlockNumber/ItemPointerGetOffsetNumber, because the latter will Assert() on ip_posid == 0, ie a "Min" pointer. (Thus, ItemPointerIsMin has never worked at all, but it seems unused at present.) I'm not certain that the case can occur in normal functioning, but it's blowing up on me while investigating Tatsuo-san's data corruption problem. In any case it seems like a problem waiting to bite someone. Back-patch just in case this really is a problem for somebody in the field.
This commit is contained in:
parent
8b78428fc0
commit
52f0fc703f
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 2006-2009, PostgreSQL Global Development Group
|
* Copyright (c) 2006-2009, PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/include/access/gin.h,v 1.31 2009/03/25 22:19:01 tgl Exp $
|
* $PostgreSQL: pgsql/src/include/access/gin.h,v 1.32 2009/06/05 18:50:47 tgl Exp $
|
||||||
*--------------------------------------------------------------------------
|
*--------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
#ifndef GIN_H
|
#ifndef GIN_H
|
||||||
@ -124,18 +124,18 @@ typedef struct GinMetaPageData
|
|||||||
#define ItemPointerSetMin(p) \
|
#define ItemPointerSetMin(p) \
|
||||||
ItemPointerSet((p), (BlockNumber)0, (OffsetNumber)0)
|
ItemPointerSet((p), (BlockNumber)0, (OffsetNumber)0)
|
||||||
#define ItemPointerIsMin(p) \
|
#define ItemPointerIsMin(p) \
|
||||||
(ItemPointerGetOffsetNumber(p) == (OffsetNumber)0 && \
|
(GinItemPointerGetOffsetNumber(p) == (OffsetNumber)0 && \
|
||||||
ItemPointerGetBlockNumber(p) == (BlockNumber)0)
|
GinItemPointerGetBlockNumber(p) == (BlockNumber)0)
|
||||||
#define ItemPointerSetMax(p) \
|
#define ItemPointerSetMax(p) \
|
||||||
ItemPointerSet((p), InvalidBlockNumber, (OffsetNumber)0xffff)
|
ItemPointerSet((p), InvalidBlockNumber, (OffsetNumber)0xffff)
|
||||||
#define ItemPointerIsMax(p) \
|
#define ItemPointerIsMax(p) \
|
||||||
(ItemPointerGetOffsetNumber(p) == (OffsetNumber)0xffff && \
|
(GinItemPointerGetOffsetNumber(p) == (OffsetNumber)0xffff && \
|
||||||
ItemPointerGetBlockNumber(p) == InvalidBlockNumber)
|
GinItemPointerGetBlockNumber(p) == InvalidBlockNumber)
|
||||||
#define ItemPointerSetLossyPage(p, b) \
|
#define ItemPointerSetLossyPage(p, b) \
|
||||||
ItemPointerSet((p), (b), (OffsetNumber)0xffff)
|
ItemPointerSet((p), (b), (OffsetNumber)0xffff)
|
||||||
#define ItemPointerIsLossyPage(p) \
|
#define ItemPointerIsLossyPage(p) \
|
||||||
(ItemPointerGetOffsetNumber(p) == (OffsetNumber)0xffff && \
|
(GinItemPointerGetOffsetNumber(p) == (OffsetNumber)0xffff && \
|
||||||
ItemPointerGetBlockNumber(p) != InvalidBlockNumber)
|
GinItemPointerGetBlockNumber(p) != InvalidBlockNumber)
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user