RE: [Patch] Optimize dropping of relation buffers using dlist
От | k.jamison@fujitsu.com |
---|---|
Тема | RE: [Patch] Optimize dropping of relation buffers using dlist |
Дата | |
Msg-id | OSBPR01MB23416098E23E8B9A7A499AC8EF350@OSBPR01MB2341.jpnprd01.prod.outlook.com обсуждение исходный текст |
Ответ на | RE: [Patch] Optimize dropping of relation buffers using dlist ("tsunakawa.takay@fujitsu.com" <tsunakawa.takay@fujitsu.com>) |
Ответы |
Re: [Patch] Optimize dropping of relation buffers using dlist
RE: [Patch] Optimize dropping of relation buffers using dlist |
Список | pgsql-hackers |
On Monday, September 28, 2020 5:08 PM, Tsunakawa-san wrote: > From: Jamison, Kirk/ジャミソン カーク <k.jamison@fujitsu.com> > > Is my understanding above correct? > > No. I simply meant DropRelFileNodeBuffers() calls the following function, > and avoids the optimization if it returns InvalidBlockNumber. > > > BlockNumber > smgrcachednblocks(SMgrRelation reln, ForkNumber forknum) { > return reln->smgr_cached_nblocks[forknum]; > } Thank you for clarifying. So in the new function, it goes something like: if (InRecovery) { if (reln->smgr_cached_nblocks[forknum] != InvalidBlockNumber) return reln->smgr_cached_nblocks[forknum]; else return InvalidBlockNumber; } I've revised the patch and added the new function accordingly in the attached file. I also did not remove the duplicate code from smgrnblocks because Amit-san mentioned that when the caching for non-recovery cases is implemented, we can use it for non-recovery cases as well. Although I am not sure if the way it's written in DropRelFileNodeBuffers is okay. BlockNumberIsValid(nTotalBlocks) nTotalBlocks = smgrcachednblocks(smgr_reln, forkNum[j]); nBlocksToInvalidate = nTotalBlocks - firstDelBlock[j]; if (BlockNumberIsValid(nTotalBlocks) && nBlocksToInvalidate < BUF_DROP_FULLSCAN_THRESHOLD) { //enter optimization loop } else { //full scan for each fork } Regards, Kirk Jamison
Вложения
В списке pgsql-hackers по дате отправления: