修复开启备机写转发后,发生了reform,debug版本备机coredump的问题

This commit is contained in:
arcoalien@qq.com
2023-11-27 12:10:08 +08:00
parent 180223fd9c
commit 01db76bf64
5 changed files with 16 additions and 6 deletions

View File

@ -289,7 +289,7 @@ CommitSeqNo SSTransactionIdGetCommitSeqNo(TransactionId transactionId, bool isCo
}
if (SS_IN_REFORM && (t_thrd.role == WORKER || t_thrd.role == THREADPOOL_WORKER || t_thrd.role == STREAM_WORKER)) {
ereport(FATAL, (errmsg("SSTransactionIdGetCommitSeqNo failed during reform, xid=%lu.", transactionId)));
ereport(ERROR, (errmsg("SSTransactionIdGetCommitSeqNo failed during reform, xid=%lu.", transactionId)));
}
do {
@ -311,7 +311,7 @@ CommitSeqNo SSTransactionIdGetCommitSeqNo(TransactionId transactionId, bool isCo
} else {
if (SS_IN_REFORM &&
(t_thrd.role == WORKER || t_thrd.role == THREADPOOL_WORKER || t_thrd.role == STREAM_WORKER)) {
ereport(FATAL, (errmsg("SSTransactionIdGetCommitSeqNo failed during reform, xid=%lu.", transactionId)));
ereport(ERROR, (errmsg("SSTransactionIdGetCommitSeqNo failed during reform, xid=%lu.", transactionId)));
}
pg_usleep(USECS_PER_SEC);
continue;
@ -396,7 +396,7 @@ void SSTransactionIdDidCommit(TransactionId transactionId, bool* ret_did_commit)
} else {
if (SS_IN_REFORM &&
(t_thrd.role == WORKER || t_thrd.role == THREADPOOL_WORKER || t_thrd.role == STREAM_WORKER)) {
ereport(FATAL, (errmsg("SSTransactionIdDidCommit failed during reform, xid=%lu.", transactionId)));
ereport(ERROR, (errmsg("SSTransactionIdDidCommit failed during reform, xid=%lu.", transactionId)));
}
pg_usleep(USECS_PER_SEC);
continue;
@ -430,7 +430,7 @@ void SSTransactionIdIsInProgress(TransactionId transactionId, bool *in_progress)
} else {
if (SS_IN_REFORM &&
(t_thrd.role == WORKER || t_thrd.role == THREADPOOL_WORKER || t_thrd.role == STREAM_WORKER)) {
ereport(FATAL, (errmsg("SSTransactionIdIsInProgress failed during reform, xid=%lu.", transactionId)));
ereport(ERROR, (errmsg("SSTransactionIdIsInProgress failed during reform, xid=%lu.", transactionId)));
}
pg_usleep(USECS_PER_SEC);
continue;
@ -455,7 +455,7 @@ TransactionId SSMultiXactIdGetUpdateXid(TransactionId xmax, uint16 t_infomask, u
} else {
if (SS_IN_REFORM &&
(t_thrd.role == WORKER || t_thrd.role == THREADPOOL_WORKER || t_thrd.role == STREAM_WORKER)) {
ereport(FATAL, (errmsg("SSMultiXactIdGetUpdateXid failed during reform, xid=%lu.", xmax)));
ereport(ERROR, (errmsg("SSMultiXactIdGetUpdateXid failed during reform, xid=%lu.", xmax)));
}
pg_usleep(USECS_PER_SEC);
continue;

View File

@ -221,6 +221,12 @@ PlannedStmt* pgxc_planner(Query* query, int cursorOptions, ParamListInfo boundPa
ecxt = MemoryContextSwitchTo(current_context);
edata = CopyErrorData();
if (SS_STANDBY_MODE_WITH_REMOTE_EXECUTE) {
LWLockReleaseAll();
AbortBufferIO();
UnlockBuffers();
}
/*
* refuse to recreate plan if
* 1. no query copy: query have been polluted by rewrite

View File

@ -2032,7 +2032,7 @@ static TransactionId RecordTransactionAbort(bool isSubXact)
* rels to delete (note that this routine is not responsible for actually
* deleting 'em). We cannot have any child XIDs, either.
*/
if (!TransactionIdIsValid(xid)) {
if (!TransactionIdIsValid(xid) || SS_STANDBY_MODE_WITH_REMOTE_EXECUTE) {
/* Reset XactLastRecEnd until the next transaction writes something */
if (!isSubXact)
t_thrd.xlog_cxt.XactLastRecEnd = 0;

View File

@ -2072,6 +2072,9 @@ RETRY:
snapshot->snapshotcsn = pg_atomic_read_u64(&t_thrd.xact_cxt.ShmemVariableCache->nextCommitSeqNo);
} else {
result = SSGetSnapshotData(snapshot);
if (result == NULL) {
ereport(ERROR, (errmsg("failed to request snapshot as current node is in reform!")));
}
}
} else {
result = GetLocalSnapshotData(snapshot);

View File

@ -1214,6 +1214,7 @@ bool libpqsw_connect(char* conninfo, const char *dbName, const char* userName)
get_sw_cxt()->streamConn = PQconnectdb(conninfoRepl);
if (PQstatus(get_sw_cxt()->streamConn) != CONNECTION_OK) {
libpqsw_info("Connecting to remote server :%s ...failed!", conninfoRepl);
libpqsw_disconnect(true);
ereport(ERROR,
(errcode(ERRCODE_CONNECTION_TIMED_OUT),
errmsg("standbywrite could not connect to the remote server,the connection info :%s : %s",