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

Commit0289709

Browse files
committed
heap ptrack with xlog
1 parent47d37f5 commit0289709

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

‎src/backend/access/heap/heapam.c‎

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
#include"access/xlog.h"
5454
#include"access/xloginsert.h"
5555
#include"access/xlogutils.h"
56+
#include"access/ptrack.h"
5657
#include"catalog/catalog.h"
5758
#include"catalog/namespace.h"
5859
#include"commands/vacuum.h"
@@ -2425,6 +2426,7 @@ heap_insert(Relation relation, HeapTuple tup, CommandId cid,
24252426
HeapTupleCopyEpochFromPage(heaptup,BufferGetPage(buffer));
24262427

24272428
/* NO EREPORT(ERROR) from here till changes are logged */
2429+
ptrack_add_block(relation,BufferGetBlockNumber(buffer));
24282430
START_CRIT_SECTION();
24292431

24302432
RelationPutHeapTuple(relation,buffer,heaptup,
@@ -2799,6 +2801,7 @@ freeze_single_heap_page(Relation relation, Buffer buffer)
27992801
{
28002802
inti;
28012803

2804+
ptrack_add_block(relation,BufferGetBlockNumber(buffer));
28022805
START_CRIT_SECTION();
28032806

28042807
MarkBufferDirty(buffer);
@@ -3147,6 +3150,7 @@ heap_multi_insert(Relation relation, HeapTuple *tuples, int ntuples,
31473150
heap_page_prepare_for_xid(relation,buffer,xid, false);
31483151

31493152
/* NO EREPORT(ERROR) from here till changes are logged */
3153+
ptrack_add_block(relation,BufferGetBlockNumber(buffer));
31503154
START_CRIT_SECTION();
31513155

31523156
/*
@@ -3675,6 +3679,7 @@ heap_delete(Relation relation, ItemPointer tid,
36753679
(new_infomask&HEAP_XMAX_IS_MULTI) ? true : false);
36763680
HeapTupleCopyEpochFromPage(&tp,page);
36773681

3682+
ptrack_add_block(relation,BufferGetBlockNumber(buffer));
36783683
START_CRIT_SECTION();
36793684

36803685
/*
@@ -4423,6 +4428,7 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
44234428
(infomask_lock_old_tuple&HEAP_XMAX_IS_MULTI) ? true : false);
44244429
HeapTupleCopyEpochFromPage(&oldtup,page);
44254430

4431+
ptrack_add_block(relation,BufferGetBlockNumber(buffer));
44264432
START_CRIT_SECTION();
44274433

44284434
/* Clear obsolete visibility flags ... */
@@ -4600,6 +4606,9 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
46004606
HeapTupleCopyEpochFromPage(&oldtup,page);
46014607

46024608
/* NO EREPORT(ERROR) from here till changes are logged */
4609+
ptrack_add_block(relation,BufferGetBlockNumber(buffer));
4610+
if (newbuf!=buffer)
4611+
ptrack_add_block(relation,BufferGetBlockNumber(newbuf));
46034612
START_CRIT_SECTION();
46044613

46054614
/*
@@ -5610,6 +5619,7 @@ heap_lock_tuple(Relation relation, HeapTuple tuple,
56105619
(new_infomask&HEAP_XMAX_IS_MULTI) ? true : false);
56115620
HeapTupleCopyEpochFromPage(tuple,page);
56125621

5622+
ptrack_add_block(relation,BufferGetBlockNumber(*buffer));
56135623
START_CRIT_SECTION();
56145624

56155625
/*
@@ -6355,6 +6365,7 @@ heap_lock_updated_tuple_rec(Relation rel, ItemPointer tid, TransactionId xid,
63556365
(new_infomask&HEAP_XMAX_IS_MULTI) ? true : false);
63566366
HeapTupleCopyEpochFromPage(&mytup,BufferGetPage(buf));
63576367

6368+
ptrack_add_block(rel,BufferGetBlockNumber(buf));
63586369
START_CRIT_SECTION();
63596370

63606371
/* ... and set them */
@@ -6509,6 +6520,7 @@ heap_finish_speculative(Relation relation, HeapTuple tuple)
65096520
"invalid speculative token constant");
65106521

65116522
/* NO EREPORT(ERROR) from here till changes are logged */
6523+
ptrack_add_block(relation,BufferGetBlockNumber(buffer));
65126524
START_CRIT_SECTION();
65136525

65146526
Assert(HeapTupleHeaderIsSpeculative(tuple->t_data));
@@ -6623,6 +6635,7 @@ heap_abort_speculative(Relation relation, HeapTuple tuple)
66236635
* do anything special with infomask bits.
66246636
*/
66256637

6638+
ptrack_add_block(relation,BufferGetBlockNumber(buffer));
66266639
START_CRIT_SECTION();
66276640

66286641
/*
@@ -6756,6 +6769,7 @@ heap_inplace_update(Relation relation, HeapTuple tuple)
67566769
elog(ERROR,"wrong tuple length");
67576770

67586771
/* NO EREPORT(ERROR) from here till changes are logged */
6772+
ptrack_add_block(relation,BufferGetBlockNumber(buffer));
67596773
START_CRIT_SECTION();
67606774

67616775
memcpy((char*)htup+htup->t_hoff,
@@ -8463,6 +8477,7 @@ heap_xlog_clean(XLogReaderState *record)
84638477
XLogRedoActionaction;
84648478

84658479
XLogRecGetBlockTag(record,0,&rnode,NULL,&blkno);
8480+
ptrack_add_block_redo(rnode,blkno);
84668481

84678482
/*
84688483
* We're about to remove tuples. In Hot Standby mode, ensure that there's
@@ -8555,6 +8570,7 @@ heap_xlog_visible(XLogReaderState *record)
85558570
XLogRedoActionaction;
85568571

85578572
XLogRecGetBlockTag(record,1,&rnode,NULL,&blkno);
8573+
ptrack_add_block_redo(rnode,blkno);
85588574

85598575
/*
85608576
* If there are any Hot Standby transactions running that have an xmin
@@ -8665,6 +8681,11 @@ heap_xlog_freeze_page(XLogReaderState *record)
86658681
TransactionIdcutoff_xid=xlrec->cutoff_xid;
86668682
Bufferbuffer;
86678683
intntup;
8684+
RelFileNodernode;
8685+
BlockNumberblkno;
8686+
8687+
XLogRecGetBlockTag(record,0,&rnode,NULL,&blkno);
8688+
ptrack_add_block_redo(rnode,blkno);
86688689

86698690
/*
86708691
* In Hot Standby mode, ensure that there's no queries running which still
@@ -8750,6 +8771,7 @@ heap_xlog_delete(XLogReaderState *record)
87508771
ItemPointerDatatarget_tid;
87518772

87528773
XLogRecGetBlockTag(record,0,&target_node,NULL,&blkno);
8774+
ptrack_add_block_redo(target_node,blkno);
87538775
ItemPointerSetBlockNumber(&target_tid,blkno);
87548776
ItemPointerSetOffsetNumber(&target_tid,xlrec->offnum);
87558777

@@ -8840,6 +8862,7 @@ heap_xlog_insert(XLogReaderState *record)
88408862
xlrec= (xl_heap_insert*)rec_data;
88418863

88428864
XLogRecGetBlockTag(record,0,&target_node,NULL,&blkno);
8865+
ptrack_add_block_redo(target_node,blkno);
88438866
ItemPointerSetBlockNumber(&target_tid,blkno);
88448867
ItemPointerSetOffsetNumber(&target_tid,xlrec->offnum);
88458868

@@ -8974,6 +8997,7 @@ heap_xlog_multi_insert(XLogReaderState *record)
89748997
xlrec= (xl_heap_multi_insert*)rec_data;
89758998

89768999
XLogRecGetBlockTag(record,0,&rnode,NULL,&blkno);
9000+
ptrack_add_block_redo(rnode,blkno);
89779001

89789002
/*
89799003
* The visibility map may need to be fixed even if the heap page is
@@ -9136,8 +9160,10 @@ heap_xlog_update(XLogReaderState *record, bool hot_update)
91369160
oldtup.t_len=0;
91379161

91389162
XLogRecGetBlockTag(record,0,&rnode,NULL,&newblk);
9163+
ptrack_add_block_redo(rnode,newblk);
91399164
if (XLogRecGetBlockTag(record,1,NULL,NULL,&oldblk))
91409165
{
9166+
ptrack_add_block_redo(rnode,oldblk);
91419167
/* HOT updates are never done across pages */
91429168
Assert(!hot_update);
91439169
}
@@ -9388,6 +9414,11 @@ heap_xlog_confirm(XLogReaderState *record)
93889414
OffsetNumberoffnum;
93899415
ItemIdlp=NULL;
93909416
HeapTupleHeaderhtup;
9417+
RelFileNodernode;
9418+
BlockNumberblkno;
9419+
9420+
XLogRecGetBlockTag(record,0,&rnode,NULL,&blkno);
9421+
ptrack_add_block_redo(rnode,blkno);
93919422

93929423
if (XLogReadBufferForRedo(record,0,&buffer)==BLK_NEEDS_REDO)
93939424
{
@@ -9424,6 +9455,11 @@ heap_xlog_lock(XLogReaderState *record)
94249455
OffsetNumberoffnum;
94259456
ItemIdlp=NULL;
94269457
HeapTupleHeaderhtup;
9458+
RelFileNodernode;
9459+
BlockNumberblkno;
9460+
9461+
XLogRecGetBlockTag(record,0,&rnode,NULL,&blkno);
9462+
ptrack_add_block_redo(rnode,blkno);
94279463

94289464
/*
94299465
* The visibility map may need to be fixed even if the heap page is
@@ -9495,6 +9531,11 @@ heap_xlog_lock_updated(XLogReaderState *record)
94959531
OffsetNumberoffnum;
94969532
ItemIdlp=NULL;
94979533
HeapTupleHeaderhtup;
9534+
RelFileNodernode;
9535+
BlockNumberblkno;
9536+
9537+
XLogRecGetBlockTag(record,0,&rnode,NULL,&blkno);
9538+
ptrack_add_block_redo(rnode,blkno);
94989539

94999540
xlrec= (xl_heap_lock_updated*)XLogRecGetData(record);
95009541

@@ -9557,6 +9598,11 @@ heap_xlog_inplace(XLogReaderState *record)
95579598
HeapTupleHeaderhtup;
95589599
uint32oldlen;
95599600
Sizenewlen;
9601+
RelFileNodernode;
9602+
BlockNumberblkno;
9603+
9604+
XLogRecGetBlockTag(record,0,&rnode,NULL,&blkno);
9605+
ptrack_add_block_redo(rnode,blkno);
95609606

95619607
if (XLogReadBufferForRedo(record,0,&buffer)==BLK_NEEDS_REDO)
95629608
{
@@ -9597,6 +9643,7 @@ heap_xlog_epoch_shift(XLogReaderState *record)
95979643
RelFileNodetarget_node;
95989644

95999645
XLogRecGetBlockTag(record,0,&target_node,NULL,&blkno);
9646+
ptrack_add_block_redo(target_node,blkno);
96009647

96019648
if (XLogReadBufferForRedo(record,0,&buffer)==BLK_NEEDS_REDO)
96029649
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp