Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0350ae6

Browse files
knizhnikkelvich
authored andcommitted
Fix PGPRO-717: correctly store table name and schema in mtm_make_table_local
1 parent d2097bb commit 0350ae6

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

multimaster.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2274,14 +2274,14 @@ MtmBuildConnectivityMatrix(nodemask_t* matrix)
22742274
}
22752275

22762276

2277-
static int MtmGetNumberOfVotingNodes()
2277+
static int MtmGetNumberOfVotingNodes(nodemask_t clique)
22782278
{
22792279
int i;
22802280
int nVotingNodes = Mtm->nAllNodes;
2281-
notebask_t deadNodeMask = Mtm->deadNodeMask;
2281+
nodemask_t deadNodeMask = Mtm->deadNodeMask;
22822282
for (i = 0; deadNodeMask != 0; i++) {
22832283
if (BIT_CHECK(deadNodeMask, i)) {
2284-
if (!BIT_CHECK(newClique, i)) {
2284+
if (!BIT_CHECK(clique, i)) {
22852285
nVotingNodes -= 1;
22862286
}
22872287
BIT_CLEAR(deadNodeMask, i);
@@ -2300,7 +2300,7 @@ void MtmRefreshClusterStatus()
23002300
nodemask_t matrix[MAX_NODES];
23012301
int cliqueSize;
23022302
nodemask_t oldClique = ~Mtm->disabledNodeMask & (((nodemask_t)1 << Mtm->nAllNodes)-1);
2303-
int nVotingNodes;
2303+
int i, nVotingNodes;
23042304

23052305
MtmBuildConnectivityMatrix(matrix);
23062306
newClique = MtmFindMaxClique(matrix, Mtm->nAllNodes, &cliqueSize);
@@ -2321,7 +2321,7 @@ void MtmRefreshClusterStatus()
23212321
newClique = MtmFindMaxClique(matrix, Mtm->nAllNodes, &cliqueSize);
23222322
} while (newClique != oldClique);
23232323

2324-
nVotingNodes = MtmGetNumberOfVotingNodes();
2324+
nVotingNodes = MtmGetNumberOfVotingNodes(newClique);
23252325
if (cliqueSize >= nVotingNodes/2+1 || (cliqueSize == (nVotingNodes+1)/2 && MtmMajorNode)) { /* have quorum */
23262326
fprintf(stderr, "Old mask: ");
23272327
for (i = 0; i < Mtm->nAllNodes; i++) {
@@ -2386,7 +2386,8 @@ void MtmRefreshClusterStatus()
23862386
*/
23872387
void MtmCheckQuorum(void)
23882388
{
2389-
int nVotingNodes = MtmGetNumberOfVotingNodes();
2389+
nodemask_t oldClique = ~Mtm->disabledNodeMask & (((nodemask_t)1 << Mtm->nAllNodes)-1);
2390+
int nVotingNodes = MtmGetNumberOfVotingNodes(oldClique);
23902391

23912392
if (Mtm->nLiveNodes >= nVotingNodes/2+1 || (Mtm->nLiveNodes == (nVotingNodes+1)/2 && MtmMajorNode)) { /* have quorum */
23922393
if (Mtm->status == MTM_IN_MINORITY) {
@@ -4397,8 +4398,8 @@ Datum mtm_make_table_local(PG_FUNCTION_ARGS)
43974398
rv = makeRangeVar(MULTIMASTER_SCHEMA_NAME, MULTIMASTER_LOCAL_TABLES_TABLE, -1);
43984399
rel = heap_openrv(rv, RowExclusiveLock);
43994400
if (rel != NULL) {
4400-
char* tableName = RelationGetRelationName(rel);
4401-
Oid schemaid = RelationGetNamespace(rel);
4401+
char* tableName = get_rel_name(reloid);
4402+
Oid schemaid = get_rel_namespace(reloid);
44024403
char* schemaName = get_namespace_name(schemaid);
44034404

44044405
tupDesc = RelationGetDescr(rel);

0 commit comments

Comments
 (0)