!5953 default填充参数bugfix

Merge pull request !5953 from Mijamind/0728
This commit is contained in:
Mijamind
2024-08-07 07:09:23 +00:00
committed by Gitee
6 changed files with 33 additions and 36 deletions

View File

@ -3231,7 +3231,6 @@ static void SetUstoreDefaultFillfactor(void *rdopts, relopt_value *options,
for (int i = 0; i < numoptions; i++) {
if (ff_options_idx == -1 && pg_strcasecmp("fillfactor", options[i].gen->name) == 0) {
ff_options_idx = i;
break;
}
}
@ -3242,6 +3241,7 @@ static void SetUstoreDefaultFillfactor(void *rdopts, relopt_value *options,
}
if (storage_type_idx == -1 && pg_strcasecmp("storage_type", elems[i].optname) == 0) {
storage_type_idx = i;
continue;
}
}

View File

@ -535,32 +535,27 @@ int UHeapPagePruneGuts(Relation relation, const RelationBuffer *relbuf, Transact
* strategy to rearrange the page where we anyway need to traverse all
* rows.
*/
if (forcePrune && !UPageIsPrunableWithXminHorizon(page, oldestXmin)) {
; /* no need to scan */
} else {
/* Scan the page */
maxoff = UHeapPageGetMaxOffsetNumber(page);
for (offnum = FirstOffsetNumber; offnum <= maxoff; offnum = OffsetNumberNext(offnum)) {
RowPtr *itemid = NULL;
maxoff = UHeapPageGetMaxOffsetNumber(page);
for (offnum = FirstOffsetNumber; offnum <= maxoff; offnum = OffsetNumberNext(offnum)) {
RowPtr *itemid = NULL;
/* Ignore items already processed as part of an earlier chain */
if (prstate.marked[offnum]) {
continue;
}
/*
* Nothing to do if slot is empty, already dead or marked as
* deleted.
*/
itemid = UPageGetRowPtr(page, offnum);
if (!RowPtrIsUsed(itemid) || RowPtrIsDead(itemid) || RowPtrIsDeleted(itemid)) {
continue;
}
/* Process this item */
ndeleted += UHeapPruneItem(relbuf, offnum, oldestXmin, &prstate, &spaceFreed,
(offnum == targetOffnum));
/* Ignore items already processed as part of an earlier chain */
if (prstate.marked[offnum]) {
continue;
}
/*
* Nothing to do if slot is empty, already dead or marked as
* deleted.
*/
itemid = UPageGetRowPtr(page, offnum);
if (!RowPtrIsUsed(itemid) || RowPtrIsDead(itemid) || RowPtrIsDeleted(itemid)) {
continue;
}
/* Process this item */
ndeleted += UHeapPruneItem(relbuf, offnum, oldestXmin, &prstate, &spaceFreed,
(offnum == targetOffnum));
}
/*

View File

@ -3897,7 +3897,7 @@ int UHeapPageReserveTransactionSlot(Relation relation, Buffer buf, TransactionId
* Try to extend the ITL array now.
*/
if (urecPtr != NULL) {
urecPtr = INVALID_UNDO_REC_PTR;
*urecPtr = INVALID_UNDO_REC_PTR;
}
nExtended = UPageExtendTDSlots(relation, buf);

View File

@ -76,7 +76,7 @@ bool VerifyAndDoUndoActions(TransactionId fullXid, UndoRecPtr fromUrecptr, UndoR
/* already processed. */
if (rc != UNDO_TRAVERSAL_COMPLETE) {
ereport(ERROR, (errmodule(MOD_USTORE),
errmsg("[Rollbakc Skip]: xid(%lu), toUrecptr(%lu), fromUrecptr(%lu), rc(%d)",
errmsg("[Rollback Skip]: xid(%lu), toUrecptr(%lu), fromUrecptr(%lu), rc(%d)",
fullXid, toUrecptr, fromUrecptr, rc)));
return false;
}
@ -105,7 +105,7 @@ bool VerifyAndDoUndoActions(TransactionId fullXid, UndoRecPtr fromUrecptr, UndoR
* for this transaction, otherwise we need to fetch the next batch of
* the undo records.
*/
if (!IS_VALID_UNDO_REC_PTR(urecPtr)){
if (!IS_VALID_UNDO_REC_PTR(urecPtr)) {
break;
}
@ -117,7 +117,7 @@ bool VerifyAndDoUndoActions(TransactionId fullXid, UndoRecPtr fromUrecptr, UndoR
URecVector *urecvec = FetchUndoRecordRange(&urecPtr, toUrecptr, undoApplySize, false);
if (urecvec->Size() == 0){
ereport(ERROR, (errmodule(MOD_USTORE),
errmsg("[Rollbakc Skip]: xid(%lu), toUrecptr(%lu), fromUrecptr(%lu)",
errmsg("[Rollback Skip]: xid(%lu), toUrecptr(%lu), fromUrecptr(%lu)",
fullXid, toUrecptr, fromUrecptr)));
break;
}

View File

@ -46,7 +46,6 @@
#include "gssignal/gs_signal.h"
#include "access/ustore/knl_undoworker.h"
#include "access/ustore/knl_undorequest.h"
#include "access/gtm.h"
#define InvalidPid ((ThreadId)(-1))
@ -197,11 +196,8 @@ void UndoWorkerShmemInit(void)
}
}
void UndoLuncherQuitAndClean(int code, Datum arg)
void UndoLauncherQuitAndClean(int code, Datum arg)
{
#ifdef ENABLE_MULTIPLE_NODES
CloseGTM();
#endif
ereport(LOG, (errmsg("undo launcher shutting down")));
t_thrd.undolauncher_cxt.UndoWorkerShmem->undo_launcher_pid = 0;
DisownLatch(&t_thrd.undolauncher_cxt.UndoWorkerShmem->latch);
@ -267,10 +263,10 @@ NON_EXEC_STATIC void UndoLauncherMain()
t_thrd.proc_cxt.PostInit->SetDatabaseAndUser(NULL, InvalidOid, NULL);
t_thrd.proc_cxt.PostInit->InitUndoLauncher();
on_proc_exit(UndoLuncherQuitAndClean, 0);
SetProcessingMode(NormalProcessing);
on_proc_exit(UndoLauncherQuitAndClean, 0);
/* Unblock signals (they were blocked when the postmaster forked us) */
gs_signal_setmask(&t_thrd.libpq_cxt.UnBlockSig, NULL);
(void)gs_signal_unblock_sigusr2();

View File

@ -128,6 +128,12 @@ void UndoRecord::Reset(UndoRecPtr urp)
if (BufferIsValid(buff_)) {
if (!IS_VALID_UNDO_REC_PTR(urp) || (UNDO_PTR_GET_ZONE_ID(urp) != UNDO_PTR_GET_ZONE_ID(urp_)) ||
(UNDO_PTR_GET_BLOCK_NUM(urp) != BufferGetBlockNumber(buff_))) {
BufferDesc *buf_desc = GetBufferDescriptor(buff_ - 1);
if (LWLockHeldByMe(buf_desc->content_lock)) {
ereport(LOG, (errmodule(MOD_UNDO),
errmsg("Release Buffer %d when Reset UndoRecord from %lu to %lu.", buff_, urp_, urp)));
LockBuffer(buff_, BUFFER_LOCK_UNLOCK);
}
ReleaseBuffer(buff_);
buff_ = InvalidBuffer;
}