You can subscribe to this list here.
2010 |
Jan
|
Feb
|
Mar
|
Apr
(4) |
May
(28) |
Jun
(12) |
Jul
(11) |
Aug
(12) |
Sep
(5) |
Oct
(19) |
Nov
(14) |
Dec
(12) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2011 |
Jan
(18) |
Feb
(30) |
Mar
(115) |
Apr
(89) |
May
(50) |
Jun
(44) |
Jul
(22) |
Aug
(13) |
Sep
(11) |
Oct
(30) |
Nov
(28) |
Dec
(39) |
2012 |
Jan
(38) |
Feb
(18) |
Mar
(43) |
Apr
(91) |
May
(108) |
Jun
(46) |
Jul
(37) |
Aug
(44) |
Sep
(33) |
Oct
(29) |
Nov
(36) |
Dec
(15) |
2013 |
Jan
(35) |
Feb
(611) |
Mar
(5) |
Apr
(55) |
May
(30) |
Jun
(28) |
Jul
(458) |
Aug
(34) |
Sep
(9) |
Oct
(39) |
Nov
(22) |
Dec
(32) |
2014 |
Jan
(16) |
Feb
(16) |
Mar
(42) |
Apr
(179) |
May
(7) |
Jun
(6) |
Jul
(9) |
Aug
|
Sep
(4) |
Oct
|
Nov
(3) |
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(4) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
1
(2) |
2
(3) |
3
|
4
|
5
|
6
(2) |
7
(1) |
8
|
9
(4) |
10
|
11
|
12
|
13
|
14
(1) |
15
(1) |
16
(1) |
17
|
18
|
19
|
20
|
21
(1) |
22
|
23
|
24
(2) |
25
|
26
|
27
(2) |
28
(1) |
29
(1) |
30
(22) |
|
|
From: Michael P. <mic...@us...> - 2011-06-06 07:34:14
|
Project "Postgres-XC". The branch, pgxc-barrier has been updated via 3b00d08bae2d2b48e957c61d9714a749d493a7ec (commit) from 467b6dc1d5af91bcabbb2b17f640b4cf89e112f9 (commit) - Log ----------------------------------------------------------------- commit 3b00d08bae2d2b48e957c61d9714a749d493a7ec Author: Michael P <mic...@us...> Date: Mon Jun 6 16:35:26 2011 +0900 Correction of spelling mistakes Addition of a couple of compilation flags forgotten. diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 20489ce..b7510b0 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -39,7 +39,9 @@ #include "funcapi.h" #include "libpq/pqsignal.h" #include "miscadmin.h" +#ifdef PGXC #include "pgxc/barrier.h" +#endif #include "pgstat.h" #include "postmaster/bgwriter.h" #include "replication/walreceiver.h" @@ -4371,6 +4373,7 @@ writeTimeLineHistory(TimeLineID newTLI, TimeLineID parentTLI, xlogfname, recoveryStopAfter ? "after" : "before", timestamptz_to_str(recoveryStopTime)); +#ifdef PGXC else if (recoveryTarget == RECOVERY_TARGET_BARRIER) snprintf(buffer, sizeof(buffer), "%s%u\t%s\t%s %s\n", @@ -4379,6 +4382,7 @@ writeTimeLineHistory(TimeLineID newTLI, TimeLineID parentTLI, xlogfname, recoveryStopAfter ? "after" : "before", recoveryTargetBarrierId); +#endif else snprintf(buffer, sizeof(buffer), "%s%u\t%s\tno recovery target specified\n", @@ -5491,24 +5495,26 @@ recoveryStopsHere(XLogRecord *record, bool *includeThis) return false; record_info = record->xl_info & ~XLR_INFO_MASK; +#ifdef PGXC if (record->xl_rmid == RM_XACT_ID) { - if (record_info == XLOG_XACT_COMMIT) - { - xl_xact_commit *recordXactCommitData; +#endif + if (record_info == XLOG_XACT_COMMIT) + { + xl_xact_commit *recordXactCommitData; - recordXactCommitData = (xl_xact_commit *) XLogRecGetData(record); - recordXtime = recordXactCommitData->xact_time; - } - else if (record_info == XLOG_XACT_ABORT) - { - xl_xact_abort *recordXactAbortData; + recordXactCommitData = (xl_xact_commit *) XLogRecGetData(record); + recordXtime = recordXactCommitData->xact_time; + } + else if (record_info == XLOG_XACT_ABORT) + { + xl_xact_abort *recordXactAbortData; - recordXactAbortData = (xl_xact_abort *) XLogRecGetData(record); - recordXtime = recordXactAbortData->xact_time; - } + recordXactAbortData = (xl_xact_abort *) XLogRecGetData(record); + recordXtime = recordXactAbortData->xact_time; } #ifdef PGXC + } /* end if (record->xl_rmid == RM_XACT_ID) */ else if (record->xl_rmid == RM_BARRIER_ID) { if (record_info == XLOG_BARRIER_CREATE) @@ -5880,10 +5886,12 @@ StartupXLOG(void) ereport(LOG, (errmsg("starting point-in-time recovery to %s", timestamptz_to_str(recoveryTargetTime)))); +#ifdef PGXC else if (recoveryTarget == RECOVERY_TARGET_BARRIER) ereport(LOG, (errmsg("starting point-in-time recovery to barrier %s", (recoveryTargetBarrierId)))); +#endif else ereport(LOG, (errmsg("starting archive recovery"))); diff --git a/src/backend/nodes/equalfuncs.c b/src/backend/nodes/equalfuncs.c index 5557915..815a3d3 100644 --- a/src/backend/nodes/equalfuncs.c +++ b/src/backend/nodes/equalfuncs.c @@ -2361,6 +2361,9 @@ _equalValue(Value *a, Value *b) } #ifdef PGXC +/* + * stuff from barrier.h + */ static bool _equalBarrierStmt(BarrierStmt *a, BarrierStmt *b) diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index d412a10..de0abec 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -7025,7 +7025,6 @@ opt_barrier_id: $$ = NULL; } ; - /* PGXC_END */ /***************************************************************************** diff --git a/src/backend/pgxc/barrier/Makefile b/src/backend/pgxc/barrier/Makefile index d80bbec..9505889 100644 --- a/src/backend/pgxc/barrier/Makefile +++ b/src/backend/pgxc/barrier/Makefile @@ -1,7 +1,7 @@ #------------------------------------------------------------------------- # # Makefile-- -# Makefile for pool +# Makefile for barrier # # Portions Copyright (c) 2010-2011 Nippon Telegraph and Telephone Corporation # diff --git a/src/backend/pgxc/barrier/barrier.c b/src/backend/pgxc/barrier/barrier.c index 1b44f36..32ff484 100644 --- a/src/backend/pgxc/barrier/barrier.c +++ b/src/backend/pgxc/barrier/barrier.c @@ -44,7 +44,7 @@ extern void ProcessCreateBarrierExecute(const char *id); * while all other backend starting a 2PC will grab the lock in shared * mode. So as long as we hold the exclusive lock, no other backend start a * new 2PC and there can not be any 2PC in-progress. This technique would - * rely on assumption that an exclsuive lock requester is not starved by + * rely on assumption that an exclusive lock requester is not starved by * share lock requesters. * * Note: To ensure that the 2PC are not blocked for a long time, we should @@ -76,7 +76,7 @@ ProcessCreateBarrierPrepare(const char *id) } /* - * Mark the completetion of an on-going barrier. We must have remembered the + * Mark the completion of an on-going barrier. We must have remembered the * barrier ID when we received the CREATE BARRIER PREPARE command */ void @@ -103,7 +103,7 @@ ProcessCreateBarrierEnd(const char *id) } /* - * Execute the CREATE BARRIER comamnd. Write a BARRIER WAL record and flush the + * Execute the CREATE BARRIER command. Write a BARRIER WAL record and flush the * WAL buffers to disk before returning to the caller. Writing the WAL record * does not guarantee successful completion of the barrier command. */ @@ -140,15 +140,15 @@ static const char * generate_barrier_id(const char *id) { /* - * TODO If the caller can passeed a NULL value, generate an id which is + * TODO If the caller can passed a NULL value, generate an id which is * guaranteed to be unique across the cluster. We can use a combination of * the coordinator node id and a timestamp. This may not be complete if we * support changing coordinator ids without initdb or the system clocks are * modified. * * Another option would be to let the GTM issue globally unique barrier - * IDs. For the time being, we leave it to the user to come up with an - * unique identifier + * IDs (GTM-timestamp based). For the time being, we leave it to the user + * to come up with an unique identifier. */ return id ? id : pstrdup("dummy_barrier_id"); } @@ -326,7 +326,7 @@ PrepareBarrier(const char *id) */ LWLockAcquire(BarrierLock, LW_EXCLUSIVE); - elog(DEBUG2, "Disabled 2PC commits origniating at the diriving coordinator"); + elog(DEBUG2, "Disabled 2PC commits originating at the driving coordinator"); /* * TODO Start a timer to cancel the barrier request in case of a timeout @@ -375,7 +375,7 @@ ExecuteBarrier(const char *id) if (handle->state != DN_CONNECTION_STATE_IDLE) ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR), - errmsg("Failed to send CREATE BARRIER PREPARE request " + errmsg("Failed to send CREATE BARRIER EXECUTE request " "to the node"))); barrier_idlen = strlen(id) + 1; diff --git a/src/backend/pgxc/pool/execRemote.c b/src/backend/pgxc/pool/execRemote.c index 0af1288..e14c284 100644 --- a/src/backend/pgxc/pool/execRemote.c +++ b/src/backend/pgxc/pool/execRemote.c @@ -1878,7 +1878,7 @@ PGXCNodeImplicitCommitPrepared(GlobalTransactionId prepare_xid, * We should acquire the BarrierLock in SHARE mode here to ensure that * there are no in-progress barrier at this point. This mechanism would * work as long as LWLock mechanism does not starve a EXCLUSIVE lock - * requesster + * requester */ LWLockAcquire(BarrierLock, LW_SHARED); res = pgxc_node_implicit_commit_prepared(prepare_xid, commit_xid, diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c index 7c9af6d..b7af28e 100644 --- a/src/backend/tcop/utility.c +++ b/src/backend/tcop/utility.c @@ -466,7 +466,7 @@ standard_ProcessUtility(Node *parsetree, * * XXX We call FinishPreparedTransaction inside * PGXCNodeCommitPrepared if we are doing a local - * operation. This is convinient because we want to + * operation. This is convenient because we want to * hold on to the BarrierLock until local transaction * is committed too. * diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h index b152c36..df9c0ab 100644 --- a/src/include/access/xlog.h +++ b/src/include/access/xlog.h @@ -184,8 +184,11 @@ typedef enum { RECOVERY_TARGET_UNSET, RECOVERY_TARGET_XID, - RECOVERY_TARGET_TIME, + RECOVERY_TARGET_TIME +#ifdef PGXC + , RECOVERY_TARGET_BARRIER +#endif } RecoveryTargetType; extern XLogRecPtr XactLastRecEnd; diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index 6ebf30b..5f16be6 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -2303,7 +2303,6 @@ typedef struct BarrierStmt NodeTag type; const char *id; /* User supplied barrier id, if any */ } BarrierStmt; - #endif /* ---------------------- ----------------------------------------------------------------------- Summary of changes: src/backend/access/transam/xlog.c | 32 ++++++++++++++++++++------------ src/backend/nodes/equalfuncs.c | 3 +++ src/backend/parser/gram.y | 1 - src/backend/pgxc/barrier/Makefile | 2 +- src/backend/pgxc/barrier/barrier.c | 16 ++++++++-------- src/backend/pgxc/pool/execRemote.c | 2 +- src/backend/tcop/utility.c | 2 +- src/include/access/xlog.h | 5 ++++- src/include/nodes/parsenodes.h | 1 - 9 files changed, 38 insertions(+), 26 deletions(-) hooks/post-receive -- Postgres-XC |
From: Michael P. <mic...@us...> - 2011-06-06 02:55:24
|
Project "Postgres-XC". The branch, master has been updated via b47dc806218c3746ff5ab233de6d6728b6f0457d (commit) from 20361f0df1f93d2d80dce14c6a7258af0a684bd8 (commit) - Log ----------------------------------------------------------------- commit b47dc806218c3746ff5ab233de6d6728b6f0457d Author: Michael P <mic...@us...> Date: Mon Jun 6 11:53:36 2011 +0900 Partial fix for bug 3310399: Autovacuum workers using same connections to GTM This fixes a problem with autovacuum worker/launchers that tended to use the connection allocated for postmaster to connect to GTM. In the case of multiple vacuums running at the same time, this tended to mess the way autovacuum was receiving GXID and snapshots from GTM. This commit also adds some begus messages to look at the connection activity to GTM and more strict connection control of autovacuum backends to GTM. diff --git a/src/backend/access/transam/gtm.c b/src/backend/access/transam/gtm.c index e9f0229..f05e38d 100644 --- a/src/backend/access/transam/gtm.c +++ b/src/backend/access/transam/gtm.c @@ -28,17 +28,28 @@ extern bool FirstSnapshotSet; static GTM_Conn *conn; -#define CheckConnection() \ - if (GTMPQstatus(conn) != CONNECTION_OK) InitGTM() - bool IsGTMConnected() { return conn != NULL; } +static void +CheckConnection(void) +{ + /* Be sure that a backend does not use a postmaster connection */ + if (IsUnderPostmaster && GTMPQispostmaster(conn) == 1) + { + InitGTM(); + return; + } + + if (GTMPQstatus(conn) != CONNECTION_OK) + InitGTM(); +} + void -InitGTM() +InitGTM(void) { /* 256 bytes should be enough */ char conn_str[256]; @@ -55,10 +66,23 @@ InitGTM() sprintf(conn_str, "host=%s port=%d pgxc_node_id=%d remote_type=%d postmaster=1", GtmHost, GtmPort, PGXCNodeId, remote_type); + + /* Log activity of GTM connections */ + elog(DEBUG1, "Postmaster: connection established to GTM with string %s", conn_str); } else + { sprintf(conn_str, "host=%s port=%d pgxc_node_id=%d", GtmHost, GtmPort, PGXCNodeId); + /* Log activity of GTM connections */ + if (IsAutoVacuumWorkerProcess()) + elog(DEBUG1, "Autovacuum worker: connection established to GTM with string %s", conn_str); + else if (IsAutoVacuumLauncherProcess()) + elog(DEBUG1, "Autovacuum launcher: connection established to GTM with string %s", conn_str); + else + elog(DEBUG1, "Postmaster child: connection established to GTM with string %s", conn_str); + } + conn = PQconnectGTM(conn_str); if (GTMPQstatus(conn) != CONNECTION_OK) { @@ -79,6 +103,16 @@ CloseGTM(void) { GTMPQfinish(conn); conn = NULL; + + /* Log activity of GTM connections */ + if (!IsUnderPostmaster) + elog(DEBUG1, "Postmaster: connection to GTM closed"); + else if (IsAutoVacuumWorkerProcess()) + elog(DEBUG1, "Autovacuum worker: connection to GTM closed"); + else if (IsAutoVacuumLauncherProcess()) + elog(DEBUG1, "Autovacuum launcher: connection to GTM closed"); + else + elog(DEBUG1, "Postmaster child: connection to GTM closed"); } GlobalTransactionId @@ -114,7 +148,8 @@ BeginTranAutovacuumGTM(void) if (conn) xid = begin_transaction_autovacuum(conn, GTM_ISOLATION_RC); - /* If something went wrong (timeout), try and reset GTM connection and retry. + /* + * If something went wrong (timeout), try and reset GTM connection and retry. * This is safe at the beginning of a transaction. */ if (!TransactionIdIsValid(xid)) @@ -147,6 +182,11 @@ CommitTranGTM(GlobalTransactionId gxid) CloseGTM(); InitGTM(); } + + /* Close connection in case commit is done by autovacuum worker or launcher */ + if (IsAutoVacuumWorkerProcess() || IsAutoVacuumLauncherProcess()) + CloseGTM(); + return ret; } diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index c6f56b7..e939bc0 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -232,8 +232,7 @@ static void DataNodeShutdown (int code, Datum arg) { /* Close connection with GTM, if active */ - if (IsAutoVacuumWorkerProcess()) - CloseGTM(); + CloseGTM(); } #endif diff --git a/src/gtm/client/fe-connect.c b/src/gtm/client/fe-connect.c index 52ce93c..95954b9 100644 --- a/src/gtm/client/fe-connect.c +++ b/src/gtm/client/fe-connect.c @@ -1254,6 +1254,14 @@ GTMPQstatus(const GTM_Conn *conn) return conn->status; } +int +GTMPQispostmaster(const GTM_Conn *conn) +{ + if (!conn) + return 0; + return conn->is_postmaster; +} + char * GTMPQerrorMessage(const GTM_Conn *conn) { diff --git a/src/include/gtm/libpq-fe.h b/src/include/gtm/libpq-fe.h index b3ef655..0603987 100644 --- a/src/include/gtm/libpq-fe.h +++ b/src/include/gtm/libpq-fe.h @@ -119,6 +119,7 @@ extern void GTMPQconninfoFree(GTMPQconninfoOption *connOptions); extern char *GTMPQhost(const GTM_Conn *conn); extern char *GTMPQport(const GTM_Conn *conn); extern ConnStatusType GTMPQstatus(const GTM_Conn *conn); +extern int GTMPQispostmaster(const GTM_Conn *conn); extern char *GTMPQerrorMessage(const GTM_Conn *conn); extern int GTMPQsocket(const GTM_Conn *conn); ----------------------------------------------------------------------- Summary of changes: src/backend/access/transam/gtm.c | 50 ++++++++++++++++++++++++++++++++++---- src/backend/tcop/postgres.c | 3 +- src/gtm/client/fe-connect.c | 8 ++++++ src/include/gtm/libpq-fe.h | 1 + 4 files changed, 55 insertions(+), 7 deletions(-) hooks/post-receive -- Postgres-XC |