root/trunk/postgresql/8.3.1.patch
| Revision 1, 51.1 kB (checked in by jesus, 9 months ago) |
|---|
-
src/include/Makefile
old new 15 15 16 16 all: pg_config.h pg_config_os.h 17 17 18 pg_trace.h: ../backend/utils/probes.d 19 $(DTRACE) $(DTRACEFLAGS) -h -s ../backend/utils/probes.d -o pg_trace.h.tmp 20 sed -e 's/#if _DTRACE_VERSION/#ifdef ENABLE_DTRACE/;' < pg_trace.h.tmp > pg_trace.h 21 rm -f pg_trace.h.tmp 18 22 19 23 # Subdirectories containing headers for server-side dev 20 24 SUBDIRS = access bootstrap catalog commands executor lib libpq mb \ -
src/backend/executor/nodeNestloop.c
old new 67 67 List *otherqual; 68 68 ExprContext *econtext; 69 69 70 POSTGRESQL_EXEC_NESTLOOP((uintptr_t)node); 71 70 72 /* 71 73 * get information from the node 72 74 */ -
src/backend/executor/nodeSubplan.c
old new 81 81 ExprContext *innerecontext = node->innerecontext; 82 82 TupleTableSlot *slot; 83 83 84 POSTGRESQL_EXEC_SUBPLAN_HASH((uintptr_t)node); 85 84 86 /* Shouldn't have any direct correlation Vars */ 85 87 if (subplan->parParam != NIL || node->args != NIL) 86 88 elog(ERROR, "hashed subplan with direct correlation not supported"); … … 216 218 ListCell *l; 217 219 ArrayBuildState *astate = NULL; 218 220 221 POSTGRESQL_EXEC_SUBPLAN_SCAN((uintptr_t)node); 222 219 223 /* 220 224 * We are probably in a short-lived expression-evaluation context. Switch 221 225 * to the per-query context for manipulating the child plan's chgParam, -
src/backend/executor/nodeUnique.c
old new 45 45 TupleTableSlot *slot; 46 46 PlanState *outerPlan; 47 47 48 POSTGRESQL_EXEC_UNIQUE((uintptr_t)node); 49 48 50 /* 49 51 * get information from the node 50 52 */ -
src/backend/executor/nodeHash.c
old new 70 70 ExprContext *econtext; 71 71 uint32 hashvalue; 72 72 73 POSTGRESQL_EXEC_HASH_MULTI((uintptr_t)node); 74 73 75 /* must provide our own instrumentation support */ 74 76 if (node->ps.instrument) 75 77 InstrStartNode(node->ps.instrument); -
src/backend/executor/nodeSetOp.c
old new 50 50 TupleTableSlot *resultTupleSlot; 51 51 PlanState *outerPlan; 52 52 53 POSTGRESQL_EXEC_SETOP((uintptr_t)node); 54 53 55 /* 54 56 * get information from the node 55 57 */ -
src/backend/executor/nodeGroup.c
old new 48 48 econtext = node->ss.ps.ps_ExprContext; 49 49 numCols = ((Group *) node->ss.ps.plan)->numCols; 50 50 grpColIdx = ((Group *) node->ss.ps.plan)->grpColIdx; 51 POSTGRESQL_EXEC_GROUP((uintptr_t)node, numCols); 51 52 52 53 /* 53 54 * The ScanTupleSlot holds the (copied) first tuple of each group. -
src/backend/executor/nodeMaterial.c
old new 45 45 bool eof_tuplestore; 46 46 TupleTableSlot *slot; 47 47 48 POSTGRESQL_EXEC_MATERIAL((uintptr_t)node); 49 48 50 /* 49 51 * get state info from node 50 52 */ -
src/backend/executor/nodeAgg.c
old new 806 806 if (node->agg_done) 807 807 return NULL; 808 808 809 POSTGRESQL_EXEC_AGG((uintptr_t)node, ((Agg *) node->ss.ps.plan)->aggstrategy); 810 809 811 if (((Agg *) node->ss.ps.plan)->aggstrategy == AGG_HASHED) 810 812 { 811 813 if (!node->table_filled) -
src/backend/executor/nodeHashjoin.c
old new 58 58 uint32 hashvalue; 59 59 int batchno; 60 60 61 POSTGRESQL_EXEC_HASHJOIN((uintptr_t)node); 61 62 /* 62 63 * get information from HashJoin node 63 64 */ -
src/backend/executor/nodeLimit.c
old new 41 41 TupleTableSlot *slot; 42 42 PlanState *outerPlan; 43 43 44 POSTGRESQL_EXEC_LIMIT((uintptr_t)node); 45 44 46 /* 45 47 * get information from the node 46 48 */ -
src/backend/executor/nodeMergejoin.c
old new 568 568 bool doFillOuter; 569 569 bool doFillInner; 570 570 571 POSTGRESQL_EXEC_MERGEJOIN((uintptr_t)node); 572 571 573 /* 572 574 * get information from node 573 575 */ -
src/backend/executor/execScan.c
old new 60 60 qual = node->ps.qual; 61 61 projInfo = node->ps.ps_ProjInfo; 62 62 63 POSTGRESQL_EXEC_SCAN((uintptr_t)node, ((Scan *)node->ps.plan)->scanrelid, (uintptr_t)accessMtd); 64 63 65 /* 64 66 * If we have neither a qual to check nor a projection to do, just skip 65 67 * all the overhead and return the raw scan tuple. -
src/backend/executor/nodeSort.c
old new 51 51 52 52 estate = node->ss.ps.state; 53 53 dir = estate->es_direction; 54 55 POSTGRESQL_EXEC_SORT((uintptr_t)node, dir); 56 54 57 tuplesortstate = (Tuplesortstate *) node->tuplesortstate; 55 58 56 59 /* -
src/backend/utils/probes.d
old new 9 9 10 10 provider postgresql { 11 11 12 probe statement__start(const char *); 13 probe mark__dirty(uint32_t); 14 probe local__mark__dirty(uint32_t); 15 probe slru__readpage__entry(uintptr_t, uint32_t, uint32_t, uint32_t); 16 probe slru__readpage__return(uint32_t); 17 probe slru__readpage__ro(uintptr_t, uint32_t, uint32_t); 18 probe slru__writepage__entry(uintptr_t, uint32_t, uint32_t); 19 probe slru__writepage__return(); 20 probe slru__readpage__physical__entry(uintptr_t, char *, uint32_t, uint32_t); 21 probe slru__readpage__physical__return(uint32_t, uint32_t, uint32_t); 22 probe slru__writepage__physical__entry(uintptr_t, uint32_t, uint32_t); 23 probe slru__writepage__physical__return(uint32_t, uint32_t, uint32_t); 24 probe xlog__insert(uint32_t, uint32_t); 25 probe xlog__switch(); 26 probe xlog__checkpoint(uint32_t, uint32_t); 27 probe clog__checkpoint__entry(); 28 probe clog__checkpoint__return(); 29 probe multixact__checkpoint__entry(); 30 probe multixact__checkpoint__return(); 31 probe subtrans__checkpoint__entry(); 32 probe subtrans__checkpoint__return(); 33 probe twophase__checkpoint__entry(); 34 probe twophase__checkpoint__return(); 35 probe xlog__checkpoint__entry(uint32_t, uint32_t); 36 probe xlog__checkpoint__return(); 37 probe buffers__checkpoint__entry(uint32_t); 38 probe buffers__checkpoint__return(); 39 probe buffer__sync__entry(uint32_t, uint32_t); 40 probe buffer__sync__written(uint32_t); 41 probe buffer__sync__return(uint32_t, uint32_t, uint32_t); 42 probe buffer__flush__entry(uint32_t, uint32_t, uint32_t, uint32_t); 43 probe buffer__flush__return(uint32_t, uint32_t, uint32_t, uint32_t); 44 probe exec__scan(uintptr_t, uint32_t, uintptr_t); 45 probe exec__agg(uintptr_t, uint32_t); 46 probe exec__group(uintptr_t, uint32_t); 47 probe exec__hash__multi(uintptr_t); 48 probe exec__hashjoin(uintptr_t); 49 probe exec__limit(uintptr_t); 50 probe exec__material(uintptr_t); 51 probe exec__mergejoin(uintptr_t); 52 probe exec__nestloop(uintptr_t); 53 probe exec__setop(uintptr_t); 54 probe exec__sort(uintptr_t, uint32_t); 55 probe exec__subplan__hash(uintptr_t); 56 probe exec__subplan__scan(uintptr_t); 57 probe exec__unique(uintptr_t); 58 probe autovacuum__start(uint32_t, char *); 59 probe autovacuum__relation(uint32_t, char *, char *, char *); 12 60 probe transaction__start(int); 13 61 probe transaction__commit(int); 14 62 probe transaction__abort(int); -
src/backend/postmaster/pgstat.c
old new 1891 1891 TimestampTz start_timestamp; 1892 1892 int len; 1893 1893 1894 POSTGRESQL_STATEMENT_START((char *)cmd_str); 1895 1894 1896 if (!pgstat_track_activities || !beentry) 1895 1897 return; 1896 1898 -
src/backend/postmaster/autovacuum.c
old new 1601 1601 InitPostgres(NULL, dbid, NULL, &dbname); 1602 1602 SetProcessingMode(NormalProcessing); 1603 1603 set_ps_display(dbname, false); 1604 POSTGRESQL_AUTOVACUUM_START(dbid, dbname); 1604 1605 ereport(DEBUG1, 1605 1606 (errmsg("autovacuum: processing database \"%s\"", dbname))); 1606 1607 … … 2122 2123 { 2123 2124 /* have at it */ 2124 2125 MemoryContextSwitchTo(TopTransactionContext); 2126 POSTGRESQL_AUTOVACUUM_RELATION(tab->at_relid, datname, nspname, relname); 2125 2127 autovacuum_do_vac_analyze(tab->at_relid, 2126 2128 tab->at_dovacuum, 2127 2129 tab->at_doanalyze, -
src/backend/access/transam/xact.c
old new 1479 1479 Assert(MyProc->backendId == vxid.backendId); 1480 1480 MyProc->lxid = vxid.localTransactionId; 1481 1481 1482 P G_TRACE1(transaction__start,vxid.localTransactionId);1482 POSTGRESQL_TRANSACTION_START(vxid.localTransactionId); 1483 1483 1484 1484 /* 1485 1485 * set transaction_timestamp() (a/k/a now()). We want this to be the same … … 1604 1604 */ 1605 1605 latestXid = RecordTransactionCommit(); 1606 1606 1607 P G_TRACE1(transaction__commit,MyProc->lxid);1607 POSTGRESQL_TRANSACTION_COMMIT(MyProc->lxid); 1608 1608 1609 1609 /* 1610 1610 * Let others know about no transaction in progress by me. Note that this … … 1990 1990 */ 1991 1991 latestXid = RecordTransactionAbort(false); 1992 1992 1993 P G_TRACE1(transaction__abort,MyProc->lxid);1993 POSTGRESQL_TRANSACTION_ABORT(MyProc->lxid); 1994 1994 1995 1995 /* 1996 1996 * Let others know about no transaction in progress by me. Note that this -
src/backend/access/transam/subtrans.c
old new 281 281 * it merely to improve the odds that writing of dirty pages is done by 282 282 * the checkpoint process and not by backends. 283 283 */ 284 POSTGRESQL_SUBTRANS_CHECKPOINT_ENTRY(); 284 285 SimpleLruFlush(SubTransCtl, true); 286 POSTGRESQL_SUBTRANS_CHECKPOINT_RETURN(); 285 287 } 286 288 287 289 -
src/backend/access/transam/xlog.c
old new 475 475 if (info & XLR_INFO_MASK) 476 476 elog(PANIC, "invalid xlog info mask %02X", info); 477 477 478 POSTGRESQL_XLOG_INSERT(rmid, info); 479 478 480 /* 479 481 * In bootstrap mode, we don't actually log anything but XLOG resources; 480 482 * return a phony record pointer. … … 903 905 XLogwrtRqst FlushRqst; 904 906 XLogRecPtr OldSegEnd; 905 907 908 POSTGRESQL_XLOG_SWITCH(); 909 906 910 LWLockAcquire(WALWriteLock, LW_EXCLUSIVE); 907 911 908 912 /* … … 5824 5828 checkPoint.nextXid = ShmemVariableCache->nextXid; 5825 5829 LWLockRelease(XidGenLock); 5826 5830 5831 POSTGRESQL_XLOG_CHECKPOINT_ENTRY(flags, checkPoint.nextXid); 5832 5827 5833 /* Increase XID epoch if we've wrapped around since last checkpoint */ 5828 5834 checkPoint.nextXidEpoch = ControlFile->checkPointCopy.nextXidEpoch; 5829 5835 if (checkPoint.nextXid < ControlFile->checkPointCopy.nextXid) … … 5949 5955 LogCheckpointEnd(); 5950 5956 5951 5957 LWLockRelease(CheckpointLock); 5958 POSTGRESQL_XLOG_CHECKPOINT_RETURN(); 5952 5959 } 5953 5960 5954 5961 /* -
src/backend/access/transam/multixact.c
old new 1526 1526 void 1527 1527 CheckPointMultiXact(void) 1528 1528 { 1529 POSTGRESQL_MULTIXACT_CHECKPOINT_ENTRY(); 1530 1529 1531 /* Flush dirty MultiXact pages to disk */ 1530 1532 SimpleLruFlush(MultiXactOffsetCtl, true); 1531 1533 SimpleLruFlush(MultiXactMemberCtl, true); … … 1540 1542 */ 1541 1543 if (!InRecovery) 1542 1544 TruncateMultiXact(); 1545 1546 POSTGRESQL_MULTIXACT_CHECKPOINT_RETURN(); 1543 1547 } 1544 1548 1545 1549 /* -
src/backend/access/transam/clog.c
old new 323 323 CheckPointCLOG(void) 324 324 { 325 325 /* Flush dirty CLOG pages to disk */ 326 POSTGRESQL_CLOG_CHECKPOINT_ENTRY(); 326 327 SimpleLruFlush(ClogCtl, true); 328 POSTGRESQL_CLOG_CHECKPOINT_RETURN(); 327 329 } 328 330 329 331 -
src/backend/access/transam/slru.c
old new 372 372 { 373 373 SlruShared shared = ctl->shared; 374 374 375 POSTGRESQL_SLRU_READPAGE_ENTRY((uintptr_t)ctl, pageno, write_ok, xid); 376 375 377 /* Outer loop handles restart if we must wait for someone else's I/O */ 376 378 for (;;) 377 379 { … … 399 401 } 400 402 /* Otherwise, it's ready to use */ 401 403 SlruRecentlyUsed(shared, slotno); 402 return slotno;404 goto traceout; 403 405 } 404 406 405 407 /* We found no match; assert we selected a freeable slot */ … … 446 448 SlruReportIOError(ctl, pageno, xid); 447 449 448 450 SlruRecentlyUsed(shared, slotno); 451 452 traceout: 453 POSTGRESQL_SLRU_READPAGE_RETURN(slotno); 449 454 return slotno; 450 455 } 451 456 } … … 470 475 SlruShared shared = ctl->shared; 471 476 int slotno; 472 477 478 POSTGRESQL_SLRU_READPAGE_RO((uintptr_t)ctl, pageno, xid); 479 473 480 /* Try to find the page while holding only shared lock */ 474 481 LWLockAcquire(shared->ControlLock, LW_SHARED); 475 482 … … 511 518 int pageno = shared->page_number[slotno]; 512 519 bool ok; 513 520 521 POSTGRESQL_SLRU_WRITEPAGE_ENTRY((uintptr_t)ctl, pageno, slotno); 522 514 523 /* If a write is in progress, wait for it to finish */ 515 524 while (shared->page_status[slotno] == SLRU_PAGE_WRITE_IN_PROGRESS && 516 525 shared->page_number[slotno] == pageno) … … 525 534 if (!shared->page_dirty[slotno] || 526 535 shared->page_status[slotno] != SLRU_PAGE_VALID || 527 536 shared->page_number[slotno] != pageno) 528 return;537 goto traceout; 529 538 530 539 /* 531 540 * Mark the slot write-busy, and clear the dirtybit. After this point, a … … 569 578 /* Now it's okay to ereport if we failed */ 570 579 if (!ok) 571 580 SlruReportIOError(ctl, pageno, InvalidTransactionId); 581 582 traceout: 583 POSTGRESQL_SLRU_WRITEPAGE_RETURN(); 572 584 } 573 585 574 586 /* … … 590 602 int offset = rpageno * BLCKSZ; 591 603 char path[MAXPGPATH]; 592 604 int fd; 605 bool retval = false; 593 606 594 607 SlruFileName(ctl, path, segno); 595 608 609 POSTGRESQL_SLRU_READPAGE_PHYSICAL_ENTRY((uintptr_t)ctl, path, pageno, slotno); 610 596 611 /* 597 612 * In a crash-and-restart situation, it's possible for us to receive 598 613 * commands to set the commit status of transactions whose bits are in … … 607 622 { 608 623 slru_errcause = SLRU_OPEN_FAILED; 609 624 slru_errno = errno; 610 return false; 625 retval = false; 626 goto traceout; 611 627 } 612 628 613 629 ereport(LOG, 614 630 (errmsg("file \"%s\" doesn't exist, reading as zeroes", 615 631 path))); 616 632 MemSet(shared->page_buffer[slotno], 0, BLCKSZ); 617 return true; 633 retval = true; 634 goto traceout; 618 635 } 619 636 620 637 if (lseek(fd, (off_t) offset, SEEK_SET) < 0) … … 622 639 slru_errcause = SLRU_SEEK_FAILED; 623 640 slru_errno = errno; 624 641 close(fd); 625 return false; 642 retval = false; 643 goto traceout; 626 644 } 627 645 628 646 errno = 0; … … 631 649 slru_errcause = SLRU_READ_FAILED; 632 650 slru_errno = errno; 633 651 close(fd); 634 return false; 652 retval = false; 653 goto traceout; 635 654 } 636 655 637 656 if (close(fd)) 638 657 { 639 658 slru_errcause = SLRU_CLOSE_FAILED; 640 659 slru_errno = errno; 641 return false; 660 retval = false; 661 goto traceout; 642 662 } 643 663 644 return true; 664 retval = true; 665 666 traceout: 667 POSTGRESQL_SLRU_READPAGE_PHYSICAL_RETURN(retval, slru_errcause, slru_errno); 668 return retval; 645 669 } 646 670 647 671 /* … … 667 691 int offset = rpageno * BLCKSZ; 668 692 char path[MAXPGPATH]; 669 693 int fd = -1; 694 bool retval = false; 670 695 696 POSTGRESQL_SLRU_WRITEPAGE_PHYSICAL_ENTRY((uintptr_t)ctl, pageno, slotno); 697 671 698 /* 672 699 * Honor the write-WAL-before-data rule, if appropriate, so that we do not 673 700 * write out data before associated WAL records. This is the same action … … 753 780 { 754 781 slru_errcause = SLRU_OPEN_FAILED; 755 782 slru_errno = errno; 756 return false; 783 retval = false; 784 goto traceout; 757 785 } 758 786 759 787 if (fdata) … … 781 809 slru_errno = errno; 782 810 if (!fdata) 783 811 close(fd); 784 return false; 812 retval = false; 813 goto traceout; 785 814 } 786 815 787 816 errno = 0; … … 794 823 slru_errno = errno; 795 824 if (!fdata) 796 825 close(fd); 797 return false; 826 retval = false; 827 goto traceout; 798 828 } 799 829 800 830 /* … … 808 838 slru_errcause = SLRU_FSYNC_FAILED; 809 839 slru_errno = errno; 810 840 close(fd); 811 return false; 841 retval = false; 842 goto traceout; 812 843 } 813 844 814 845 if (close(fd)) 815 846 { 816 847 slru_errcause = SLRU_CLOSE_FAILED; 817 848 slru_errno = errno; 818 return false; 849 retval = false; 850 goto traceout; 819 851 } 820 852 } 821 853 822 return true; 854 retval = true; 855 traceout: 856 POSTGRESQL_SLRU_WRITEPAGE_PHYSICAL_RETURN(retval, slru_errcause, slru_errno); 857 return retval; 823 858 } 824 859 825 860 /* -
src/backend/access/transam/twophase.c
old new 1376 1376 */ 1377 1377 if (max_prepared_xacts <= 0) 1378 1378 return; /* nothing to do */ 1379 1380 POSTGRESQL_TWOPHASE_CHECKPOINT_ENTRY(); 1381 1379 1382 xids = (TransactionId *) palloc(max_prepared_xacts * sizeof(TransactionId)); 1380 1383 nxids = 0; 1381 1384 … … 1433 1436 } 1434 1437 1435 1438 pfree(xids); 1439 1440 POSTGRESQL_TWOPHASE_CHECKPOINT_RETURN(); 1436 1441 } 1437 1442 1438 1443 /* -
src/backend/storage/lmgr/lock.c
old new 787 787 * Sleep till someone wakes me up. 788 788 */ 789 789 790 P G_TRACE2(lock__startwait,locktag->locktag_field2, lockmode);790 POSTGRESQL_LOCK_STARTWAIT(locktag->locktag_field2, lockmode); 791 791 792 792 WaitOnLock(locallock, owner); 793 793 794 P G_TRACE2(lock__endwait,locktag->locktag_field2, lockmode);794 POSTGRESQL_LOCK_ENDWAIT(locktag->locktag_field2, lockmode); 795 795 796 796 /* 797 797 * NOTE: do not do any material change of state between here and -
src/backend/storage/lmgr/lwlock.c
old new 447 447 block_counts[lockid]++; 448 448 #endif 449 449 450 P G_TRACE2(lwlock__startwait,lockid, mode);450 POSTGRESQL_LWLOCK_STARTWAIT(lockid, mode); 451 451 452 452 for (;;) 453 453 { … … 458 458 extraWaits++; 459 459 } 460 460 461 P G_TRACE2(lwlock__endwait,lockid, mode);461 POSTGRESQL_LWLOCK_ENDWAIT(lockid, mode); 462 462 463 463 LOG_LWDEBUG("LWLockAcquire", lockid, "awakened"); 464 464 … … 469 469 /* We are done updating shared state of the lock itself. */ 470 470 SpinLockRelease(&lock->mutex); 471 471 472 P G_TRACE2(lwlock__acquire,lockid, mode);472 POSTGRESQL_LWLOCK_ACQUIRE(lockid, mode); 473 473 474 474 /* Add lock to list of locks held by this backend */ 475 475 held_lwlocks[num_held_lwlocks++] = lockid; … … 540 540 /* Failed to get lock, so release interrupt holdoff */ 541 541 RESUME_INTERRUPTS(); 542 542 LOG_LWDEBUG("LWLockConditionalAcquire", lockid, "failed"); 543 P G_TRACE2(lwlock__condacquire__fail,lockid, mode);543 POSTGRESQL_LWLOCK_CONDACQUIRE_FAIL(lockid, mode); 544 544 } 545 545 else 546 546 { 547 547 /* Add lock to list of locks held by this backend */ 548 548 held_lwlocks[num_held_lwlocks++] = lockid; 549 P G_TRACE2(lwlock__condacquire,lockid, mode);549 POSTGRESQL_LWLOCK_CONDACQUIRE(lockid, mode); 550 550 } 551 551 552 552 return !mustwait; … … 631 631 /* We are done updating shared state of the lock itself. */ 632 632 SpinLockRelease(&lock->mutex); 633 633 634 P G_TRACE1(lwlock__release,lockid);634 POSTGRESQL_LWLOCK_RELEASE(lockid); 635 635 636 636 /* 637 637 * Awaken any waiters I removed from the queue. -
src/backend/storage/buffer/bufmgr.c
old new 809 809 bufHdr->flags |= (BM_DIRTY | BM_JUST_DIRTIED); 810 810 811 811 UnlockBufHdr(bufHdr); 812 POSTGRESQL_MARK_DIRTY(buffer); 812 813 } 813 814 814 815 /* … … 1050 1051 * Note that we don't read the buffer alloc count here --- that should be 1051 1052 * left untouched till the next BgBufferSync() call. 1052 1053 */ 1054 POSTGRESQL_BUFFER_SYNC_ENTRY(NBuffers, num_to_write); 1053 1055 buf_id = StrategySyncStart(NULL, NULL); 1054 1056 num_to_scan = NBuffers; 1055 1057 num_written = 0; … … 1073 1075 { 1074 1076 if (SyncOneBuffer(buf_id, false) & BUF_WRITTEN) 1075 1077 { 1078 POSTGRESQL_BUFFER_SYNC_WRITTEN(buf_id); 1076 1079 BgWriterStats.m_buf_written_checkpoints++; 1077 1080 num_written++; 1078 1081 … … 1107 1110 * Update checkpoint statistics. As noted above, this doesn't include 1108 1111 * buffers written by other backends or bgwriter scan. 1109 1112 */ 1113 POSTGRESQL_BUFFER_SYNC_RETURN(NBuffers, num_written, num_to_write); 1110 1114 CheckpointStats.ckpt_bufs_written += num_written; 1111 1115 } 1112 1116 … … 1609 1613 void 1610 1614 CheckPointBuffers(int flags) 1611 1615 { 1616 POSTGRESQL_BUFFERS_CHECKPOINT_ENTRY(flags); 1612 1617 CheckpointStats.ckpt_write_t = GetCurrentTimestamp(); 1613 1618 BufferSync(flags); 1614 1619 CheckpointStats.ckpt_sync_t = GetCurrentTimestamp(); 1615 1620 smgrsync(); 1616 1621 CheckpointStats.ckpt_sync_end_t = GetCurrentTimestamp(); 1622 POSTGRESQL_BUFFERS_CHECKPOINT_RETURN(); 1617 1623 } 1618 1624 1619 1625 … … 1705 1711 if (!StartBufferIO(buf, false)) 1706 1712 return; 1707 1713 1714 POSTGRESQL_BUFFER_FLUSH_ENTRY(buf->tag.rnode.dbNode, buf->tag.rnode.spcNode, buf->tag.rnode.relNode, buf->tag.blockNum); 1715 1708 1716 /* Setup error traceback support for ereport() */ 1709 1717 errcontext.callback = buffer_write_error_callback; 1710 1718 errcontext.arg = (void *) buf; … … 1741 1749 1742 1750 BufferFlushCount++; 1743 1751 1752 POSTGRESQL_BUFFER_FLUSH_RETURN(buf->tag.rnode.dbNode, buf->tag.rnode.spcNode, buf->tag.rnode.relNode, buf->tag.blockNum); 1753 1744 1754 /* 1745 1755 * Mark the buffer as clean (unless BM_JUST_DIRTIED has become set) and 1746 1756 * end the io_in_progress state. -
src/backend/storage/buffer/localbuf.c
old new 236 236 237 237 bufHdr = &LocalBufferDescriptors[bufid]; 238 238 bufHdr->flags |= BM_DIRTY; 239 POSTGRESQL_LOCAL_MARK_DIRTY(buffer); 239 240 } 240 241 241 242 /* -
src/include/pg_trace.h
old new 1 /* ---------- 2 * pg_trace.h 3 * 4 * Definitions for the PostgreSQL tracing framework 5 * 6 * Copyright (c) 2006-2008, PostgreSQL Global Development Group 7 * 8 * $PostgreSQL: pgsql/src/include/pg_trace.h,v 1.3 2008/01/02 02:42:06 momjian Exp $ 9 * ---------- 1 /* 2 * Generated by dtrace(1M). 10 3 */ 11 4 12 #ifndef PG_TRACE_H13 #define PG_TRACE_H5 #ifndef _PG_TRACE_H_TMP 6 #define _PG_TRACE_H_TMP 14 7 8 #include <unistd.h> 9 10 #ifdef __cplusplus 11 extern "C" { 12 #endif 13 15 14 #ifdef ENABLE_DTRACE 16 15 17 #include <sys/sdt.h> 16 #define POSTGRESQL_AUTOVACUUM_RELATION(arg0, arg1, arg2, arg3) \ 17 __dtrace_postgresql___autovacuum__relation(arg0, arg1, arg2, arg3) 18 #define POSTGRESQL_AUTOVACUUM_RELATION_ENABLED() \ 19 __dtraceenabled_postgresql___autovacuum__relation() 20 #define POSTGRESQL_AUTOVACUUM_START(arg0, arg1) \ 21 __dtrace_postgresql___autovacuum__start(arg0, arg1) 22 #define POSTGRESQL_AUTOVACUUM_START_ENABLED() \ 23 __dtraceenabled_postgresql___autovacuum__start() 24 #define POSTGRESQL_BUFFER_FLUSH_ENTRY(arg0, arg1, arg2, arg3) \ 25 __dtrace_postgresql___buffer__flush__entry(arg0, arg1, arg2, arg3) 26 #define POSTGRESQL_BUFFER_FLUSH_ENTRY_ENABLED() \ 27 __dtraceenabled_postgresql___buffer__flush__entry() 28 #define POSTGRESQL_BUFFER_FLUSH_RETURN(arg0, arg1, arg2, arg3) \ 29 __dtrace_postgresql___buffer__flush__return(arg0, arg1, arg2, arg3) 30 #define POSTGRESQL_BUFFER_FLUSH_RETURN_ENABLED() \ 31 __dtraceenabled_postgresql___buffer__flush__return() 32 #define POSTGRESQL_BUFFER_SYNC_ENTRY(arg0, arg1) \ 33 __dtrace_postgresql___buffer__sync__entry(arg0, arg1) 34 #define POSTGRESQL_BUFFER_SYNC_ENTRY_ENABLED() \ 35 __dtraceenabled_postgresql___buffer__sync__entry() 36 #define POSTGRESQL_BUFFER_SYNC_RETURN(arg0, arg1, arg2) \ 37 __dtrace_postgresql___buffer__sync__return(arg0, arg1, arg2) 38 #define POSTGRESQL_BUFFER_SYNC_RETURN_ENABLED() \ 39 __dtraceenabled_postgresql___buffer__sync__return() 40 #define POSTGRESQL_BUFFER_SYNC_WRITTEN(arg0) \ 41 __dtrace_postgresql___buffer__sync__written(arg0) 42 #define POSTGRESQL_BUFFER_SYNC_WRITTEN_ENABLED() \ 43 __dtraceenabled_postgresql___buffer__sync__written() 44 #define POSTGRESQL_BUFFERS_CHECKPOINT_ENTRY(arg0) \ 45 __dtrace_postgresql___buffers__checkpoint__entry(arg0) 46 #define POSTGRESQL_BUFFERS_CHECKPOINT_ENTRY_ENABLED() \ 47 __dtraceenabled_postgresql___buffers__checkpoint__entry() 48 #define POSTGRESQL_BUFFERS_CHECKPOINT_RETURN() \ 49 __dtrace_postgresql___buffers__checkpoint__return() 50 #define POSTGRESQL_BUFFERS_CHECKPOINT_RETURN_ENABLED() \ 51 __dtraceenabled_postgresql___buffers__checkpoint__return() 52 #define POSTGRESQL_CLOG_CHECKPOINT_ENTRY() \ 53 __dtrace_postgresql___clog__checkpoint__entry() 54 #define POSTGRESQL_CLOG_CHECKPOINT_ENTRY_ENABLED() \ 55 __dtraceenabled_postgresql___clog__checkpoint__entry() 56 #define POSTGRESQL_CLOG_CHECKPOINT_RETURN() \ 57 __dtrace_postgresql___clog__checkpoint__return() 58 #define POSTGRESQL_CLOG_CHECKPOINT_RETURN_ENABLED() \ 59 __dtraceenabled_postgresql___clog__checkpoint__return() 60 #define POSTGRESQL_EXEC_AGG(arg0, arg1) \ 61 __dtrace_postgresql___exec__agg(arg0, arg1) 62 #define POSTGRESQL_EXEC_AGG_ENABLED() \ 63 __dtraceenabled_postgresql___exec__agg() 64 #define POSTGRESQL_EXEC_GROUP(arg0, arg1) \ 65 __dtrace_postgresql___exec__group(arg0, arg1) 66 #define POSTGRESQL_EXEC_GROUP_ENABLED() \ 67 __dtraceenabled_postgresql___exec__group() 68 #define POSTGRESQL_EXEC_HASH_MULTI(arg0) \ 69 __dtrace_postgresql___exec__hash__multi(arg0) 70 #define POSTGRESQL_EXEC_HASH_MULTI_ENABLED() \ 71 __dtraceenabled_postgresql___exec__hash__multi() 72 #define POSTGRESQL_EXEC_HASHJOIN(arg0) \ 73 __dtrace_postgresql___exec__hashjoin(arg0) 74 #define POSTGRESQL_EXEC_HASHJOIN_ENABLED() \ 75 __dtraceenabled_postgresql___exec__hashjoin() 76 #define POSTGRESQL_EXEC_LIMIT(arg0) \ 77 __dtrace_postgresql___exec__limit(arg0) 78 #define POSTGRESQL_EXEC_LIMIT_ENABLED() \ 79 __dtraceenabled_postgresql___exec__limit() 80 #define POSTGRESQL_EXEC_MATERIAL(arg0) \ 81 __dtrace_postgresql___exec__material(arg0) 82 #define POSTGRESQL_EXEC_MATERIAL_ENABLED() \ 83 __dtraceenabled_postgresql___exec__material() 84 #define POSTGRESQL_EXEC_MERGEJOIN(arg0) \ 85 __dtrace_postgresql___exec__mergejoin(arg0) 86 #define POSTGRESQL_EXEC_MERGEJOIN_ENABLED() \ 87 __dtraceenabled_postgresql___exec__mergejoin() 88 #define POSTGRESQL_EXEC_NESTLOOP(arg0) \ 89 __dtrace_postgresql___exec__nestloop(arg0) 90 #define POSTGRESQL_EXEC_NESTLOOP_ENABLED() \ 91 __dtraceenabled_postgresql___exec__nestloop() 92 #define POSTGRESQL_EXEC_SCAN(arg0, arg1, arg2) \ 93 __dtrace_postgresql___exec__scan(arg0, arg1, arg2) 94 #define POSTGRESQL_EXEC_SCAN_ENABLED() \ 95 __dtraceenabled_postgresql___exec__scan() 96 #define POSTGRESQL_EXEC_SETOP(arg0) \ 97 __dtrace_postgresql___exec__setop(arg0) 98 #define POSTGRESQL_EXEC_SETOP_ENABLED() \ 99 __dtraceenabled_postgresql___exec__setop() 100 #define POSTGRESQL_EXEC_SORT(arg0, arg1) \ 101 __dtrace_postgresql___exec__sort(arg0, arg1) 102 #define POSTGRESQL_EXEC_SORT_ENABLED() \ 103 __dtraceenabled_postgresql___exec__sort() 104 #define POSTGRESQL_EXEC_SUBPLAN_HASH(arg0) \ 105 __dtrace_postgresql___exec__subplan__hash(arg0) 106 #define POSTGRESQL_EXEC_SUBPLAN_HASH_ENABLED() \ 107 __dtraceenabled_postgresql___exec__subplan__hash() 108 #define POSTGRESQL_EXEC_SUBPLAN_SCAN(arg0) \ 109 __dtrace_postgresql___exec__subplan__scan(arg0) 110 #define POSTGRESQL_EXEC_SUBPLAN_SCAN_ENABLED() \ 111 __dtraceenabled_postgresql___exec__subplan__scan() 112 #define POSTGRESQL_EXEC_UNIQUE(arg0) \ 113 __dtrace_postgresql___exec__unique(arg0) 114 #define POSTGRESQL_EXEC_UNIQUE_ENABLED() \ 115 __dtraceenabled_postgresql___exec__unique() 116 #define POSTGRESQL_LOCAL_MARK_DIRTY(arg0) \ 117 __dtrace_postgresql___local__mark__dirty(arg0) 118 #define POSTGRESQL_LOCAL_MARK_DIRTY_ENABLED() \ 119 __dtraceenabled_postgresql___local__mark__dirty() 120 #define POSTGRESQL_LOCK_ENDWAIT(arg0, arg1) \ 121 __dtrace_postgresql___lock__endwait(arg0, arg1) 122 #define POSTGRESQL_LOCK_ENDWAIT_ENABLED() \ 123 __dtraceenabled_postgresql___lock__endwait() 124 #define POSTGRESQL_LOCK_STARTWAIT(arg0, arg1) \ 125 __dtrace_postgresql___lock__startwait(arg0, arg1) 126 #define POSTGRESQL_LOCK_STARTWAIT_ENABLED() \ 127 __dtraceenabled_postgresql___lock__startwait() 128 #define POSTGRESQL_LWLOCK_ACQUIRE(arg0, arg1) \ 129 __dtrace_postgresql___lwlock__acquire(arg0, arg1) 130 #define POSTGRESQL_LWLOCK_ACQUIRE_ENABLED() \ 131 __dtraceenabled_postgresql___lwlock__acquire() 132 #define POSTGRESQL_LWLOCK_CONDACQUIRE(arg0, arg1) \ 133 __dtrace_postgresql___lwlock__condacquire(arg0, arg1) 134 #define POSTGRESQL_LWLOCK_CONDACQUIRE_ENABLED() \ 135 __dtraceenabled_postgresql___lwlock__condacquire() 136 #define POSTGRESQL_LWLOCK_CONDACQUIRE_FAIL(arg0, arg1) \ 137 __dtrace_postgresql___lwlock__condacquire__fail(arg0, arg1) 138 #define POSTGRESQL_LWLOCK_CONDACQUIRE_FAIL_ENABLED() \ 139 __dtraceenabled_postgresql___lwlock__condacquire__fail() 140 #define POSTGRESQL_LWLOCK_ENDWAIT(arg0, arg1) \ 141 __dtrace_postgresql___lwlock__endwait(arg0, arg1) 142 #define POSTGRESQL_LWLOCK_ENDWAIT_ENABLED() \ 143 __dtraceenabled_postgresql___lwlock__endwait() 144 #define POSTGRESQL_LWLOCK_RELEASE(arg0) \ 145 __dtrace_postgresql___lwlock__release(arg0) 146 #define POSTGRESQL_LWLOCK_RELEASE_ENABLED() \ 147 __dtraceenabled_postgresql___lwlock__release() 148 #define POSTGRESQL_LWLOCK_STARTWAIT(arg0, arg1) \ 149 __dtrace_postgresql___lwlock__startwait(arg0, arg1) 150 #define POSTGRESQL_LWLOCK_STARTWAIT_ENABLED() \ 151 __dtraceenabled_postgresql___lwlock__startwait() 152 #define POSTGRESQL_MARK_DIRTY(arg0) \ 153 __dtrace_postgresql___mark__dirty(arg0) 154 #define POSTGRESQL_MARK_DIRTY_ENABLED() \ 155 __dtraceenabled_postgresql___mark__dirty() 156 #define POSTGRESQL_MULTIXACT_CHECKPOINT_ENTRY() \ 157 __dtrace_postgresql___multixact__checkpoint__entry() 158 #define POSTGRESQL_MULTIXACT_CHECKPOINT_ENTRY_ENABLED() \ 159 __dtraceenabled_postgresql___multixact__checkpoint__entry() 160 #define POSTGRESQL_MULTIXACT_CHECKPOINT_RETURN() \ 161 __dtrace_postgresql___multixact__checkpoint__return() 162 #define POSTGRESQL_MULTIXACT_CHECKPOINT_RETURN_ENABLED() \ 163 __dtraceenabled_postgresql___multixact__checkpoint__return() 164 #define POSTGRESQL_SLRU_READPAGE_ENTRY(arg0, arg1, arg2, arg3) \ 165 __dtrace_postgresql___slru__readpage__entry(arg0, arg1, arg2, arg3) 166 #define POSTGRESQL_SLRU_READPAGE_ENTRY_ENABLED() \ 167 __dtraceenabled_postgresql___slru__readpage__entry() 168 #define POSTGRESQL_SLRU_READPAGE_PHYSICAL_ENTRY(arg0, arg1, arg2, arg3) \ 169 __dtrace_postgresql___slru__readpage__physical__entry(arg0, arg1, arg2, arg3) 170 #define POSTGRESQL_SLRU_READPAGE_PHYSICAL_ENTRY_ENABLED() \ 171 __dtraceenabled_postgresql___slru__readpage__physical__entry() 172 #define POSTGRESQL_SLRU_READPAGE_PHYSICAL_RETURN(arg0, arg1, arg2) \ 173 __dtrace_postgresql___slru__readpage__physical__return(arg0, arg1, arg2) 174 #define POSTGRESQL_SLRU_READPAGE_PHYSICAL_RETURN_ENABLED() \ 175 __dtraceenabled_postgresql___slru__readpage__physical__return() 176 #define POSTGRESQL_SLRU_READPAGE_RETURN(arg0) \ 177 __dtrace_postgresql___slru__readpage__return(arg0) 178 #define POSTGRESQL_SLRU_READPAGE_RETURN_ENABLED() \ 179 __dtraceenabled_postgresql___slru__readpage__return() 180 #define POSTGRESQL_SLRU_READPAGE_RO(arg0, arg1, arg2) \ 181 __dtrace_postgresql___slru__readpage__ro(arg0, arg1, arg2) 182 #define POSTGRESQL_SLRU_READPAGE_RO_ENABLED() \ 183 __dtraceenabled_postgresql___slru__readpage__ro() 184 #define POSTGRESQL_SLRU_WRITEPAGE_ENTRY(arg0, arg1, arg2) \ 185 __dtrace_postgresql___slru__writepage__entry(arg0, arg1, arg2) 186 #define POSTGRESQL_SLRU_WRITEPAGE_ENTRY_ENABLED() \ 187 __dtraceenabled_postgresql___slru__writepage__entry() 188 #define POSTGRESQL_SLRU_WRITEPAGE_PHYSICAL_ENTRY(arg0, arg1, arg2) \ 189 __dtrace_postgresql___slru__writepage__physical__entry(arg0, arg1, arg2) 190 #define POSTGRESQL_SLRU_WRITEPAGE_PHYSICAL_ENTRY_ENABLED() \ 191 __dtraceenabled_postgresql___slru__writepage__physical__entry() 192 #define POSTGRESQL_SLRU_WRITEPAGE_PHYSICAL_RETURN(arg0, arg1, arg2) \ 193 __dtrace_postgresql___slru__writepage__physical__return(arg0, arg1, arg2) 194 #define POSTGRESQL_SLRU_WRITEPAGE_PHYSICAL_RETURN_ENABLED() \ 195 __dtraceenabled_postgresql___slru__writepage__physical__return() 196 #define POSTGRESQL_SLRU_WRITEPAGE_RETURN() \ 197 __dtrace_postgresql___slru__writepage__return() 198 #define POSTGRESQL_SLRU_WRITEPAGE_RETURN_ENABLED() \ 199 __dtraceenabled_postgresql___slru__writepage__return() 200 #define POSTGRESQL_STATEMENT_START(arg0) \ 201 __dtrace_postgresql___statement__start(arg0) 202 #define POSTGRESQL_STATEMENT_START_ENABLED() \ 203 __dtraceenabled_postgresql___statement__start() 204 #define POSTGRESQL_SUBTRANS_CHECKPOINT_ENTRY() \ 205 __dtrace_postgresql___subtrans__checkpoint__entry() 206 #define POSTGRESQL_SUBTRANS_CHECKPOINT_ENTRY_ENABLED() \ 207 __dtraceenabled_postgresql___subtrans__checkpoint__entry() 208 #define POSTGRESQL_SUBTRANS_CHECKPOINT_RETURN() \ 209 __dtrace_postgresql___subtrans__checkpoint__return() 210 #define POSTGRESQL_SUBTRANS_CHECKPOINT_RETURN_ENABLED() \ 211 __dtraceenabled_postgresql___subtrans__checkpoint__return() 212 #define POSTGRESQL_TRANSACTION_ABORT(arg0) \ 213 __dtrace_postgresql___transaction__abort(arg0) 214 #define POSTGRESQL_TRANSACTION_ABORT_ENABLED() \ 215 __dtraceenabled_postgresql___transaction__abort() 216 #define POSTGRESQL_TRANSACTION_COMMIT(arg0) \ 217 __dtrace_postgresql___transaction__commit(arg0) 218 #define POSTGRESQL_TRANSACTION_COMMIT_ENABLED() \ 219 __dtraceenabled_postgresql___transaction__commit() 220 #define POSTGRESQL_TRANSACTION_START(arg0) \ 221 __dtrace_postgresql___transaction__start(arg0) 222 #define POSTGRESQL_TRANSACTION_START_ENABLED() \ 223 __dtraceenabled_postgresql___transaction__start() 224 #define POSTGRESQL_TWOPHASE_CHECKPOINT_ENTRY() \ 225 __dtrace_postgresql___twophase__checkpoint__entry() 226 #define POSTGRESQL_TWOPHASE_CHECKPOINT_ENTRY_ENABLED() \ 227 __dtraceenabled_postgresql___twophase__checkpoint__entry() 228 #define POSTGRESQL_TWOPHASE_CHECKPOINT_RETURN() \ 229 __dtrace_postgresql___twophase__checkpoint__return() 230 #define POSTGRESQL_TWOPHASE_CHECKPOINT_RETURN_ENABLED() \ 231 __dtraceenabled_postgresql___twophase__checkpoint__return() 232 #define POSTGRESQL_XLOG_CHECKPOINT(arg0, arg1) \ 233 __dtrace_postgresql___xlog__checkpoint(arg0, arg1) 234 #define POSTGRESQL_XLOG_CHECKPOINT_ENABLED() \ 235 __dtraceenabled_postgresql___xlog__checkpoint() 236 #define POSTGRESQL_XLOG_CHECKPOINT_ENTRY(arg0, arg1) \ 237 __dtrace_postgresql___xlog__checkpoint__entry(arg0, arg1) 238 #define POSTGRESQL_XLOG_CHECKPOINT_ENTRY_ENABLED() \ 239 __dtraceenabled_postgresql___xlog__checkpoint__entry() <
