!1589 修复从1.1.0/2.0.0版本升级到2.1.0后,回滚失败的问题

Merge pull request !1589 from pengjiong/fix_rollback
This commit is contained in:
opengauss-bot 2022-03-18 07:53:43 +00:00 committed by Gitee
commit f58c305a9b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 33 additions and 0 deletions

View File

@ -93,6 +93,7 @@ const uint32 CLIENT_ENCRYPTION_PROC_VERSION_NUM = 92383;
const uint32 DECODE_ABORT_VERSION_NUM = 92386;
const uint32 COPY_TRANSFORM_VERSION_NUM = 92394;
const uint32 COMMENT_PCT_TYPE_VERSION_NUM = 92396;
const uint32 RELMAP_4K_VERSION_NUM = 92403;
const uint32 TDE_VERSION_NUM = 92407;
const uint32 SWCB_VERSION_NUM = 92427;
const uint32 COMMENT_ROWTYPE_TABLEOF_VERSION_NUM = 92513;

View File

@ -421,6 +421,15 @@ void cluster_rel(Oid tableOid, Oid partitionOid, Oid indexOid, bool recheck, boo
return;
}
/* Forbid cluster on shared relation during upgrade, to protect global/pg_filenode.map not changed */
if (u_sess->attr.attr_common.upgrade_mode != 0 &&
tableOid < FirstBootstrapObjectId && OldHeap->rd_rel->relisshared &&
t_thrd.proc->workingVersionNum < RELMAP_4K_VERSION_NUM) {
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot cluster shared relation during upgrade")));
}
/*
* Since we may open a new transaction for each relation, we have to check
* that the relation still is what we think it is.

View File

@ -4514,6 +4514,15 @@ void truncate_check_rel(Relation rel)
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("permission denied: \"%s\" is a system catalog", RelationGetRelationName(rel))));
/* Forbid truncate on shared relation during upgrade, to protect global/pg_filenode.map not changed */
if (u_sess->attr.attr_common.upgrade_mode != 0 &&
rel->rd_id < FirstBootstrapObjectId && rel->rd_rel->relisshared &&
t_thrd.proc->workingVersionNum < RELMAP_4K_VERSION_NUM) {
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot truncate shared relation during upgrade")));
}
/*
* Don't allow truncate on temp tables of other backends ... their local
* buffer manager is not going to cope.

View File

@ -2110,6 +2110,19 @@ static bool vacuum_rel(Oid relid, VacuumStmt* vacstmt, bool do_toast)
return false;
}
/* Forbid vacuum full on shared relation during upgrade, to protect global/pg_filenode.map not changed */
if (u_sess->attr.attr_common.upgrade_mode != 0 && rel != NULL &&
relid < FirstBootstrapObjectId && rel->rd_rel->relisshared &&
t_thrd.proc->workingVersionNum < RELMAP_4K_VERSION_NUM) {
ereport(NOTICE,
(errcode(ERRCODE_E_R_E_MODIFYING_SQL_DATA_NOT_PERMITTED),
errmsg("skipping \"%s\" --- VACUUM FULL on shared relation is not allowed during upgrade",
RelationGetRelationName(rel))));
relation_close(rel, AccessShareLock);
proc_snapshot_and_transaction();
return false;
}
if (rel != NULL)
relation_close(rel, AccessShareLock);
}

View File

@ -88,6 +88,7 @@ extern const uint32 WAIT_N_TUPLE_LOCK_VERSION_NUM;
extern const uint32 DISASTER_READ_VERSION_NUM;
extern const uint32 SUPPORT_DATA_REPAIR;
extern const uint32 SCAN_BATCH_MODE_VERSION_NUM;
extern const uint32 RELMAP_4K_VERSION_NUM;
extern const uint32 PUBLICATION_VERSION_NUM;
extern const uint32 ANALYZER_HOOK_VERSION_NUM;
extern const uint32 SUPPORT_HASH_XLOG_VERSION_NUM;