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

Commit 377cf38

Browse files
committed
Merge branch 'PGPROEE10_MULTIMASTER' into PGPROEE10
2 parents aa934db + 47d8dd0 commit 377cf38

File tree

6 files changed

+49
-9
lines changed

6 files changed

+49
-9
lines changed

Dockerfile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@ ENV PATH /pg/install/bin:$PATH
1212

1313
COPY ./ /pg/src
1414

15-
# crutch to allow regression test to write there
16-
RUN mkdir -p /pg/src/src/test/regress/results && \
17-
chown postgres:postgres /pg/src/src/test/regress/results
18-
1915
RUN cd /pg/src && \
2016
./configure --enable-cassert --enable-debug --prefix=/pg/install && \
2117
make -j 4 install
2218

19+
# crutch to allow regression test to write there
20+
RUN chown -R postgres:postgres /pg/src/src/test/regress

contrib/mmts/multimaster.c

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include "executor/executor.h"
4343
#include "access/twophase.h"
4444
#include "utils/guc.h"
45+
#include "utils/guc_tables.h"
4546
#include "utils/hsearch.h"
4647
#include "utils/timeout.h"
4748
#include "utils/tqual.h"
@@ -4913,6 +4914,34 @@ static void MtmGucSet(VariableSetStmt *stmt, const char *queryStr)
49134914
MemoryContextSwitchTo(oldcontext);
49144915
}
49154916

4917+
static int
4918+
_var_name_cmp(const void *a, const void *b)
4919+
{
4920+
const struct config_generic *confa = *(struct config_generic * const *) a;
4921+
const struct config_generic *confb = *(struct config_generic * const *) b;
4922+
4923+
return strcmp(confa->name, confb->name);
4924+
}
4925+
4926+
static struct config_generic *
4927+
fing_guc_conf(const char *name)
4928+
{
4929+
int num;
4930+
struct config_generic **vars;
4931+
const char **key = &name;
4932+
struct config_generic **res;
4933+
4934+
num = GetNumConfigOptions();
4935+
vars = get_guc_variables();
4936+
4937+
res = (struct config_generic **) bsearch((void *) &key,
4938+
(void *) vars,
4939+
num, sizeof(struct config_generic *),
4940+
_var_name_cmp);
4941+
4942+
return res ? *res : NULL;
4943+
}
4944+
49164945
char* MtmGucSerialize(void)
49174946
{
49184947
StringInfo serialized_gucs;
@@ -4927,6 +4956,7 @@ char* MtmGucSerialize(void)
49274956
dlist_foreach(iter, &MtmGucList)
49284957
{
49294958
MtmGucEntry *cur_entry = dlist_container(MtmGucEntry, list_node, iter.cur);
4959+
struct config_generic *gconf;
49304960

49314961
if (strcmp(cur_entry->key, "search_path") == 0)
49324962
continue;
@@ -4935,8 +4965,8 @@ char* MtmGucSerialize(void)
49354965
appendStringInfoString(serialized_gucs, cur_entry->key);
49364966
appendStringInfoString(serialized_gucs, " TO ");
49374967

4938-
/* quite a crutch */
4939-
if (strstr(cur_entry->key, "_mem") != NULL || *(cur_entry->value) == '\0')
4968+
gconf = fing_guc_conf(cur_entry->key);
4969+
if (gconf && (gconf->vartype == PGC_STRING || gconf->flags & (GUC_UNIT_MEMORY | GUC_UNIT_TIME)))
49404970
{
49414971
appendStringInfoString(serialized_gucs, "'");
49424972
appendStringInfoString(serialized_gucs, cur_entry->value);

contrib/mmts/pglogical_proto.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ pglogical_write_prepare(StringInfo out, PGLogicalOutputData *data,
485485
uint8 event = *txn->state_3pc ? PGLOGICAL_PRECOMMIT_PREPARED : PGLOGICAL_PREPARE;
486486

487487
/* COMMIT and PREPARE are preceded by BEGIN, which set MtmIsFilteredTxn flag */
488-
if (MtmIsFilteredTxn)
488+
if (MtmIsFilteredTxn && event == PGLOGICAL_PREPARE)
489489
return;
490490

491491
/* send the event fields */

contrib/mmts/tests/reinit-mm.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,14 @@ do
7777
multimaster.arbiter_port = $arbiter_port
7878
multimaster.max_recovery_lag = 30GB
7979
multimaster.referee_connstring = 'dbname=$USER host=127.0.0.1 port=5440 sslmode=disable'
80-
#multimaster.preserve_commit_order=false
8180
SQL
82-
cp pg_hba.conf tmp_check/node$i
81+
82+
cat <<CONF >> tmp_check/node$i/pg_hba.conf
83+
host all all 0.0.0.0/0 trust
84+
host replication all 0.0.0.0/0 trust
85+
CONF
86+
87+
# cp pg_hba.conf tmp_check/node$i
8388
pg_ctl -w -D tmp_check/node$i -l node$i.log start
8489
done
8590

contrib/mmts/tests2/docker-entrypoint.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ if [ "$1" = 'postgres' ]; then
6868
multimaster.max_recovery_lag = 1GB
6969
multimaster.min_recovery_lag = 10kB
7070
multimaster.preserve_commit_order = on
71+
72+
multimaster.volkswagen_mode = on
73+
multimaster.ignore_tables_without_pk = on
74+
partition_backend = 'internal'
7175
EOF
7276

7377
if [ -n "$NODE_ID" ]; then

src/backend/replication/logical/decode.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,9 @@ DecodePrepare(LogicalDecodingContext *ctx, XLogRecordBuffer *buf,
673673
ReorderBufferXidSetCatalogChanges(ctx->reorder, xid, buf->origptr);
674674
}
675675

676+
SnapBuildCommitTxn(ctx->snapshot_builder, buf->origptr, xid,
677+
parsed->nsubxacts, parsed->subxacts);
678+
676679
if (SnapBuildXactNeedsSkip(ctx->snapshot_builder, buf->origptr) ||
677680
(parsed->dbId != InvalidOid && parsed->dbId != ctx->slot->data.database) ||
678681
FilterByOrigin(ctx, origin_id))

0 commit comments

Comments
 (0)