Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5dc851a

Browse files
committed
Fix incorrect output from gin_desc().
Previously gin_desc() displayed incorrect output "unknown action 0"for XLOG_GIN_INSERT and XLOG_GIN_VACUUM_DATA_LEAF_PAGE records withvalid actions. The cause of this problem was that gin_desc() wronglyused XLogRecGetData() to extract data from those records.Since they were registered by XLogRegisterBufData(), gin_desc() shouldhave used XLogRecGetBlockData(), instead, like gin_redo().Also there were other differences about how to treat XLOG_GIN_INSERTrecord between gin_desc() and gin_redo().This commit fixes gin_desc() routine so that it treats those recordsin the same way as gin_redo().Batch-patch to 9.5 where WAL record format was revamped andXLogRegisterBufData() was added.Reported-By: Andres FreundReviewed-By: Tom LaneDiscussion: <20160509194645.7lewnpw647zegx2m@alap3.anarazel.de>
1 parent3850723 commit5dc851a

File tree

1 file changed

+24
-21
lines changed

1 file changed

+24
-21
lines changed

‎src/backend/access/rmgrdesc/gindesc.c

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ gin_desc(StringInfo buf, XLogReaderState *record)
8787
caseXLOG_GIN_INSERT:
8888
{
8989
ginxlogInsert*xlrec= (ginxlogInsert*)rec;
90-
char*payload=rec+sizeof(ginxlogInsert);
9190

9291
appendStringInfo(buf,"isdata: %c isleaf: %c",
9392
(xlrec->flags&GIN_INSERT_ISDATA) ?'T' :'F',
9493
(xlrec->flags&GIN_INSERT_ISLEAF) ?'T' :'F');
9594
if (!(xlrec->flags&GIN_INSERT_ISLEAF))
9695
{
96+
char*payload=rec+sizeof(ginxlogInsert);
9797
BlockNumberleftChildBlkno;
9898
BlockNumberrightChildBlkno;
9999

@@ -104,27 +104,27 @@ gin_desc(StringInfo buf, XLogReaderState *record)
104104
appendStringInfo(buf," children: %u/%u",
105105
leftChildBlkno,rightChildBlkno);
106106
}
107-
if (!(xlrec->flags&GIN_INSERT_ISDATA))
108-
appendStringInfo(buf," isdelete: %c",
109-
(((ginxlogInsertEntry*)payload)->isDelete) ?'T' :'F');
110-
elseif (xlrec->flags&GIN_INSERT_ISLEAF)
111-
{
112-
ginxlogRecompressDataLeaf*insertData=
113-
(ginxlogRecompressDataLeaf*)payload;
114-
115-
if (XLogRecHasBlockImage(record,0))
116-
appendStringInfoString(buf," (full page image)");
117-
else
118-
desc_recompress_leaf(buf,insertData);
119-
}
107+
if (XLogRecHasBlockImage(record,0))
108+
appendStringInfoString(buf," (full page image)");
120109
else
121110
{
122-
ginxlogInsertDataInternal*insertData=(ginxlogInsertDataInternal*)payload;
111+
char*payload=XLogRecGetBlockData(record,0,NULL);
123112

124-
appendStringInfo(buf," pitem: %u-%u/%u",
125-
PostingItemGetBlockNumber(&insertData->newitem),
126-
ItemPointerGetBlockNumber(&insertData->newitem.key),
127-
ItemPointerGetOffsetNumber(&insertData->newitem.key));
113+
if (!(xlrec->flags&GIN_INSERT_ISDATA))
114+
appendStringInfo(buf," isdelete: %c",
115+
(((ginxlogInsertEntry*)payload)->isDelete) ?'T' :'F');
116+
elseif (xlrec->flags&GIN_INSERT_ISLEAF)
117+
desc_recompress_leaf(buf, (ginxlogRecompressDataLeaf*)payload);
118+
else
119+
{
120+
ginxlogInsertDataInternal*insertData=
121+
(ginxlogInsertDataInternal*)payload;
122+
123+
appendStringInfo(buf," pitem: %u-%u/%u",
124+
PostingItemGetBlockNumber(&insertData->newitem),
125+
ItemPointerGetBlockNumber(&insertData->newitem.key),
126+
ItemPointerGetOffsetNumber(&insertData->newitem.key));
127+
}
128128
}
129129
}
130130
break;
@@ -144,12 +144,15 @@ gin_desc(StringInfo buf, XLogReaderState *record)
144144
break;
145145
caseXLOG_GIN_VACUUM_DATA_LEAF_PAGE:
146146
{
147-
ginxlogVacuumDataLeafPage*xlrec= (ginxlogVacuumDataLeafPage*)rec;
148-
149147
if (XLogRecHasBlockImage(record,0))
150148
appendStringInfoString(buf," (full page image)");
151149
else
150+
{
151+
ginxlogVacuumDataLeafPage*xlrec=
152+
(ginxlogVacuumDataLeafPage*)XLogRecGetBlockData(record,0,NULL);
153+
152154
desc_recompress_leaf(buf,&xlrec->data);
155+
}
153156
}
154157
break;
155158
caseXLOG_GIN_DELETE_PAGE:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp