|
From: mason_s <ma...@us...> - 2010-07-07 13:33:07
|
Project "Postgres-XC".
The branch, master has been updated
via 5800b1b7b84dac3759f25a4a37afcb2ed26a1a63 (commit)
via 73249fbb42f4c05de85181428a7ae143c0c8d254 (commit)
from 47f4b06f6e25426bb775d7a7372309b68c7e1f47 (commit)
- Log -----------------------------------------------------------------
commit 5800b1b7b84dac3759f25a4a37afcb2ed26a1a63
Author: Mason S <mas...@ma...>
Date: Wed Jul 7 15:31:15 2010 +0200
In Postgres-XC, the error stack may overflow because
AbortTransaction may be called multiple times, each
time calling DataNodeRollback, which may fail again
if a data node is down.
Instead, if we are already in an abort state, we do not
bother repeating abort actions.
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index 757f99d..491d0d5 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -2697,6 +2697,20 @@ AbortCurrentTransaction(void)
}
}
+#ifdef PGXC
+/*
+ * AbortCurrentTransactionOnce
+ *
+ * Abort transaction, but only if we have not already.
+ */
+void
+AbortCurrentTransactionOnce(void)
+{
+ if (CurrentTransactionState->state != TRANS_ABORT)
+ AbortCurrentTransaction();
+}
+#endif
+
/*
* PreventTransactionChain
*
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 4cb0b27..553a682 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -3768,7 +3768,15 @@ PostgresMain(int argc, char *argv[], const char *username)
/*
* Abort the current transaction in order to recover.
*/
+#ifdef PGXC
+ /*
+ * Temporarily do not abort if we are already in an abort state.
+ * This change tries to handle the case where the error data stack fills up.
+ */
+ AbortCurrentTransactionOnce();
+#else
AbortCurrentTransaction();
+#endif
/*
* Now return to normal top-level context and clear ErrorContext for
diff --git a/src/include/access/xact.h b/src/include/access/xact.h
index fe69611..5bd157b 100644
--- a/src/include/access/xact.h
+++ b/src/include/access/xact.h
@@ -163,6 +163,9 @@ extern void CommandCounterIncrement(void);
extern void ForceSyncCommit(void);
extern void StartTransactionCommand(void);
extern void CommitTransactionCommand(void);
+#ifdef PGXC
+extern void AbortCurrentTransactionOnce(void);
+#endif
extern void AbortCurrentTransaction(void);
extern void BeginTransactionBlock(void);
extern bool EndTransactionBlock(void);
commit 73249fbb42f4c05de85181428a7ae143c0c8d254
Author: Mason S <mas...@ma...>
Date: Wed Jul 7 15:30:16 2010 +0200
Changed some error messages so that they will not be duplicates
to better pinpoint some issues.
diff --git a/src/backend/pgxc/pool/execRemote.c b/src/backend/pgxc/pool/execRemote.c
index 1ee1d59..c6f9042 100644
--- a/src/backend/pgxc/pool/execRemote.c
+++ b/src/backend/pgxc/pool/execRemote.c
@@ -475,7 +475,7 @@ HandleCopyOutComplete(RemoteQueryState *combiner)
/* Inconsistent responses */
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
- errmsg("Unexpected response from the data nodes")));
+ errmsg("Unexpected response from the data nodes for 'c' message, current request type %d", combiner->request_type)));
/* Just do nothing, close message is managed by the coordinator */
combiner->copy_out_count++;
}
@@ -559,7 +559,7 @@ HandleRowDescription(RemoteQueryState *combiner, char *msg_body, size_t len)
/* Inconsistent responses */
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
- errmsg("Unexpected response from the data nodes")));
+ errmsg("Unexpected response from the data nodes for 'T' message, current request type %d", combiner->request_type)));
}
/* Increment counter and check if it was first */
if (combiner->description_count++ == 0)
@@ -583,7 +583,7 @@ HandleParameterStatus(RemoteQueryState *combiner, char *msg_body, size_t len)
/* Inconsistent responses */
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
- errmsg("Unexpected response from the data nodes")));
+ errmsg("Unexpected response from the data nodes for 'S' message, current request type %d", combiner->request_type)));
}
/* Proxy last */
if (++combiner->description_count == combiner->node_count)
@@ -605,7 +605,7 @@ HandleCopyIn(RemoteQueryState *combiner)
/* Inconsistent responses */
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
- errmsg("Unexpected response from the data nodes")));
+ errmsg("Unexpected response from the data nodes for 'G' message, current request type %d", combiner->request_type)));
}
/*
* The normal PG code will output an G message when it runs in the
@@ -627,7 +627,7 @@ HandleCopyOut(RemoteQueryState *combiner)
/* Inconsistent responses */
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
- errmsg("Unexpected response from the data nodes")));
+ errmsg("Unexpected response from the data nodes for 'H' message, current request type %d", combiner->request_type)));
}
/*
* The normal PG code will output an H message when it runs in the
@@ -649,7 +649,7 @@ HandleCopyDataRow(RemoteQueryState *combiner, char *msg_body, size_t len)
if (combiner->request_type != REQUEST_TYPE_COPY_OUT)
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
- errmsg("Unexpected response from the data nodes")));
+ errmsg("Unexpected response from the data nodes for 'd' message, current request type %d", combiner->request_type)));
/* If there is a copy file, data has to be sent to the local file */
if (combiner->copy_file)
@@ -675,7 +675,7 @@ HandleDataRow(RemoteQueryState *combiner, char *msg_body, size_t len)
/* Inconsistent responses */
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
- errmsg("Unexpected response from the data nodes")));
+ errmsg("Unexpected response from the data nodes for 'D' message, current request type %d", combiner->request_type)));
}
/*
@@ -943,7 +943,8 @@ data_node_receive_responses(const int conn_count, DataNodeHandle ** connections,
data_node_receive(count, to_receive, timeout);
while (i < count)
{
- switch (handle_response(to_receive[i], combiner))
+ int result = handle_response(to_receive[i], combiner);
+ switch (result)
{
case RESPONSE_EOF: /* have something to read, keep receiving */
i++;
@@ -960,7 +961,7 @@ data_node_receive_responses(const int conn_count, DataNodeHandle ** connections,
/* Inconsistent responses */
ereport(ERROR,
(errcode(ERRCODE_INTERNAL_ERROR),
- errmsg("Unexpected response from the data nodes")));
+ errmsg("Unexpected response from the data nodes, result = %d, request type %d", result, combiner->request_type)));
}
}
}
@@ -1679,7 +1680,7 @@ DataNodeCopyOut(Exec_Nodes *exec_nodes, DataNodeHandle** copy_connections, FILE*
pfree(copy_connections);
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
- errmsg("Unexpected response from the data nodes")));
+ errmsg("Unexpected response from the data nodes when combining, request type %d", combiner->request_type)));
}
return processed;
-----------------------------------------------------------------------
Summary of changes:
src/backend/access/transam/xact.c | 14 ++++++++++++++
src/backend/pgxc/pool/execRemote.c | 21 +++++++++++----------
src/backend/tcop/postgres.c | 8 ++++++++
src/include/access/xact.h | 3 +++
4 files changed, 36 insertions(+), 10 deletions(-)
hooks/post-receive
--
Postgres-XC
|