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

Commit c1b55de

Browse files
committed
multidb refactor: change ddl handling to be a separate file with it own private data structures
1 parent f490623 commit c1b55de

16 files changed

+1400
-1207
lines changed

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ RUN export USE_PGXS=1 && \
1313
RUN cp /pg/src/src/test/regress/*.so /pg/install/lib/postgresql/
1414
USER postgres
1515
ENV PGDATA /pg/data
16-
ENTRYPOINT ["/pg/mmts/tests2/docker-entrypoint.sh"]
16+
ENTRYPOINT ["/pg/mmts/tests/docker-entrypoint.sh"]
1717

1818
EXPOSE 5432
1919
CMD ["postgres"]

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ OBJS = src/multimaster.o src/dmq.o src/commit.o src/bytebuf.o src/bgwpool.o \
55
src/pglogical_output.o src/pglogical_proto.o src/pglogical_receiver.o \
66
src/pglogical_apply.o src/pglogical_hooks.o src/pglogical_config.o \
77
src/pglogical_relid_map.o src/ddd.o src/bkb.o src/spill.o src/state.o \
8-
src/resolver.o
8+
src/resolver.o src/ddl.o
99
MODULE_big = multimaster
1010

1111
ifdef USE_PGXS

multimaster--1.0.sql

+6-6
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,13 @@ CREATE FUNCTION mtm.make_table_local(relation regclass) RETURNS void
117117
AS 'MODULE_PATHNAME','mtm_make_table_local'
118118
LANGUAGE C;
119119

120-
CREATE FUNCTION mtm.broadcast_table(source_table regclass) RETURNS void
121-
AS 'MODULE_PATHNAME','mtm_broadcast_table'
122-
LANGUAGE C;
120+
-- CREATE FUNCTION mtm.broadcast_table(source_table regclass) RETURNS void
121+
-- AS 'MODULE_PATHNAME','mtm_broadcast_table'
122+
-- LANGUAGE C;
123123

124-
CREATE FUNCTION mtm.copy_table(source_table regclass, target_node_id integer) RETURNS void
125-
AS 'MODULE_PATHNAME','mtm_copy_table'
126-
LANGUAGE C;
124+
-- CREATE FUNCTION mtm.copy_table(source_table regclass, target_node_id integer) RETURNS void
125+
-- AS 'MODULE_PATHNAME','mtm_copy_table'
126+
-- LANGUAGE C;
127127

128128
CREATE FUNCTION mtm.dump_lock_graph() RETURNS text
129129
AS 'MODULE_PATHNAME','mtm_dump_lock_graph'

reinit-mm.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ n_nodes=3
1111
ulimit -c unlimited
1212
pkill -9 postgres
1313

14-
cd $BASEDIR
15-
make install
14+
# cd $BASEDIR
15+
# make install
1616

1717
cd $BASEDIR/contrib/mmts
1818
make clean && make install

src/bkb.c

+6-4
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@ typedef struct {
1010
int nodes[MAX_NODES];
1111
} NodeList;
1212

13-
static void list_append(NodeList* list, int n)
13+
static void
14+
_list_append(NodeList* list, int n)
1415
{
1516
list->nodes[list->size++] = n;
1617
}
1718

18-
static void list_copy(NodeList* dst, NodeList const* src)
19+
static void
20+
_list_copy(NodeList* dst, NodeList const* src)
1921
{
2022
int i;
2123
int n = src->size;
@@ -80,10 +82,10 @@ static void findMaximumIndependentSet(NodeList* cur, NodeList* result, nodemask_
8082
newSet[newce++] = oldSet[i];
8183
}
8284
}
83-
list_append(cur, sel);
85+
_list_append(cur, sel);
8486
if (newce == 0) {
8587
if (result->size < cur->size) {
86-
list_copy(result, cur);
88+
_list_copy(result, cur);
8789
}
8890
} else if (newne < newce) {
8991
if (cur->size + newce - newne > result->size) {

src/commit.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@
1010
*/
1111

1212
#include "postgres.h"
13-
#include "multimaster.h"
1413
#include "storage/proc.h"
1514
#include "utils/guc.h"
1615
#include "miscadmin.h"
1716
#include "commands/dbcommands.h"
1817
#include "tcop/tcopprot.h"
1918

19+
#include "multimaster.h"
2020
#include "logger.h"
21+
#include "ddl.h"
2122

2223
static Oid MtmDatabaseId;
2324
static bool DmqSubscribed;
@@ -64,6 +65,7 @@ MtmBeginTransaction(MtmCurrentTrans* x)
6465
x->containsDML = false; // will be set by executor hook
6566
x->isTransactionBlock = IsTransactionBlock();
6667

68+
MtmDDLResetStatement();
6769

6870
/* XXX: ugly hack with debug_query_string */
6971

0 commit comments

Comments
 (0)