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

Commit c8a9610

Browse files
committed
Merge branch 'PGPROEE9_6_MULTIMASTER' of gitlab.postgrespro.ru:pgpro-dev/postgrespro into PGPROEE9_6_MULTIMASTER
2 parents 6750a00 + a1aeea6 commit c8a9610

23 files changed

+1794
-1124
lines changed

contrib/mmts/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
EXTENSION = multimaster
33
DATA = multimaster--1.0.sql
4-
OBJS = multimaster.o arbiter.o bytebuf.o bgwpool.o pglogical_output.o pglogical_proto.o pglogical_receiver.o pglogical_apply.o pglogical_hooks.o pglogical_config.o pglogical_relid_map.o ddd.o bkb.o spill.o
4+
OBJS = multimaster.o arbiter.o bytebuf.o bgwpool.o pglogical_output.o pglogical_proto.o pglogical_receiver.o pglogical_apply.o pglogical_hooks.o pglogical_config.o pglogical_relid_map.o ddd.o bkb.o spill.o referee.o
55
MODULE_big = multimaster
66

77
PG_CPPFLAGS = -I$(libpq_srcdir)

contrib/mmts/arbiter.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,12 @@ static int MtmConnectSocket(int node, int port)
467467
MTM_ELOG(WARNING, "Arbiter trying to connect to %s:%d: %s", host, port, strerror(errcode));
468468
goto Error;
469469
}
470-
} else {
471-
MTM_ELOG(WARNING, "Arbiter waiting socket to %s:%d: %s", host, port, strerror(errno));
470+
} else if (rc == 0) {
471+
MTM_ELOG(WARNING, "Arbiter failed to connect to socket to %s:%d within specified timeout", host, port);
472+
goto Error;
473+
} else {
474+
MTM_ELOG(WARNING, "Arbiter failed to wait socket to %s:%d: %s", host, port, strerror(errno));
475+
goto Error;
472476
}
473477
}
474478
else if (rc != 0) {

contrib/mmts/bkb.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ typedef ulong64 nodemask_t;
1414
#define BIT_CHECK(mask, bit) (((mask) & ((nodemask_t)1 << (bit))) != 0)
1515
#define BIT_CLEAR(mask, bit) (mask &= ~((nodemask_t)1 << (bit)))
1616
#define BIT_SET(mask, bit) (mask |= ((nodemask_t)1 << (bit)))
17+
#define ALL_BITS ((nodemask_t)~0)
1718

1819
extern nodemask_t MtmFindMaxClique(nodemask_t* matrix, int n_modes, int* clique_size);
1920

contrib/mmts/multimaster--1.0.sql

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ AS 'MODULE_PATHNAME','mtm_get_nodes_state'
5151
LANGUAGE C;
5252

5353
CREATE TYPE mtm.cluster_state AS ("id" integer, "status" text, "disabledNodeMask" bigint, "disconnectedNodeMask" bigint, "catchUpNodeMask" bigint, "liveNodes" integer, "allNodes" integer, "nActiveQueries" integer, "nPendingQueries" integer, "queueSize" bigint, "transCount" bigint, "timeShift" bigint, "recoverySlot" integer,
54-
"xidHashSize" bigint, "gidHashSize" bigint, "oldestXid" bigint, "configChanges" integer, "stalledNodeMask" bigint, "stoppedNodeMask" bigint, "lastStatusChange" timestamp);
54+
"xidHashSize" bigint, "gidHashSize" bigint, "oldestXid" bigint, "configChanges" integer, "stalledNodeMask" bigint, "stoppedNodeMask" bigint, "deadNodeMask" bigint, "lastStatusChange" timestamp);
5555

5656
CREATE TYPE mtm.trans_state AS ("status" text, "gid" text, "xid" bigint, "coordinator" integer, "gxid" bigint, "csn" timestamp, "snapshot" timestamp, "local" boolean, "prepared" boolean, "active" boolean, "twophase" boolean, "votingCompleted" boolean, "participants" bigint, "voted" bigint, "configChanges" integer);
5757

@@ -75,6 +75,14 @@ CREATE FUNCTION mtm.make_table_local(relation regclass) RETURNS void
7575
AS 'MODULE_PATHNAME','mtm_make_table_local'
7676
LANGUAGE C;
7777

78+
CREATE FUNCTION mtm.broadcast_table(srcTable regclass, dstNodesMask bigint) RETURNS void
79+
AS 'MODULE_PATHNAME','mtm_broadcast_table'
80+
LANGUAGE C;
81+
82+
CREATE FUNCTION mtm.copy_table(srcTable regclass, dstNode integer) RETURNS void
83+
AS 'MODULE_PATHNAME','mtm_copy_table'
84+
LANGUAGE C;
85+
7886
CREATE FUNCTION mtm.dump_lock_graph() RETURNS text
7987
AS 'MODULE_PATHNAME','mtm_dump_lock_graph'
8088
LANGUAGE C;
@@ -91,6 +99,10 @@ CREATE FUNCTION mtm.check_deadlock(xid bigint) RETURNS boolean
9199
AS 'MODULE_PATHNAME','mtm_check_deadlock'
92100
LANGUAGE C;
93101

102+
CREATE FUNCTION mtm.referee_poll(xid bigint) RETURNS bigint
103+
AS 'MODULE_PATHNAME','mtm_referee_poll'
104+
LANGUAGE C;
105+
94106
CREATE TABLE IF NOT EXISTS mtm.local_tables(rel_schema text, rel_name text, primary key(rel_schema, rel_name));
95107

96108
CREATE OR REPLACE FUNCTION mtm.alter_sequences() RETURNS boolean AS

0 commit comments

Comments
 (0)