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

Commit5a90bc1

Browse files
committed
The attached patch contains a couple of fixes in the existing probes and
includes a few new ones.- Fixed compilation errors on OS X for probes that use typedefs- Fixed a number of probes to pass ForkNumber per the relation forkspatch- The new probes are those that were taken out from the previoussubmitted patch and required simple fixes. Will submit the other probesthat may require more discussion in a separate patch.Robert Lor
1 parent5434e46 commit5a90bc1

File tree

5 files changed

+79
-37
lines changed

5 files changed

+79
-37
lines changed

‎src/backend/access/transam/xlog.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.323 2008/12/03 08:20:11 heikki Exp $
10+
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.324 2008/12/17 01:39:03 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -48,6 +48,7 @@
4848
#include"utils/builtins.h"
4949
#include"utils/guc.h"
5050
#include"utils/ps_status.h"
51+
#include"pg_trace.h"
5152

5253

5354
/* File path names (all relative to $PGDATA) */
@@ -486,6 +487,8 @@ XLogInsert(RmgrId rmid, uint8 info, XLogRecData *rdata)
486487
if (info&XLR_INFO_MASK)
487488
elog(PANIC,"invalid xlog info mask %02X",info);
488489

490+
TRACE_POSTGRESQL_XLOG_INSERT(rmid,info);
491+
489492
/*
490493
* In bootstrap mode, we don't actually log anything but XLOG resources;
491494
* return a phony record pointer.
@@ -914,6 +917,8 @@ begin:;
914917
XLogwrtRqstFlushRqst;
915918
XLogRecPtrOldSegEnd;
916919

920+
TRACE_POSTGRESQL_XLOG_SWITCH();
921+
917922
LWLockAcquire(WALWriteLock,LW_EXCLUSIVE);
918923

919924
/*
@@ -1313,12 +1318,14 @@ AdvanceXLInsertBuffer(bool new_segment)
13131318
* Have to write buffers while holding insert lock. This is
13141319
* not good, so only write as much as we absolutely must.
13151320
*/
1321+
TRACE_POSTGRESQL_WAL_BUFFER_WRITE_START();
13161322
WriteRqst.Write=OldPageRqstPtr;
13171323
WriteRqst.Flush.xlogid=0;
13181324
WriteRqst.Flush.xrecoff=0;
13191325
XLogWrite(WriteRqst, false, false);
13201326
LWLockRelease(WALWriteLock);
13211327
Insert->LogwrtResult=LogwrtResult;
1328+
TRACE_POSTGRESQL_WAL_BUFFER_WRITE_DONE();
13221329
}
13231330
}
13241331
}
@@ -5904,6 +5911,8 @@ CreateCheckPoint(int flags)
59045911
if (log_checkpoints)
59055912
LogCheckpointStart(flags);
59065913

5914+
TRACE_POSTGRESQL_CHECKPOINT_START(flags);
5915+
59075916
/*
59085917
* Before flushing data, we must wait for any transactions that are
59095918
* currently in their commit critical sections. If an xact inserted its
@@ -6069,6 +6078,11 @@ CreateCheckPoint(int flags)
60696078
if (log_checkpoints)
60706079
LogCheckpointEnd();
60716080

6081+
TRACE_POSTGRESQL_CHECKPOINT_DONE(CheckpointStats.ckpt_bufs_written,
6082+
NBuffers,CheckpointStats.ckpt_segs_added,
6083+
CheckpointStats.ckpt_segs_removed,
6084+
CheckpointStats.ckpt_segs_recycled);
6085+
60726086
LWLockRelease(CheckpointLock);
60736087
}
60746088

‎src/backend/storage/buffer/bufmgr.c

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.242 2008/11/19 10:34:52 heikki Exp $
11+
* $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.243 2008/12/17 01:39:03 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -203,8 +203,7 @@ ReadBuffer_common(SMgrRelation smgr, bool isLocalBuf, ForkNumber forkNum,
203203
if (isExtend)
204204
blockNum=smgrnblocks(smgr,forkNum);
205205

206-
TRACE_POSTGRESQL_BUFFER_READ_START(blockNum,smgr->smgr_rnode.spcNode,
207-
smgr->smgr_rnode.dbNode,smgr->smgr_rnode.relNode,isLocalBuf);
206+
TRACE_POSTGRESQL_BUFFER_READ_START(forkNum,blockNum,smgr->smgr_rnode.spcNode,smgr->smgr_rnode.dbNode,smgr->smgr_rnode.relNode,isLocalBuf);
208207

209208
if (isLocalBuf)
210209
{
@@ -253,7 +252,7 @@ ReadBuffer_common(SMgrRelation smgr, bool isLocalBuf, ForkNumber forkNum,
253252
if (VacuumCostActive)
254253
VacuumCostBalance+=VacuumCostPageHit;
255254

256-
TRACE_POSTGRESQL_BUFFER_READ_DONE(blockNum,
255+
TRACE_POSTGRESQL_BUFFER_READ_DONE(forkNum,blockNum,
257256
smgr->smgr_rnode.spcNode,
258257
smgr->smgr_rnode.dbNode,
259258
smgr->smgr_rnode.relNode,isLocalBuf,found);
@@ -380,9 +379,9 @@ ReadBuffer_common(SMgrRelation smgr, bool isLocalBuf, ForkNumber forkNum,
380379
if (VacuumCostActive)
381380
VacuumCostBalance+=VacuumCostPageMiss;
382381

383-
TRACE_POSTGRESQL_BUFFER_READ_DONE(blockNum,smgr->smgr_rnode.spcNode,
384-
smgr->smgr_rnode.dbNode,smgr->smgr_rnode.relNode,
385-
isLocalBuf,found);
382+
TRACE_POSTGRESQL_BUFFER_READ_DONE(forkNum,blockNum,
383+
smgr->smgr_rnode.spcNode,smgr->smgr_rnode.dbNode,
384+
smgr->smgr_rnode.relNode,isLocalBuf,found);
386385

387386
returnBufferDescriptorGetBuffer(bufHdr);
388387
}
@@ -526,6 +525,11 @@ BufferAlloc(SMgrRelation smgr, ForkNumber forkNum,
526525
* happens to be trying to split the page the first one got from
527526
* StrategyGetBuffer.)
528527
*/
528+
529+
TRACE_POSTGRESQL_BUFFER_WRITE_DIRTY_START(forkNum,
530+
blockNum,smgr->smgr_rnode.spcNode,
531+
smgr->smgr_rnode.dbNode,smgr->smgr_rnode.relNode);
532+
529533
if (LWLockConditionalAcquire(buf->content_lock,LW_SHARED))
530534
{
531535
/*
@@ -548,6 +552,11 @@ BufferAlloc(SMgrRelation smgr, ForkNumber forkNum,
548552
/* OK, do the I/O */
549553
FlushBuffer(buf,NULL);
550554
LWLockRelease(buf->content_lock);
555+
556+
TRACE_POSTGRESQL_BUFFER_WRITE_DIRTY_DONE(
557+
forkNum,blockNum,smgr->smgr_rnode.spcNode,
558+
smgr->smgr_rnode.dbNode,
559+
smgr->smgr_rnode.relNode);
551560
}
552561
else
553562
{
@@ -1682,6 +1691,7 @@ CheckPointBuffers(int flags)
16821691
CheckpointStats.ckpt_write_t=GetCurrentTimestamp();
16831692
BufferSync(flags);
16841693
CheckpointStats.ckpt_sync_t=GetCurrentTimestamp();
1694+
TRACE_POSTGRESQL_BUFFER_CHECKPOINT_SYNC_START();
16851695
smgrsync();
16861696
CheckpointStats.ckpt_sync_end_t=GetCurrentTimestamp();
16871697
TRACE_POSTGRESQL_BUFFER_CHECKPOINT_DONE();

‎src/backend/storage/smgr/md.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/storage/smgr/md.c,v 1.141 2008/11/14 11:09:50 heikki Exp $
11+
* $PostgreSQL: pgsql/src/backend/storage/smgr/md.c,v 1.142 2008/12/17 01:39:04 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -27,6 +27,7 @@
2727
#include"storage/smgr.h"
2828
#include"utils/hsearch.h"
2929
#include"utils/memutils.h"
30+
#include"pg_trace.h"
3031

3132

3233
/* interval for calling AbsorbFsyncRequests in mdsync */
@@ -560,6 +561,8 @@ mdread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
560561
intnbytes;
561562
MdfdVec*v;
562563

564+
TRACE_POSTGRESQL_SMGR_MD_READ_START(forknum,blocknum,reln->smgr_rnode.spcNode,reln->smgr_rnode.dbNode,reln->smgr_rnode.relNode);
565+
563566
v=_mdfd_getseg(reln,forknum,blocknum, false,EXTENSION_FAIL);
564567

565568
seekpos= (off_t)BLCKSZ* (blocknum % ((BlockNumber)RELSEG_SIZE));
@@ -571,7 +574,11 @@ mdread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
571574
errmsg("could not seek to block %u of relation %s: %m",
572575
blocknum,relpath(reln->smgr_rnode,forknum))));
573576

574-
if ((nbytes=FileRead(v->mdfd_vfd,buffer,BLCKSZ))!=BLCKSZ)
577+
nbytes=FileRead(v->mdfd_vfd,buffer,BLCKSZ);
578+
579+
TRACE_POSTGRESQL_SMGR_MD_READ_DONE(forknum,blocknum,reln->smgr_rnode.spcNode,reln->smgr_rnode.dbNode,reln->smgr_rnode.relNode,relpath(reln->smgr_rnode,forknum),nbytes,BLCKSZ);
580+
581+
if (nbytes!=BLCKSZ)
575582
{
576583
if (nbytes<0)
577584
ereport(ERROR,
@@ -618,6 +625,8 @@ mdwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
618625
Assert(blocknum<mdnblocks(reln,forknum));
619626
#endif
620627

628+
TRACE_POSTGRESQL_SMGR_MD_WRITE_START(forknum,blocknum,reln->smgr_rnode.spcNode,reln->smgr_rnode.dbNode,reln->smgr_rnode.relNode);
629+
621630
v=_mdfd_getseg(reln,forknum,blocknum,isTemp,EXTENSION_FAIL);
622631

623632
seekpos= (off_t)BLCKSZ* (blocknum % ((BlockNumber)RELSEG_SIZE));
@@ -629,7 +638,11 @@ mdwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
629638
errmsg("could not seek to block %u of relation %s: %m",
630639
blocknum,relpath(reln->smgr_rnode,forknum))));
631640

632-
if ((nbytes=FileWrite(v->mdfd_vfd,buffer,BLCKSZ))!=BLCKSZ)
641+
nbytes=FileWrite(v->mdfd_vfd,buffer,BLCKSZ);
642+
643+
TRACE_POSTGRESQL_SMGR_MD_WRITE_DONE(forknum,blocknum,reln->smgr_rnode.spcNode,reln->smgr_rnode.dbNode,reln->smgr_rnode.relNode,relpath(reln->smgr_rnode,forknum),nbytes,BLCKSZ);
644+
645+
if (nbytes!=BLCKSZ)
633646
{
634647
if (nbytes<0)
635648
ereport(ERROR,

‎src/backend/utils/Gen_dummy_probes.sed

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Copyright (c) 2008, PostgreSQL Global Development Group
55
#
6-
# $PostgreSQL: pgsql/src/backend/utils/Gen_dummy_probes.sed,v 1.2 2008/08/01 13:16:09 alvherre Exp $
6+
# $PostgreSQL: pgsql/src/backend/utils/Gen_dummy_probes.sed,v 1.3 2008/12/17 01:39:04 momjian Exp $
77
#-------------------------------------------------------------------------
88

99
/^[ ]*probe/!d
@@ -17,5 +17,7 @@ s/([^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\})/(INT1, INT2, INT3)/
1717
s/([^,)]\{1,\},[^,)]\{1,\},[^,)]\{1,\},[^,)]\{1,\})/(INT1, INT2, INT3, INT4)/
1818
s/([^,)]\{1,\},[^,)]\{1,\},[^,)]\{1,\},[^,)]\{1,\},[^,)]\{1,\})/(INT1, INT2, INT3, INT4, INT5)/
1919
s/([^,)]\{1,\},[^,)]\{1,\},[^,)]\{1,\},[^,)]\{1,\},[^,)]\{1,\},[^,)]\{1,\})/(INT1, INT2, INT3, INT4, INT5, INT6)/
20+
s/([^,)]\{1,\},[^,)]\{1,\},[^,)]\{1,\},[^,)]\{1,\},[^,)]\{1,\},[^,)]\{1,\},[^,)]\{1,\})/(INT1, INT2, INT3, INT4, INT5, INT6, INT7)/
21+
s/([^,)]\{1,\},[^,)]\{1,\},[^,)]\{1,\},[^,)]\{1,\},[^,)]\{1,\},[^,)]\{1,\},[^,)]\{1,\},[^,)]\{1,\})/(INT1, INT2, INT3, INT4, INT5, INT6, INT7, INT8)/
2022
P
2123
s/(.*$/_ENABLED() (0)/

‎src/backend/utils/probes.d

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,25 @@
33
*
44
*Copyright (c) 2006-2008, PostgreSQL Global Development Group
55
*
6-
*$PostgreSQL: pgsql/src/backend/utils/probes.d,v 1.3 2008/08/01 13:16:09 alvherre Exp $
6+
*$PostgreSQL: pgsql/src/backend/utils/probes.d,v 1.4 2008/12/17 01:39:04 momjian Exp $
77
* ----------
88
*/
99

1010

1111
/* typedefs used in PostgreSQL */
12-
typedefunsignedintLocalTransactionId;
13-
typedefintLWLockId;
14-
typedefintLWLockMode;
15-
typedefintLOCKMODE;
16-
typedefunsignedintBlockNumber;
17-
typedefunsignedintOid;
18-
12+
#defineLocalTransactionIdunsigned int
13+
#defineLWLockId int
14+
#defineLWLockMode int
15+
#defineLOCKMODE int
16+
#defineBlockNumberunsigned int
17+
#defineOidunsigned int
18+
#defineForkNumber int
1919
#definebool char
2020

2121
providerpostgresql {
2222

2323
/*
24-
* Due to a bug in Mac OS X 10.5, using built-in typedefs (e.g. uintptr_t,
25-
* uint32_t, etc.) cause compilation errors.
24+
* Note: Do not use built-in typedefs (e.g. uintptr_t, uint32_t, etc) * as they cause compilation errors in Mac OS X 10.5.
2625
*/
2726

2827
probetransaction__start(LocalTransactionId);
@@ -36,13 +35,8 @@ provider postgresql {
3635
probelwlock__condacquire(LWLockId,LWLockMode);
3736
probelwlock__condacquire__fail(LWLockId,LWLockMode);
3837

39-
/* The following probe declarations cause compilation errors
40-
* on Mac OS X but not on Solaris. Need further investigation.
41-
* probe lock__wait__start(unsigned int, LOCKMODE);
42-
* probe lock__wait__done(unsigned int, LOCKMODE);
43-
*/
44-
probelock__wait__start(unsignedint,int);
45-
probelock__wait__done(unsignedint,int);
38+
probelock__wait__start(unsignedint,LOCKMODE);
39+
probelock__wait__done(unsignedint,LOCKMODE);
4640

4741
probequery__parse__start(constchar*);
4842
probequery__parse__done(constchar*);
@@ -59,27 +53,26 @@ provider postgresql {
5953
probesort__start(int,bool,int,int,bool);
6054
probesort__done(unsigned long,long);
6155

62-
/* The following probe declarations cause compilation errors
63-
* on Mac OS X but not on Solaris. Need further investigation.
64-
* probe buffer__read__start(BlockNumber, Oid, Oid, Oid, bool);
65-
* probe buffer__read__done(BlockNumber, Oid, Oid, Oid, bool, bool);
66-
*/
67-
probebuffer__read__start(unsignedint,unsignedint,unsignedint,unsignedint,bool);
68-
probebuffer__read__done(unsignedint,unsignedint,unsignedint,unsignedint,bool,bool);
69-
56+
probebuffer__read__start(ForkNumber,BlockNumber,Oid,Oid,Oid,bool);
57+
probebuffer__read__done(ForkNumber,BlockNumber,Oid,Oid,Oid,bool,bool);
7058
probebuffer__flush__start(Oid,Oid,Oid);
7159
probebuffer__flush__done(Oid,Oid,Oid);
7260

7361
probebuffer__hit(bool);
7462
probebuffer__miss(bool);
7563
probebuffer__checkpoint__start(int);
64+
probebuffer__checkpoint__sync__start();
7665
probebuffer__checkpoint__done();
7766
probebuffer__sync__start(int,int);
7867
probebuffer__sync__written(int);
7968
probebuffer__sync__done(int,int,int);
69+
probebuffer__write__dirty__start(ForkNumber,BlockNumber,Oid,Oid,Oid);
70+
probebuffer__write__dirty__done(ForkNumber,BlockNumber,Oid,Oid,Oid);
8071

8172
probedeadlock__found();
8273

74+
probecheckpoint__start(int);
75+
probecheckpoint__done(int,int,int,int,int);
8376
probeclog__checkpoint__start(bool);
8477
probeclog__checkpoint__done(bool);
8578
probesubtrans__checkpoint__start(bool);
@@ -88,4 +81,14 @@ provider postgresql {
8881
probemultixact__checkpoint__done(bool);
8982
probetwophase__checkpoint__start();
9083
probetwophase__checkpoint__done();
84+
85+
probesmgr__md__read__start(ForkNumber,BlockNumber,Oid,Oid,Oid);
86+
probesmgr__md__read__done(ForkNumber,BlockNumber,Oid,Oid,Oid,constchar*,int,int);
87+
probesmgr__md__write__start(ForkNumber,BlockNumber,Oid,Oid,Oid);
88+
probesmgr__md__write__done(ForkNumber,BlockNumber,Oid,Oid,Oid,constchar*,int,int);
89+
90+
probexlog__insert(unsignedchar,unsignedchar);
91+
probexlog__switch();
92+
probewal__buffer__write__start();
93+
probewal__buffer__write__done();
9194
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp