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
(6) |
3
|
4
|
5
|
6
|
7
|
8
|
9
|
10
|
11
|
12
|
13
|
14
|
15
|
16
(2) |
17
(3) |
18
(1) |
19
|
20
|
21
(8) |
22
(6) |
23
(3) |
24
|
25
|
26
|
27
|
28
(1) |
|
|
|
|
|
From: Michael P. <mic...@us...> - 2011-02-23 07:14:26
|
Project "Postgres-XC". The branch, ha_support has been updated via bd357d3c92dcd3d7bb82ba63d942ba3841cff751 (commit) from 101c354db37e5642023f80467fd19849b147d644 (commit) - Log ----------------------------------------------------------------- commit bd357d3c92dcd3d7bb82ba63d942ba3841cff751 Author: Michael P <mic...@us...> Date: Wed Feb 23 16:18:27 2011 +0900 Support for Preferred Datanode and Primary datanodes Mirror mode itself doesn't need that but this is necessary when XCM is activated to get necessary information. This was still missing in the implementation. diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c index 2d0fb13..8871c05 100644 --- a/src/backend/commands/copy.c +++ b/src/backend/commands/copy.c @@ -34,7 +34,7 @@ #include "optimizer/planner.h" #include "parser/parse_relation.h" #ifdef PGXC -#include "pgxc/pgxc.h" +#include "pgxc/mirror.h" #include "pgxc/execRemote.h" #include "pgxc/locator.h" #include "pgxc/poolmgr.h" @@ -1343,9 +1343,17 @@ DoCopy(const CopyStmt *stmt, const char *queryString) { if (IS_PGXC_COORDINATOR && is_from && cstate->rel_loc) { + int primary_node_id = IsXCM ? PGXCMirror_GetPrimaryDatanodeID() : primary_data_node; + int primary_node_num; + + if (IsPGXCMirrorMode) + primary_node_num = PGXCMirror_GetPrimaryMirrorNum(primary_node_id); + else + primary_node_num = primary_node_id; + DataNodeCopyFinish( cstate->connections, - primary_data_node, + primary_node_num, COMBINE_TYPE_NONE); pfree(cstate->connections); pfree(cstate->query_buf.data); @@ -1357,9 +1365,17 @@ DoCopy(const CopyStmt *stmt, const char *queryString) if (IS_PGXC_COORDINATOR && is_from && cstate->rel_loc) { bool replicated = cstate->rel_loc->locatorType == LOCATOR_TYPE_REPLICATED; + int primary_node_id = IsXCM ? PGXCMirror_GetPrimaryDatanodeID() : primary_data_node; + int primary_node_num; + + if (IsPGXCMirrorMode) + primary_node_num = PGXCMirror_GetPrimaryMirrorNum(primary_node_id); + else + primary_node_num = primary_node_id; + DataNodeCopyFinish( cstate->connections, - replicated ? primary_data_node : 0, + replicated ? primary_node_num : 0, replicated ? COMBINE_TYPE_SAME : COMBINE_TYPE_SUM); pfree(cstate->connections); pfree(cstate->query_buf.data); @@ -4039,11 +4055,19 @@ DoInsertSelectCopy(EState *estate, TupleTableSlot *slot) void EndInsertSelectCopy(void) { + int primary_node_id = IsXCM ? PGXCMirror_GetPrimaryDatanodeID() : primary_data_node; + int primary_node_num; + + if (IsPGXCMirrorMode) + primary_node_num = PGXCMirror_GetPrimaryMirrorNum(primary_node_id); + else + primary_node_num = primary_node_id; + Assert(IS_PGXC_COORDINATOR); DataNodeCopyFinish( insertstate->connections, - primary_data_node, + primary_node_num, COMBINE_TYPE_NONE); pfree(insertstate->connections); MemoryContextDelete(insertstate->rowcontext); diff --git a/src/backend/pgxc/locator/locator.c b/src/backend/pgxc/locator/locator.c index 6729b15..dfac11f 100644 --- a/src/backend/pgxc/locator/locator.c +++ b/src/backend/pgxc/locator/locator.c @@ -86,6 +86,7 @@ List * GetAnyDataNode(void) { List *destList = NULL; + int preferred_datanode = IsXCM ? PGXCMirror_GetPreferredNodeID(true) : PreferredDataNode; /* * Try and pick the preferred node. * In Mirror mode, pick up the preferred Mirror. @@ -95,10 +96,10 @@ GetAnyDataNode(void) * PGXCTODO: When tables defined in a subset of nodes is supported, * we need also to check if those tables can use it. */ - if (PreferredDataNode != 0 && !IsPGXCMirrorMode) - return destList = lappend_int(NULL, PreferredDataNode); - else if (PreferredDataNode != 0 && IsPGXCMirrorMode) - return destList = PGXCMirror_GetSubsetMirrors(PreferredDataNode, false); + if (preferred_datanode != 0 && !IsPGXCMirrorMode) + return destList = lappend_int(NULL, preferred_datanode); + else if (preferred_datanode != 0 && IsPGXCMirrorMode) + return destList = PGXCMirror_GetSubsetMirrors(preferred_datanode, false); return destList = lappend_int(NULL, 1); } @@ -457,12 +458,13 @@ GetRelationNodes(RelationLocInfo *rel_loc_info, long *partValue, case LOCATOR_TYPE_REPLICATED: { int primary_node_num; + int primary_datanode_id = IsXCM ? PGXCMirror_GetPrimaryDatanodeID() : primary_data_node; /* In Mirror mode, primary mirror is selected in subset of datanodes */ if (IsPGXCMirrorMode) - primary_node_num = PGXCMirror_GetPrimaryMirrorNum(primary_data_node); + primary_node_num = PGXCMirror_GetPrimaryMirrorNum(primary_datanode_id); else - primary_node_num = primary_data_node; + primary_node_num = primary_datanode_id; if (accessType == RELATION_ACCESS_UPDATE || accessType == RELATION_ACCESS_INSERT) @@ -483,6 +485,7 @@ GetRelationNodes(RelationLocInfo *rel_loc_info, long *partValue, } else { + int preferred_datanode = IsXCM ? PGXCMirror_GetPreferredNodeID(true) : PreferredDataNode; if (accessType == RELATION_ACCESS_READ_FOR_UPDATE && primary_data_node) { @@ -493,7 +496,7 @@ GetRelationNodes(RelationLocInfo *rel_loc_info, long *partValue, */ exec_nodes->nodelist = lappend_int(NULL, primary_node_num); } - else if (PreferredDataNode != 0) + else if (preferred_datanode != 0) { /* * Try and pick the preferred node. @@ -502,12 +505,12 @@ GetRelationNodes(RelationLocInfo *rel_loc_info, long *partValue, */ foreach(stepItem, rel_loc_info->nodeList) { - if (lfirst_int(stepItem) == PreferredDataNode) + if (lfirst_int(stepItem) == preferred_datanode) { if (IsPGXCMirrorMode) - exec_nodes->nodelist = PGXCMirror_GetSubsetMirrors(PreferredDataNode, false); + exec_nodes->nodelist = PGXCMirror_GetSubsetMirrors(preferred_datanode, false); else - exec_nodes->nodelist = lappend_int(NULL, PreferredDataNode); + exec_nodes->nodelist = lappend_int(NULL, preferred_datanode); break; } diff --git a/src/backend/pgxc/pool/mirror.c b/src/backend/pgxc/pool/mirror.c index 1700695..fd51b4d 100644 --- a/src/backend/pgxc/pool/mirror.c +++ b/src/backend/pgxc/pool/mirror.c @@ -81,33 +81,86 @@ static int MirrorTotalCount = 0; /* PGXCMirror_GetXXX and PGXCMirror_SetXXX APIs can be invocated only at node startup */ /* - * PGXCMirror_SetNodePrimary + * PGXCMirror_GetPrimaryDatanodeID * - * Set PGXCNodePrimary parameters for Replicated Handling - * This is called at node startup + * Get Primary Datanode number to be used instead of GUC parameter */ -void -PGXCMirror_SetNodePrimary(void) +int +PGXCMirror_GetPrimaryDatanodeID(void) { + int primary_id = 0; /* * Get the primary node parameters from Fault Sync module * In other cases GUC params have all the necessary data. */ if (IsXCM) { - int datanode_id, mirror_id; + if (get_xcm_primary_datanode(&primary_id) < 0) + ereport(ERROR, + (errcode(ERRCODE_INTERNAL_ERROR), + errmsg("Fault Sync ERROR: could not get primary node ID"))); + } + + return primary_id; +} + + +/* + * PGXCMirror_GetPrimaryMirrorID + * + * Get Primary Mirror ID to be used instead of GUC parameter + * To be used with results of PGXCMirror_GetPrimaryDatanodeID + * when calculating global ID for node lists. + */ +int +PGXCMirror_GetPrimaryMirrorID(void) +{ + int datanode_id = PGXCMirror_GetPrimaryDatanodeID(); + int mirror_id = 0; + + if (IsXCM) + { + if (get_xcm_primary_mirror(datanode_id, &mirror_id) < 0) + ereport(ERROR, + (errcode(ERRCODE_INTERNAL_ERROR), + errmsg("Fault Sync ERROR: could not get primary mirror ID"))); + + Assert(datanode_id <= NumDataNodes && datanode_id > 0); + Assert(mirror_id < PGXCMirror_GetMirrorCount(datanode_id)); + } + + return mirror_id; +} + +/* + * PGXCMirror_GetPreferredNodeID + * + * Get preferred Datanode ID or preferred mirror ID + */ +int +PGXCMirror_GetPreferredNodeID(bool is_datanode) +{ + int datanode_id = 0; + int mirror_id = 0; + if (IsXCM) + { if (get_xcm_preferred_mirror(PGXCNodeId, &datanode_id, &mirror_id) < 0) ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR), - errmsg("Fault Sync ERROR: could not get Primary node data"))); + errmsg("Fault Sync ERROR: could not get primary mirror ID"))); - /* Assign obtained values */ - PreferredDataNode = datanode_id; - PreferredMirrorId = mirror_id; + Assert(datanode_id <= NumDataNodes && datanode_id > 0); + Assert(mirror_id < PGXCMirror_GetMirrorCount(datanode_id)); } + + if (is_datanode) + return datanode_id; + else + return mirror_id; } + /* * PGXCMirror_SetMirrorCountList * @@ -316,23 +369,28 @@ PGXCMirror_GetSubsetMirrors(int pgxc_node_id, bool is_write) * If the preferred node is not online, choose another mirror randomly */ bool done = false; + int preferred_mirror_id = PreferredMirrorId; + + if (IsXCM) + preferred_mirror_id = PGXCMirror_GetPreferredNodeID(false); + + Assert(preferred_mirror_id <= PGXCNodeMirrorCount[pgxc_node_id - 1]); - Assert(PreferredMirrorId <= PGXCNodeMirrorCount[pgxc_node_id - 1]); /* Check also that preferred node is online */ if (PreferredMirrorId != 0) { if (IsXCM && !XCM_IS_FAULT(PGXCMirror_CheckStatus(REMOTE_CONN_DATANODE, - pgxc_node_id, PreferredMirrorId))) + pgxc_node_id, preferred_mirror_id))) { done = true; - list_mirrors = lappend_int(list_mirrors, sum + PreferredMirrorId); + list_mirrors = lappend_int(list_mirrors, sum + preferred_mirror_id); } else if (!IsXCM) { /* In mirror mode without XCM active, we suppose the mirror is online */ done = true; - list_mirrors = lappend_int(list_mirrors, sum + PreferredMirrorId); + list_mirrors = lappend_int(list_mirrors, sum + preferred_mirror_id); } } @@ -363,12 +421,13 @@ PGXCMirror_GetPrimaryMirrorNum(int primary_data_node) { int count; int sum = 0; + int primary_mirror_id = IsXCM ? PGXCMirror_GetPrimaryMirrorID() : PrimaryMirrorId; /* Determine number of Primary Node in the Global Array of Datanodes */ for (count = 0; count < primary_data_node - 1; count++) sum += PGXCNodeMirrorCount[count]; - return sum + PrimaryMirrorId; + return sum + primary_mirror_id; } /* @@ -1001,34 +1060,4 @@ PGXCMirror_GetConnPoint(RemoteConnTypes conn_type, return conn_pts; } -/* - * PGXCMirror_GetPreferredNode - * - * Get preferred Datanode number for given Coordinator - * Preferred Datanode means one node, identified by the couple Datanode ID/Mirror ID - */ -int -PGXCMirror_GetPreferredNode(int pgxc_node_id, int *mirror_id) -{ - int datanode_id = 0; - Assert(IS_PGXC_COORDINATOR); - - if (get_xcm_preferred_mirror(pgxc_node_id, &datanode_id, mirror_id)) - ereport(ERROR, - (errcode(ERRCODE_INTERNAL_ERROR), - errmsg("Fault Sync ERROR: could not get preferred node data"))); - - return datanode_id; -} -/* - * PGXCMirror_GetLocalPreferredNode - * - * Get Preferred Mirror for local Coordinator - */ -int -PGXCMirror_GetLocalPreferredNode(int *mirror_id) -{ - Assert(IS_PGXC_COORDINATOR); - return PGXCMirror_GetPreferredNode(PGXCNodeId, mirror_id); -} diff --git a/src/include/pgxc/mirror.h b/src/include/pgxc/mirror.h index 5428fb1..f0dbd83 100644 --- a/src/include/pgxc/mirror.h +++ b/src/include/pgxc/mirror.h @@ -32,8 +32,12 @@ extern char *MirrorCount; extern bool IsPrimaryMirror; extern int PGXCMirrorId; +/* Get Primary and preferred parameters from XCM */ +extern int PGXCMirror_GetPrimaryDatanodeID(void); +extern int PGXCMirror_GetPrimaryMirrorID(void); +extern int PGXCMirror_GetPreferredNodeID(bool is_datanode); + /* Set or Get parameters explicit to mirror mode */ -extern void PGXCMirror_SetNodePrimary(void); extern int PGXCMirror_SetMirrorCountList(void); extern int PGXCMirror_GetMirrorTotalCount(void); extern int PGXCMirror_GetMirrorCount(int pgxc_node_id); @@ -86,7 +90,4 @@ extern xcm_connPoint* PGXCMirror_GetConnPoint(RemoteConnTypes conn_type, int mirror_id, int *n_connections); -extern int PGXCMirror_GetPreferredNode(int pgxc_node_id, int *mirror_id); -extern int PGXCMirror_GetLocalPreferredNode(int *mirror_id); - #endif /* MIRROR_H */ ----------------------------------------------------------------------- Summary of changes: src/backend/commands/copy.c | 32 +++++++++- src/backend/pgxc/locator/locator.c | 23 ++++--- src/backend/pgxc/pool/mirror.c | 119 ++++++++++++++++++++++-------------- src/include/pgxc/mirror.h | 9 ++- 4 files changed, 120 insertions(+), 63 deletions(-) hooks/post-receive -- Postgres-XC |
From: Michael P. <mic...@us...> - 2011-02-23 05:46:11
|
Project "Postgres-XC". The branch, ha_support has been updated via 101c354db37e5642023f80467fd19849b147d644 (commit) via b260079109da14ed446f18eb008fe6b873a322f0 (commit) from 2d3b90de7d334184f5be3e6ae5faeaa34b4ab7d6 (commit) - Log ----------------------------------------------------------------- commit 101c354db37e5642023f80467fd19849b147d644 Merge: 2d3b90d b260079 Author: Michael P <mic...@us...> Date: Wed Feb 23 14:52:22 2011 +0900 Merge branch 'master' into ha_support ----------------------------------------------------------------------- Summary of changes: src/backend/pgxc/pool/poolmgr.c | 4 ++-- src/backend/tcop/utility.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) hooks/post-receive -- Postgres-XC |
From: Michael P. <mic...@us...> - 2011-02-23 04:37:19
|
Project "Postgres-XC". The branch, master has been updated via b260079109da14ed446f18eb008fe6b873a322f0 (commit) from 69838d0f61e1599983d5036ffcc30bcc5166af79 (commit) - Log ----------------------------------------------------------------- commit b260079109da14ed446f18eb008fe6b873a322f0 Author: Michael P <mic...@us...> Date: Wed Feb 23 13:41:59 2011 +0900 Fix for DROP DATABASE If a database pool is not found in pooler when cleaning connections, consider it as already clean. When dropping a database, connection clean is made only in the local node. diff --git a/src/backend/pgxc/pool/poolmgr.c b/src/backend/pgxc/pool/poolmgr.c index fb9ca00..fc8be2f 100644 --- a/src/backend/pgxc/pool/poolmgr.c +++ b/src/backend/pgxc/pool/poolmgr.c @@ -1920,9 +1920,9 @@ clean_connection(List *dn_discard, List *co_discard, const char *database) /* Find correct Database pool to clean */ databasePool = find_database_pool(database); - /* Database pool has not been found */ + /* Database pool has not been found, it is already clean */ if (!databasePool) - return CLEAN_CONNECTION_NOT_COMPLETED; + return CLEAN_CONNECTION_COMPLETED; /* * Clean each Pool Correctly diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c index b8c7b0d..90c1f81 100644 --- a/src/backend/tcop/utility.c +++ b/src/backend/tcop/utility.c @@ -1073,8 +1073,8 @@ ProcessUtility(Node *parsetree, DropdbStmt *stmt = (DropdbStmt *) parsetree; #ifdef PGXC - /* Clean connections before dropping a database */ - if (IS_PGXC_COORDINATOR && !IsConnFromCoord()) + /* Clean connections before dropping a database on local node */ + if (IS_PGXC_COORDINATOR) DropDBCleanConnection(stmt->dbname); #endif ----------------------------------------------------------------------- Summary of changes: src/backend/pgxc/pool/poolmgr.c | 4 ++-- src/backend/tcop/utility.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) hooks/post-receive -- Postgres-XC |