1.修复bug_undo页面复用场景下,当checkpoint点晚于undo页面复用且此时发生redo后出现urecptr与xlog记录中的urecptr不一致的情况

2.astore表在enable_recyclebin=on场景下不支持创建段页式表
3.修复gs_undo_dump_xid视图xid校验问题
This commit is contained in:
q00421813
2024-07-29 08:45:28 +08:00
parent 4ad7ea0cc3
commit 8eeec8f530
4 changed files with 15 additions and 9 deletions

View File

@ -1912,7 +1912,7 @@ Datum gs_undo_translot_dump_xid(PG_FUNCTION_ARGS)
TransactionId xid = (TransactionId)PG_GETARG_TRANSACTIONID(0);
bool read_memory = PG_GETARG_INT32(1);
if (!TransactionIdIsValid(xid)) {
if (!TransactionIdIsValid(xid) || xid >= t_thrd.xact_cxt.ShmemVariableCache->nextXid) {
elog(ERROR, "xid is invalid");
PG_RETURN_VOID();
}
@ -2012,7 +2012,7 @@ Datum gs_undo_dump_xid(PG_FUNCTION_ARGS)
PG_RETURN_VOID();
#else
TransactionId xid = (TransactionId)PG_GETARG_TRANSACTIONID(0);
if (!TransactionIdIsValid(xid)) {
if (!TransactionIdIsValid(xid) || xid >= t_thrd.xact_cxt.ShmemVariableCache->nextXid) {
elog(ERROR, "xid is invalid");
PG_RETURN_VOID();
}

View File

@ -2895,7 +2895,7 @@ ObjectAddress DefineRelation(CreateStmt* stmt, char relkind, Oid ownerId, Object
if (!IsInitdb && (relkind == RELKIND_RELATION) && !IsSystemNamespace(namespaceId) &&
!IsCStoreNamespace(namespaceId) && (pg_strcasecmp(storeChar, ORIENTATION_ROW) == 0) &&
(stmt->relation->relpersistence == RELPERSISTENCE_PERMANENT)) {
(stmt->relation->relpersistence == RELPERSISTENCE_PERMANENT) && !u_sess->attr.attr_storage.enable_recyclebin) {
bool isSegmentType = (storage_type == SEGMENT_PAGE);
if (!isSegmentType && (u_sess->attr.attr_storage.enable_segment || bucketinfo != NULL)) {
storage_type = SEGMENT_PAGE;
@ -2904,6 +2904,12 @@ ObjectAddress DefineRelation(CreateStmt* stmt, char relkind, Oid ownerId, Object
reloptions = transformRelOptions((Datum)0, stmt->options, NULL, validnsps, true, false);
}
} else if (storage_type == SEGMENT_PAGE) {
if (u_sess->attr.attr_storage.enable_recyclebin) {
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmodule(MOD_SEGMENT_PAGE),
errmsg("The table %s do not support segment-page storage", stmt->relation->relname),
errdetail("Segment-page storage doest not support recyclebin"),
errhint("set enable_recyclebin = off before using segmnet-page storage.")));
}
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("The table %s do not support segment storage", stmt->relation->relname)));

View File

@ -1685,7 +1685,7 @@ static void RedoUndoInsertBlock(XLogBlockHead *blockhead, XLogBlockUndoParse *bl
urecptr = UHeapPrepareUndoInsert(xlundohdr->relOid, xlundohdrextra->partitionOid, relNode, spcNode,
UNDO_PERMANENT, recxid, 0, xlundohdrextra->blkprev, xlundohdrextra->prevurp,
blockdatarec->insertUndoParse.blkno, xlundohdr, xlundometa);
Assert(urecptr == xlundohdr->urecptr);
Assert(UNDO_PTR_GET_OFFSET(urecptr) == UNDO_PTR_GET_OFFSET(xlundohdr->urecptr));
undorec->SetOffset(blockdatarec->insertUndoParse.offnum);
if (!skipInsert) {
InsertPreparedUndo(t_thrd.ustore_cxt.urecvec, lsn);
@ -1764,7 +1764,7 @@ static void RedoUndoDeleteBlock(XLogBlockHead *blockhead, XLogBlockUndoParse *bl
xlundohdrextra->hasSubXact ? TopSubTransactionId : InvalidSubTransactionId, 0,
xlundohdrextra->blkprev, xlundohdrextra->prevurp, &oldTD, &utup, blockdatarec->deleteUndoParse.blkno,
xlundohdr, xlundometa);
Assert(urecptr == xlundohdr->urecptr);
Assert(UNDO_PTR_GET_OFFSET(urecptr) == UNDO_PTR_GET_OFFSET(xlundohdr->urecptr));
undorec->SetOffset(blockdatarec->deleteUndoParse.offnum);
if (!skipInsert) {
/* Insert the Undo record into the undo store */
@ -1851,7 +1851,7 @@ static void RedoUndoUpdateBlock(XLogBlockHead *blockhead, XLogBlockUndoParse *bl
inplaceUpdate ? xlundohdrextra->blkprev : xlnewundohdrextra->blkprev, xlundohdrextra->prevurp,
&oldTD, &oldtup, inplaceUpdate, &newUrecptr, blockdatarec->updateUndoParse.undoXorDeltaSize,
blockdatarec->updateUndoParse.oldblk, blockdatarec->updateUndoParse.newblk, xlundohdr, xlundometa);
Assert(urecptr == xlundohdr->urecptr);
Assert(UNDO_PTR_GET_OFFSET(urecptr) == UNDO_PTR_GET_OFFSET(xlundohdr->urecptr));
if (!skipInsert) {
if (!inplaceUpdate) {
@ -1956,7 +1956,7 @@ static void RedoUndoMultiInsertBlock(XLogBlockHead *blockhead, XLogBlockUndoPars
* undo should be inserted at same location as it was during the
* actual insert (DO operation).
*/
Assert((*urecvec)[0]->Urp() == xlundohdr->urecptr);
Assert(UNDO_PTR_GET_OFFSET((*urecvec)[0]->Urp()) == UNDO_PTR_GET_OFFSET(xlundohdr->urecptr));
InsertPreparedUndo(urecvec, lsn);
}

View File

@ -393,7 +393,7 @@ static UndoRecPtr PrepareAndInsertUndoRecordForDeleteRedo(XLogReaderState *recor
InvalidBuffer, xlrec->offnum, xid,
*hasSubXact ? TopSubTransactionId : InvalidSubTransactionId, 0,
*blkprev, *prevurp, &oldTD, utup, blkno, xlundohdr, &undometa);
Assert(urecptr == xlundohdr->urecptr);
Assert(UNDO_PTR_GET_OFFSET(urecptr) == UNDO_PTR_GET_OFFSET(xlundohdr->urecptr));
undorec->SetOffset(xlrec->offnum);
if (!skipInsert) {
/* Insert the Undo record into the undo store */
@ -968,7 +968,7 @@ static UndoRecPtr PrepareAndInsertUndoRecordForUpdateRedo(XLogReaderState *recor
*hasSubXact ? TopSubTransactionId : InvalidSubTransactionId, 0, *blkprev,
inplaceUpdate ? *blkprev : *newblkprev, *prevurp, &oldTD, oldtup,
inplaceUpdate, &newUrecptr, undoXorDeltaSize, oldblk, newblk, xlundohdr, &undometa);
Assert(urecptr == xlundohdr->urecptr);
Assert(UNDO_PTR_GET_OFFSET(urecptr) == UNDO_PTR_GET_OFFSET(xlundohdr->urecptr));
if (!skipInsert) {
if (!inplaceUpdate) {