summaryrefslogtreecommitdiff
path: root/src/backend/access
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/access')
-rw-r--r--src/backend/access/gin/gininsert.c22
-rw-r--r--src/backend/access/heap/visibilitymap.c3
-rw-r--r--src/backend/access/rmgrdesc/gindesc.c24
-rw-r--r--src/backend/access/transam/twophase.c2
-rw-r--r--src/backend/access/transam/xloginsert.c3
5 files changed, 40 insertions, 14 deletions
diff --git a/src/backend/access/gin/gininsert.c b/src/backend/access/gin/gininsert.c
index e9d4b27427e..1d3ab22556d 100644
--- a/src/backend/access/gin/gininsert.c
+++ b/src/backend/access/gin/gininsert.c
@@ -218,7 +218,8 @@ addItemPointersToLeafTuple(GinState *ginstate,
ItemPointerData *newItems,
*oldItems;
int oldNPosting,
- newNPosting;
+ newNPosting,
+ nwritten;
GinPostingList *compressedList;
Assert(!GinIsPostingTree(old));
@@ -235,18 +236,19 @@ addItemPointersToLeafTuple(GinState *ginstate,
/* Compress the posting list, and try to a build tuple with room for it */
res = NULL;
- compressedList = ginCompressPostingList(newItems, newNPosting, GinMaxItemSize,
- NULL);
- pfree(newItems);
- if (compressedList)
+ compressedList = ginCompressPostingList(newItems, newNPosting, GinMaxItemSize, &nwritten);
+ if (nwritten == newNPosting)
{
res = GinFormTuple(ginstate, attnum, key, category,
(char *) compressedList,
SizeOfGinPostingList(compressedList),
newNPosting,
false);
- pfree(compressedList);
}
+
+ pfree(newItems);
+ pfree(compressedList);
+
if (!res)
{
/* posting list would be too big, convert to posting tree */
@@ -293,17 +295,19 @@ buildFreshLeafTuple(GinState *ginstate,
{
IndexTuple res = NULL;
GinPostingList *compressedList;
+ int nwritten;
/* try to build a posting list tuple with all the items */
- compressedList = ginCompressPostingList(items, nitem, GinMaxItemSize, NULL);
- if (compressedList)
+ compressedList = ginCompressPostingList(items, nitem, GinMaxItemSize, &nwritten);
+ if (nwritten == nitem)
{
res = GinFormTuple(ginstate, attnum, key, category,
(char *) compressedList,
SizeOfGinPostingList(compressedList),
nitem, false);
- pfree(compressedList);
}
+ pfree(compressedList);
+
if (!res)
{
/* posting list would be too big, build posting tree */
diff --git a/src/backend/access/heap/visibilitymap.c b/src/backend/access/heap/visibilitymap.c
index 7306c16f05c..0414ce1945c 100644
--- a/src/backend/access/heap/visibilitymap.c
+++ b/src/backend/access/heap/visibilitymap.c
@@ -270,7 +270,8 @@ visibilitymap_set(Relation rel, BlockNumber heapBlk, Buffer heapBuf,
if (BufferIsValid(heapBuf) && BufferGetBlockNumber(heapBuf) != heapBlk)
elog(ERROR, "wrong heap buffer passed to visibilitymap_set");
- Assert(!BufferIsValid(heapBuf) || BufferIsExclusiveLocked(heapBuf));
+ Assert(!BufferIsValid(heapBuf) ||
+ BufferIsLockedByMeInMode(heapBuf, BUFFER_LOCK_EXCLUSIVE));
/* Check that we have the right VM page pinned */
if (!BufferIsValid(vmBuf) || BufferGetBlockNumber(vmBuf) != mapBlock)
diff --git a/src/backend/access/rmgrdesc/gindesc.c b/src/backend/access/rmgrdesc/gindesc.c
index 229675775ff..075c4a0ae93 100644
--- a/src/backend/access/rmgrdesc/gindesc.c
+++ b/src/backend/access/rmgrdesc/gindesc.c
@@ -130,6 +130,9 @@ gin_desc(StringInfo buf, XLogReaderState *record)
appendStringInfo(buf, " isdata: %c isleaf: %c",
(xlrec->flags & GIN_INSERT_ISDATA) ? 'T' : 'F',
(xlrec->flags & GIN_INSERT_ISLEAF) ? 'T' : 'F');
+ if (xlrec->leftChildBlkno != InvalidBlockNumber)
+ appendStringInfo(buf, " children: %u/%u",
+ xlrec->leftChildBlkno, xlrec->rightChildBlkno);
}
break;
case XLOG_GIN_VACUUM_PAGE:
@@ -150,10 +153,27 @@ gin_desc(StringInfo buf, XLogReaderState *record)
/* no further information */
break;
case XLOG_GIN_UPDATE_META_PAGE:
- /* no further information */
+ {
+ ginxlogUpdateMeta *xlrec = (ginxlogUpdateMeta *) rec;
+
+ appendStringInfo(buf, "ntuples: %d", xlrec->ntuples);
+ if (xlrec->prevTail != InvalidBlockNumber)
+ appendStringInfo(buf, " prevTail: %u",
+ xlrec->prevTail);
+ if (xlrec->newRightlink != InvalidBlockNumber)
+ appendStringInfo(buf, " newRightLink: %u",
+ xlrec->newRightlink);
+ }
break;
case XLOG_GIN_INSERT_LISTPAGE:
- /* no further information */
+ {
+ ginxlogInsertListPage *xlrec = (ginxlogInsertListPage *) rec;
+
+ appendStringInfo(buf, "ntuples: %d", xlrec->ntuples);
+ if (xlrec->rightlink != InvalidBlockNumber)
+ appendStringInfo(buf, " rightlink: %u",
+ xlrec->rightlink);
+ }
break;
case XLOG_GIN_DELETE_LISTPAGE:
appendStringInfo(buf, "ndeleted: %d",
diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c
index d8e2fce2c99..33369fbe23a 100644
--- a/src/backend/access/transam/twophase.c
+++ b/src/backend/access/transam/twophase.c
@@ -2817,7 +2817,7 @@ LookupGXactBySubid(Oid subid)
}
/*
- * TwoPhaseGetXidByLockingProc
+ * TwoPhaseGetOldestXidInCommit
* Return the oldest transaction ID from prepared transactions that are
* currently in the commit critical section.
*
diff --git a/src/backend/access/transam/xloginsert.c b/src/backend/access/transam/xloginsert.c
index c7571429e8e..496e0fa4ac6 100644
--- a/src/backend/access/transam/xloginsert.c
+++ b/src/backend/access/transam/xloginsert.c
@@ -258,7 +258,8 @@ XLogRegisterBuffer(uint8 block_id, Buffer buffer, uint8 flags)
*/
#ifdef USE_ASSERT_CHECKING
if (!(flags & REGBUF_NO_CHANGE))
- Assert(BufferIsExclusiveLocked(buffer) && BufferIsDirty(buffer));
+ Assert(BufferIsLockedByMeInMode(buffer, BUFFER_LOCK_EXCLUSIVE) &&
+ BufferIsDirty(buffer));
#endif
if (block_id >= max_registered_block_id)