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

Commit 3cd6f2f

Browse files
committed
Fix PGPRO-717: correctly store table name and schema in mtm_make_table_local
1 parent 57564b3 commit 3cd6f2f

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

contrib/mmts/multimaster.c

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

22752275

2276-
static int MtmGetNumberOfVotingNodes()
2276+
static int MtmGetNumberOfVotingNodes(nodemask_t clique)
22772277
{
22782278
int i;
22792279
int nVotingNodes = Mtm->nAllNodes;
2280-
notebask_t deadNodeMask = Mtm->deadNodeMask;
2280+
nodemask_t deadNodeMask = Mtm->deadNodeMask;
22812281
for (i = 0; deadNodeMask != 0; i++) {
22822282
if (BIT_CHECK(deadNodeMask, i)) {
2283-
if (!BIT_CHECK(newClique, i)) {
2283+
if (!BIT_CHECK(clique, i)) {
22842284
nVotingNodes -= 1;
22852285
}
22862286
BIT_CLEAR(deadNodeMask, i);
@@ -2299,7 +2299,7 @@ void MtmRefreshClusterStatus()
22992299
nodemask_t matrix[MAX_NODES];
23002300
int cliqueSize;
23012301
nodemask_t oldClique = ~Mtm->disabledNodeMask & (((nodemask_t)1 << Mtm->nAllNodes)-1);
2302-
int nVotingNodes;
2302+
int i, nVotingNodes;
23032303

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

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

23902391
if (Mtm->nLiveNodes >= nVotingNodes/2+1 || (Mtm->nLiveNodes == (nVotingNodes+1)/2 && MtmMajorNode)) { /* have quorum */
23912392
if (Mtm->status == MTM_IN_MINORITY) {
@@ -4383,8 +4384,8 @@ Datum mtm_make_table_local(PG_FUNCTION_ARGS)
43834384
rv = makeRangeVar(MULTIMASTER_SCHEMA_NAME, MULTIMASTER_LOCAL_TABLES_TABLE, -1);
43844385
rel = heap_openrv(rv, RowExclusiveLock);
43854386
if (rel != NULL) {
4386-
char* tableName = RelationGetRelationName(rel);
4387-
Oid schemaid = RelationGetNamespace(rel);
4387+
char* tableName = get_rel_name(reloid);
4388+
Oid schemaid = get_rel_namespace(reloid);
43884389
char* schemaName = get_namespace_name(schemaid);
43894390

43904391
tupDesc = RelationGetDescr(rel);

0 commit comments

Comments
 (0)