Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit44e3d9d

Browse files
kvapkelvich
authored andcommitted
Add config sanity check in mmts.
1 parent793adae commit44e3d9d

File tree

2 files changed

+70
-10
lines changed

2 files changed

+70
-10
lines changed

‎multimaster.c

Lines changed: 67 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1935,6 +1935,68 @@ static void MtmSplitConnStrs(void)
19351935
pfree(copy);
19361936
}
19371937

1938+
staticboolConfigIsSane(void)
1939+
{
1940+
boolok= true;
1941+
1942+
if (DefaultXactIsoLevel!=XACT_REPEATABLE_READ)
1943+
{
1944+
elog(WARNING,"multimaster requires default_transaction_isolation = 'repeatable read'");
1945+
ok= false;
1946+
}
1947+
1948+
if (MtmMaxNodes<1)
1949+
{
1950+
elog(WARNING,"multimaster requires multimaster.max_nodes > 0");
1951+
ok= false;
1952+
}
1953+
1954+
if (max_prepared_xacts<1)
1955+
{
1956+
elog(WARNING,
1957+
"multimaster requires max_prepared_transactions > 0, "
1958+
"because all transactions are implicitly two-phase");
1959+
ok= false;
1960+
}
1961+
1962+
{
1963+
intworkers_required=2*MtmMaxNodes+MtmWorkers+1;
1964+
if (max_worker_processes<workers_required)
1965+
{
1966+
elog(WARNING,
1967+
"multimaster requires max_worker_processes >= %d",
1968+
workers_required);
1969+
ok= false;
1970+
}
1971+
}
1972+
1973+
if (wal_level!=WAL_LEVEL_LOGICAL)
1974+
{
1975+
elog(WARNING,
1976+
"multimaster requires wal_level = 'logical', "
1977+
"because it is build on top of logical replication");
1978+
ok= false;
1979+
}
1980+
1981+
if (max_wal_senders<MtmMaxNodes)
1982+
{
1983+
elog(WARNING,
1984+
"multimaster requires max_wal_senders >= %d (multimaster.max_nodes), ",
1985+
MtmMaxNodes);
1986+
ok= false;
1987+
}
1988+
1989+
if (max_replication_slots<MtmMaxNodes)
1990+
{
1991+
elog(WARNING,
1992+
"multimaster requires max_replication_slots >= %d (multimaster.max_nodes), ",
1993+
MtmMaxNodes);
1994+
ok= false;
1995+
}
1996+
1997+
returnok;
1998+
}
1999+
19382000
void
19392001
_PG_init(void)
19402002
{
@@ -2274,18 +2336,15 @@ _PG_init(void)
22742336
NULL
22752337
);
22762338

2277-
if (DefaultXactIsoLevel!=XACT_REPEATABLE_READ) {
2278-
elog(ERROR,"Multimaster requires repeatable read default isolation level");
2279-
}
2280-
#if0
2281-
if (synchronous_commit!=SYNCHRONOUS_COMMIT_ON) {
2282-
elog(ERROR,"Multimaster requires synchronous commit on");
2339+
if (!ConfigIsSane()) {
2340+
elog(ERROR,"Multimaster config is insane, refusing to work");
22832341
}
2284-
#endif
22852342

2343+
/* This will also perform some checks on connection strings */
22862344
MtmSplitConnStrs();
2345+
22872346
MtmStartReceivers();
2288-
2347+
22892348
/*
22902349
* Request additional shared resources. (These are no-ops if we're not in
22912350
* the postmaster process.) We'll allocate or attach to the shared

‎tests/daemons.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,13 @@ func postgres(bin string, datadir string, postgresi []string, port int, nodeid i
112112
"-c","max_connections=200",
113113
"-c","max_replication_slots=10",
114114
"-c","max_wal_senders=10",
115-
"-c","max_worker_processes=100",
116-
"-c","max_prepared_transactions=200",
115+
"-c","max_worker_processes=11",
116+
"-c","max_prepared_transactions=10",
117117
"-c","default_transaction_isolation=repeatable read",
118118
"-c","multimaster.conn_strings="+strings.Join(postgresi,","),
119119
"-c","multimaster.node_id="+strconv.Itoa(nodeid+1),
120120
"-c","multimaster.queue_size=52857600",
121+
"-c","multimaster.max_nodes=3",
121122
"-c","multimaster.workers=4",
122123
"-c","multimaster.use_raftable=true",
123124
"-c","multimaster.ignore_tables_without_pk=1",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp