修复vacuum在调用UBTreeVacuumPage时可能出现的不回收问题

This commit is contained in:
WangMingxuan
2024-05-22 14:49:35 +08:00
committed by yaoxin
parent 0f3cabfdb2
commit df82bb12da
2 changed files with 6 additions and 1 deletions

View File

@ -165,7 +165,7 @@ Buffer UBTreeGetRoot(Relation rel, int access)
BufferDesc *buf = GetBufferDescriptor(rootbuf - 1); // caveat for GetBufferDescriptor for -1!
valid = PinBuffer(buf, NULL);
if (valid && TryLockBuffer(rootbuf, BT_READ, false)) {
isRootCacheValid = buf->tag.forkNum == MAIN_FORKNUM &&
isRootCacheValid = (!IS_EXRTO_STANDBY_READ) && (buf->tag.forkNum == MAIN_FORKNUM) &&
RelFileNodeEquals(buf->tag.rnode, rel->rd_node) && (buf->tag.blockNum == rootblkno);
if (!isRootCacheValid) {
UnlockReleaseBuffer(rootbuf);

View File

@ -905,6 +905,11 @@ restart:
if (minoff <= maxoff) {
stats->num_index_tuples += maxoff - minoff + 1;
}
if(vstate->cycleid !=0 && opaque->btpo_cycleid == vstate->cycleid
&& !(opaque->btpo_flags & BTP_SPLIT_END) && !P_RIGHTMOST(opaque) && opaque->btpo_next < origBlkno){
recurseTo = opaque->btpo_next;
}
}
if (deleteNow) {