Merge branch 'dev_performance' of https://gitee.com/zoujia_cm/he3pg into dev_performance

This commit is contained in:
zoujia 2023-03-23 15:41:03 +08:00
commit a47003db19
4 changed files with 18 additions and 4 deletions

View File

@ -14219,7 +14219,11 @@ retry:
readOff = targetOff;
pgstat_report_wait_start(WAIT_EVENT_WAL_READ);
r = batchRead((uint8_t *) readBuf, ControlFile->checkPointCopy.ThisTimeLineID, targetOff);
bool walStoreToLocal = false;
if (EnableHotStandby && !push_standby)
walStoreToLocal = true;
r = batchRead((uint8_t *) readBuf, ControlFile->checkPointCopy.ThisTimeLineID, targetOff, walStoreToLocal);
pgstat_report_wait_end();
/*

View File

@ -1429,7 +1429,7 @@ He3DBWALRead(XLogReaderState *state,
pgstat_report_wait_start(WAIT_EVENT_WAL_READ);
#endif
nbytes = batchRead((uint8_t *) buf, state->currTLI, startptr);
nbytes = batchRead((uint8_t *) buf, state->currTLI, startptr, false);
#ifndef FRONTEND
pgstat_report_wait_end();

View File

@ -24,6 +24,7 @@
#include "storage/md.h"
#include "storage/smgr.h"
#include "storage/filecache.h"
#include "utils/hfs.h"
#include "utils/hsearch.h"
#include "utils/inval.h"
#include "utils/guc.h"
@ -446,6 +447,9 @@ smgrdounlinkall(SMgrRelation *rels, int nrels, bool isRedo)
for (forknum = 0; forknum <= MAX_FORKNUM; forknum++)
smgrsw[which].smgr_unlink(rnodes[i], forknum, isRedo);
//remove unused pages and related wals in localdisk cache.
RemoveBufferFromLocal(rnodes[i].node.dbNode, rnodes[i].node.relNode, MAX_FORKNUM, 0);
}
pfree(rnodes);
@ -674,6 +678,8 @@ smgrtruncate(SMgrRelation reln, ForkNumber *forknum, int nforks, BlockNumber *nb
smgrsw[reln->smgr_which].smgr_truncate(reln, forknum[i], nblocks[i]);
//remove unused pages and related wals in localdisk cache.
RemoveBufferFromLocal(reln->smgr_rnode.node.dbNode, reln->smgr_rnode.node.relNode, forknum[i], nblocks[i]);
/*
* We might as well update the local smgr_cached_nblocks values. The
* smgr cache inval message that this function sent will cause other
@ -737,6 +743,9 @@ smgrtruncatelsn(SMgrRelation reln, ForkNumber *forknum, int nforks, BlockNumber
}
smgrsw[reln->smgr_which].smgr_truncate(reln, forknum[i], nblocks[i]);
//remove unused pages and related wals in localdisk cache.
RemoveBufferFromLocal(reln->smgr_rnode.node.dbNode, reln->smgr_rnode.node.relNode, forknum[i], nblocks[i]);
/*
* We might as well update the local smgr_cached_nblocks values. The
* smgr cache inval message that this function sent will cause other

View File

@ -61,7 +61,7 @@ extern Bufrd dataRead(int64_t fd,
extern void free_dataRead(uint8_t *buf, size_t count, size_t cap);
extern Bufrd readfs(int64_t fd, int64_t offset, uint32_t size);
extern int batchRead(uint8_t *buf, uint32_t timeline, uint64_t startPtr);
extern int batchRead(uint8_t *buf, uint32_t timeline, uint64_t startPtr, bool needStore);
extern uint8_t kvwrite(XLogItem *xlogItem);
extern uint8_t flushwals(XLogItem *xlogItem, uint32_t timeline);
extern uint8_t kvflush(XLogRecPtr lsn);
@ -77,4 +77,5 @@ extern Bufrd ReadWalsByPage(uint32_t dbid,
extern uint8_t EvictOnePageOutOfMemory(PageKey pageKey, char *value);
extern Bufrd MoveOnePageToMemory(PageKey pageKey);
extern Bufrd GetWalsFromDisk(PageKey pageKey);
extern Bufrd GetWalsFromDisk(PageKey pageKey);
extern void RemoveBufferFromLocal(uint32_t dbid, uint32_t relid, uint32_t forkno, uint32_t blkno);