!2621 【共享存储】修复reform和正常运行期间获取CSN集群hang

Merge pull request !2621 from 刘博文/master
This commit is contained in:
opengauss-bot
2022-12-15 08:00:15 +00:00
committed by Gitee

View File

@ -117,6 +117,10 @@ CommitSeqNo SSTransactionIdGetCommitSeqNo(TransactionId transactionId, bool isCo
dms_txn_info.snapshotxmin = InvalidTransactionId;
}
if (SS_IN_REFORM && (t_thrd.role == WORKER || t_thrd.role == THREADPOOL_WORKER)) {
ereport(FATAL, (errmsg("SSTransactionIdGetCommitSeqNo failed during reform, xid=%lu.", transactionId)));
}
do {
if (SSTransactionIdGetCSN(&dms_txn_info, &xid_csn_result) == DMS_SUCCESS) {
csn = xid_csn_result.csn;
@ -132,9 +136,10 @@ CommitSeqNo SSTransactionIdGetCommitSeqNo(TransactionId transactionId, bool isCo
} else {
ereport(DEBUG1, (errmsg("SS get txn info success, snapshot is NULL")));
}
break;
} else {
if (SS_IN_FAILOVER && (t_thrd.role == WORKER || t_thrd.role == THREADPOOL_WORKER)) {
ereport(FATAL, (errmsg("SS get CSN by TransactionId failed during failover, xid=%lu", transactionId)));
if (SS_IN_REFORM && (t_thrd.role == WORKER || t_thrd.role == THREADPOOL_WORKER)) {
ereport(FATAL, (errmsg("SSTransactionIdGetCommitSeqNo failed during reform, xid=%lu.", transactionId)));
}
pg_usleep(USECS_PER_SEC);
continue;
@ -196,6 +201,9 @@ bool SSTransactionIdDidCommit(TransactionId transactionId)
transactionId, did_commit)));
break;
} else {
if (SS_IN_REFORM && (t_thrd.role == WORKER || t_thrd.role == THREADPOOL_WORKER)) {
ereport(FATAL, (errmsg("SSTransactionIdDidCommit failed during reform, xid=%lu.", transactionId)));
}
pg_usleep(USECS_PER_SEC);
continue;
}
@ -229,6 +237,9 @@ bool SSTransactionIdIsInProgress(TransactionId transactionId)
transactionId, in_progress)));
break;
} else {
if (SS_IN_REFORM && (t_thrd.role == WORKER || t_thrd.role == THREADPOOL_WORKER)) {
ereport(FATAL, (errmsg("SSTransactionIdIsInProgress failed during reform, xid=%lu.", transactionId)));
}
pg_usleep(USECS_PER_SEC);
continue;
}
@ -251,6 +262,9 @@ TransactionId SSMultiXactIdGetUpdateXid(TransactionId xmax, uint16 t_infomask, u
ereport(DEBUG1, (errmsg("SS get update xid success, multixact xid=%lu, uxid=%lu.", xmax, update_xid)));
break;
} else {
if (SS_IN_REFORM && (t_thrd.role == WORKER || t_thrd.role == THREADPOOL_WORKER)) {
ereport(FATAL, (errmsg("SSMultiXactIdGetUpdateXid failed during reform, xid=%lu.", xmax)));
}
pg_usleep(USECS_PER_SEC);
continue;
}