1.修复undofile找不到的问题
2.UndoScanDescData 3.修复memcheck模式memory leak
This commit is contained in:
@ -9301,6 +9301,13 @@ int PostgresMain(int argc, char* argv[], const char* dbname, const char* usernam
|
||||
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("wrong role name.")));
|
||||
}
|
||||
if (unlikely(IsAbortedTransactionBlockState())) {
|
||||
if (InReceivingLocalUserIdChange()) {
|
||||
SetUserIdAndSecContext(GetOldUserId(true),
|
||||
u_sess->misc_cxt.SecurityRestrictionContext & (~RECEIVER_LOCAL_USERID_CHANGE));
|
||||
}
|
||||
break;
|
||||
}
|
||||
Oid role_oid = GetRoleOid(role_name);
|
||||
Oid save_userid = InvalidOid;
|
||||
int save_sec_context = 0;
|
||||
|
||||
@ -290,7 +290,6 @@ TupleTableSlot *IndexOnlyScanFusion::getTupleSlotInternal()
|
||||
/*
|
||||
* Fill the scan tuple slot with data from the index.
|
||||
*/
|
||||
IndexTuple tmptup = NULL;
|
||||
index_deform_tuple(indexdesc->xs_itup, RelationGetDescr(rel), m_values, m_isnull);
|
||||
if (indexdesc->xs_recheck && EpqCheck(m_values, m_isnull)) {
|
||||
continue;
|
||||
@ -303,9 +302,12 @@ TupleTableSlot *IndexOnlyScanFusion::getTupleSlotInternal()
|
||||
m_tmpisnull[i] = m_isnull[m_attrno[i] - 1];
|
||||
}
|
||||
|
||||
tmptup = index_form_tuple(m_tupDesc, m_tmpvals, m_tmpisnull);
|
||||
Assert(tmptup != NULL);
|
||||
StoreIndexTuple(m_reslot, tmptup, m_tupDesc);
|
||||
(void)ExecClearTuple(m_reslot);
|
||||
for (int i = 0; i < m_tupDesc->natts; i++) {
|
||||
m_reslot->tts_values[i] = m_tmpvals[i];
|
||||
m_reslot->tts_isnull[i] = m_tmpisnull[i];
|
||||
}
|
||||
(void)ExecStoreVirtualTuple(m_reslot);
|
||||
|
||||
tableam_tslot_getsomeattrs(m_reslot, m_tupDesc->natts);
|
||||
ExecDropSingleTupleTableSlot(tmpreslot);
|
||||
|
||||
@ -621,7 +621,7 @@ UHeapTuple UHeapamIndexFetchTuple(IndexScanDesc scan, bool *all_dead, bool* has_
|
||||
uheapTuple = UHeapSearchBuffer(tid, rel, scan->xs_cbuf, scan->xs_snapshot, all_dead);
|
||||
} else {
|
||||
if (!scan->xs_continue_hot) {
|
||||
scan->xc_undo_scan = (UstoreUndoScanDesc)palloc0(sizeof(UstoreUndoScanDesc));
|
||||
scan->xc_undo_scan = (UstoreUndoScanDesc)palloc0(sizeof(UstoreUndoScanDescData));
|
||||
undoChainEnd = UHeapSearchBufferShowAnyTuplesFirstCall(tid, rel, scan->xs_cbuf, scan->xc_undo_scan);
|
||||
} else {
|
||||
undoChainEnd = UHeapSearchBufferShowAnyTuplesFromUndo(tid, rel, scan->xs_cbuf, scan->xc_undo_scan);
|
||||
@ -701,7 +701,7 @@ TupleTableSlot *slot, bool *callAgain, bool *allDead, bool* has_cur_xact_write)
|
||||
has_cur_xact_write);
|
||||
} else {
|
||||
if (!scan->xs_continue_hot) {
|
||||
scan->xc_undo_scan = (UstoreUndoScanDesc)palloc0(sizeof(UstoreUndoScanDesc));
|
||||
scan->xc_undo_scan = (UstoreUndoScanDesc)palloc0(sizeof(UstoreUndoScanDescData));
|
||||
undoChainEnd = UHeapSearchBufferShowAnyTuplesFirstCall(tid, rel, scan->xs_cbuf, scan->xc_undo_scan);
|
||||
} else {
|
||||
undoChainEnd = UHeapSearchBufferShowAnyTuplesFromUndo(tid, rel, scan->xs_cbuf, scan->xc_undo_scan);
|
||||
|
||||
@ -905,9 +905,10 @@ 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){
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -429,8 +429,8 @@ get_next_tuple:
|
||||
} else {
|
||||
if (!scan->xs_continue_undo) {
|
||||
ItemPointerSet(&scan->curTid, BufferGetBlockNumber(scan->rs_base.rs_cbuf), lineoff);
|
||||
errno_t rc = memset_s(scan->xc_undo_scan, sizeof(UstoreUndoScanDesc),
|
||||
0, sizeof(UstoreUndoScanDesc));
|
||||
errno_t rc = memset_s(scan->xc_undo_scan, sizeof(UstoreUndoScanDescData),
|
||||
0, sizeof(UstoreUndoScanDescData));
|
||||
securec_check(rc, "\0", "\0");
|
||||
undoChainEnd = UHeapSearchBufferShowAnyTuplesFirstCall(&scan->curTid, scan->rs_base.rs_rd,
|
||||
scan->rs_base.rs_cbuf, scan->xc_undo_scan);
|
||||
|
||||
@ -492,18 +492,17 @@ static UndoRecordState LoadUndoRecord(UndoRecord *urec, TransactionId *lastXid)
|
||||
MemoryContext oldContext = MemoryContextSwitchTo(currentContext);
|
||||
t_thrd.int_cxt.CritSectionCount = saveCritSectionCount;
|
||||
state = undo::CheckUndoRecordValid(urec->Urp(), true, lastXid);
|
||||
if (BufferIsValid(urec->Buff())) {
|
||||
if (LWLockHeldByMeInMode(BufferDescriptorGetContentLock(
|
||||
GetBufferDescriptor(urec->Buff() - 1)), LW_SHARED)) {
|
||||
LockBuffer(urec->Buff(), BUFFER_LOCK_UNLOCK);
|
||||
}
|
||||
ReleaseBuffer(urec->Buff());
|
||||
urec->SetBuff(InvalidBuffer);
|
||||
}
|
||||
if (state == UNDO_RECORD_DISCARD || state == UNDO_RECORD_FORCE_DISCARD) {
|
||||
t_thrd.undo_cxt.fetchRecord = false;
|
||||
t_thrd.int_cxt.InterruptHoldoffCount = saveInterruptHoldoffCount;
|
||||
EmitErrorReport();
|
||||
if (BufferIsValid(urec->Buff())) {
|
||||
if (LWLockHeldByMeInMode(BufferDescriptorGetContentLock(
|
||||
GetBufferDescriptor(urec->Buff() - 1)), LW_SHARED)) {
|
||||
LockBuffer(urec->Buff(), BUFFER_LOCK_UNLOCK);
|
||||
}
|
||||
ReleaseBuffer(urec->Buff());
|
||||
urec->SetBuff(InvalidBuffer);
|
||||
}
|
||||
FlushErrorState();
|
||||
return state;
|
||||
} else {
|
||||
@ -701,4 +700,4 @@ void UndoRecordVerify(_in_ UndoRecord *urec)
|
||||
errmsg(UNDOFORMAT("[UNDO_RECORD_VERIFY]failed. utype %d , payLoadLen %hu, uinfo %d"),
|
||||
urec->Utype(), urec->PayLoadLen(), (int)urec->Uinfo())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -420,7 +420,6 @@ static bool LoadUndoRecordRange(UndoRecord *urec, Buffer *buffer)
|
||||
if (state == UNDO_RECORD_DISCARD || state == UNDO_RECORD_FORCE_DISCARD) {
|
||||
t_thrd.undo_cxt.fetchRecord = false;
|
||||
t_thrd.int_cxt.InterruptHoldoffCount = saveInterruptHoldoffCount;
|
||||
EmitErrorReport();
|
||||
FlushErrorState();
|
||||
return false;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user