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

Commit31e7971

Browse files
committed
gist ptrack with xlog
1 parentf45d12d commit31e7971

File tree

4 files changed

+35
-1
lines changed

4 files changed

+35
-1
lines changed

‎src/backend/access/gist/gist.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#include"access/gist_private.h"
1818
#include"access/gistscan.h"
19+
#include"access/ptrack.h"
1920
#include"catalog/pg_collation.h"
2021
#include"miscadmin.h"
2122
#include"utils/index_selfuncs.h"
@@ -122,6 +123,7 @@ gistbuildempty(Relation index)
122123
LockBuffer(buffer,BUFFER_LOCK_EXCLUSIVE);
123124

124125
/* Initialize and xlog buffer */
126+
ptrack_add_block(index,BufferGetBlockNumber(buffer));
125127
START_CRIT_SECTION();
126128
GISTInitBuffer(buffer,F_LEAF);
127129
MarkBufferDirty(buffer);
@@ -448,6 +450,10 @@ gistplacetopage(Relation rel, Size freespace, GISTSTATE *giststate,
448450
if (RelationNeedsWAL(rel)&& !is_build)
449451
XLogEnsureRecordSpace(npage,1+npage*2);
450452

453+
for (ptr=dist;ptr;ptr=ptr->next)
454+
ptrack_add_block(rel,BufferGetBlockNumber(ptr->buffer));
455+
if (BufferIsValid(leftchildbuf))
456+
ptrack_add_block(rel,BufferGetBlockNumber(leftchildbuf));
451457
START_CRIT_SECTION();
452458

453459
/*
@@ -499,6 +505,9 @@ gistplacetopage(Relation rel, Size freespace, GISTSTATE *giststate,
499505
/*
500506
* Enough space. We also get here if ntuples==0.
501507
*/
508+
ptrack_add_block(rel,BufferGetBlockNumber(buffer));
509+
if (BufferIsValid(leftchildbuf))
510+
ptrack_add_block(rel,BufferGetBlockNumber(leftchildbuf));
502511
START_CRIT_SECTION();
503512

504513
/*
@@ -1537,6 +1546,7 @@ gistvacuumpage(Relation rel, Page page, Buffer buffer)
15371546

15381547
if (ndeletable>0)
15391548
{
1549+
ptrack_add_block(rel,BufferGetBlockNumber(buffer));
15401550
START_CRIT_SECTION();
15411551

15421552
PageIndexMultiDelete(page,deletable,ndeletable);

‎src/backend/access/gist/gistbuild.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include"access/gist_private.h"
2121
#include"access/xloginsert.h"
2222
#include"access/generic_xlog.h"
23+
#include"access/ptrack.h"
2324
#include"catalog/index.h"
2425
#include"miscadmin.h"
2526
#include"optimizer/cost.h"
@@ -172,6 +173,7 @@ gistbuild(Relation heap, Relation index, IndexInfo *indexInfo)
172173
Assert(BufferGetBlockNumber(buffer)==GIST_ROOT_BLKNO);
173174
page=BufferGetPage(buffer);
174175

176+
ptrack_add_block(index,BufferGetBlockNumber(buffer));
175177
START_CRIT_SECTION();
176178

177179
GISTInitBuffer(buffer,F_LEAF);

‎src/backend/access/gist/gistvacuum.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#include"access/genam.h"
1818
#include"access/gist_private.h"
19+
#include"access/ptrack.h"
1920
#include"commands/vacuum.h"
2021
#include"miscadmin.h"
2122
#include"storage/indexfsm.h"
@@ -212,6 +213,7 @@ gistbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats,
212213

213214
if (ntodelete)
214215
{
216+
ptrack_add_block(rel,BufferGetBlockNumber(buffer));
215217
START_CRIT_SECTION();
216218

217219
MarkBufferDirty(buffer);

‎src/backend/access/gist/gistxlog.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include"access/gist_private.h"
1717
#include"access/xloginsert.h"
1818
#include"access/xlogutils.h"
19+
#include"access/ptrack.h"
1920
#include"utils/memutils.h"
2021

2122
staticMemoryContextopCtx;/* working memory for operations */
@@ -38,6 +39,11 @@ gistRedoClearFollowRight(XLogReaderState *record, uint8 block_id)
3839
Bufferbuffer;
3940
Pagepage;
4041
XLogRedoActionaction;
42+
RelFileNodernode;
43+
BlockNumberblkno;
44+
45+
XLogRecGetBlockTag(record,block_id,&rnode,NULL,&blkno);
46+
ptrack_add_block_redo(rnode,blkno);
4147

4248
/*
4349
* Note that we still update the page even if it was restored from a full
@@ -68,6 +74,11 @@ gistRedoPageUpdateRecord(XLogReaderState *record)
6874
gistxlogPageUpdate*xldata= (gistxlogPageUpdate*)XLogRecGetData(record);
6975
Bufferbuffer;
7076
Pagepage;
77+
RelFileNodernode;
78+
BlockNumberblkno;
79+
80+
XLogRecGetBlockTag(record,0,&rnode,NULL,&blkno);
81+
ptrack_add_block_redo(rnode,blkno);
7182

7283
if (XLogReadBufferForRedo(record,0,&buffer)==BLK_NEEDS_REDO)
7384
{
@@ -173,6 +184,7 @@ gistRedoPageSplitRecord(XLogReaderState *record)
173184
inti;
174185
boolisrootsplit= false;
175186

187+
176188
/*
177189
* We must hold lock on the first-listed page throughout the action,
178190
* including while updating the left child page (if any). We can unlock
@@ -190,8 +202,11 @@ gistRedoPageSplitRecord(XLogReaderState *record)
190202
intnum;
191203
BlockNumberblkno;
192204
IndexTuple*tuples;
205+
RelFileNodernode;
206+
207+
XLogRecGetBlockTag(record,i+1,&rnode,NULL,&blkno);
208+
ptrack_add_block_redo(rnode,blkno);
193209

194-
XLogRecGetBlockTag(record,i+1,NULL,NULL,&blkno);
195210
if (blkno==GIST_ROOT_BLKNO)
196211
{
197212
Assert(i==0);
@@ -262,6 +277,11 @@ gistRedoCreateIndex(XLogReaderState *record)
262277
XLogRecPtrlsn=record->EndRecPtr;
263278
Bufferbuffer;
264279
Pagepage;
280+
RelFileNodernode;
281+
BlockNumberblkno;
282+
283+
XLogRecGetBlockTag(record,0,&rnode,NULL,&blkno);
284+
ptrack_add_block_redo(rnode,blkno);
265285

266286
buffer=XLogInitBufferForRedo(record,0);
267287
Assert(BufferGetBlockNumber(buffer)==GIST_ROOT_BLKNO);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp