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

Commit6fae8cd

Browse files
committed
add mtm.poll_node function
1 parentc9e0dd8 commit6fae8cd

File tree

4 files changed

+29
-2
lines changed

4 files changed

+29
-2
lines changed

‎contrib/mmts/check-recovery.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
rm -rf /home/knizhnik/postgres_cluster/contrib/mmts/tmp_check/log
1+
rm -rf /home/knizhnik/postgres_cluster/contrib/mmts/tmp_check
22
TESTDIR='/home/knizhnik/postgres_cluster/contrib/mmts' PATH="/home/knizhnik/postgres_cluster/tmp_install/home/knizhnik/postgres_cluster/dist/bin:$PATH" LD_LIBRARY_PATH="/home/knizhnik/postgres_cluster/tmp_install/home/knizhnik/postgres_cluster/dist/lib:$LD_LIBRARY_PATH" PGPORT='65432' PG_REGRESS='/home/knizhnik/postgres_cluster/contrib/mmts/../../src/test/regress/pg_regress' prove -I ../../src/test/perl/ --verbose t/001_basic_recovery.pl

‎contrib/mmts/multimaster--1.0.sql‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ CREATE FUNCTION mtm.dump_lock_graph() RETURNS text
4444
AS'MODULE_PATHNAME','mtm_dump_lock_graph'
4545
LANGUAGE C;
4646

47+
CREATEFUNCTIONmtm.poll_node(nodeIdinteger, noWaitboolean default FALSE) RETURNSboolean
48+
AS'MODULE_PATHNAME','mtm_poll_node'
49+
LANGUAGE C;
50+
4751
CREATETABLEIF NOT EXISTSmtm.ddl_log (issuedtimestamp with time zonenot null, querytext);
4852

4953
CREATETABLEIF NOT EXISTSmtm.local_tables(rel_schematext, rel_nametext,primary key(rel_schema, rel_name));

‎contrib/mmts/multimaster.c‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ PG_MODULE_MAGIC;
103103
PG_FUNCTION_INFO_V1(mtm_start_replication);
104104
PG_FUNCTION_INFO_V1(mtm_stop_replication);
105105
PG_FUNCTION_INFO_V1(mtm_drop_node);
106+
PG_FUNCTION_INFO_V1(mtm_poll_node);
106107
PG_FUNCTION_INFO_V1(mtm_recover_node);
107108
PG_FUNCTION_INFO_V1(mtm_get_snapshot);
108109
PG_FUNCTION_INFO_V1(mtm_get_nodes_state);
@@ -2069,6 +2070,27 @@ mtm_drop_node(PG_FUNCTION_ARGS)
20692070
PG_RETURN_VOID();
20702071
}
20712072

2073+
Datum
2074+
mtm_poll_node(PG_FUNCTION_ARGS)
2075+
{
2076+
intnodeId=PG_GETARG_INT32(0);
2077+
boolnowait=PG_GETARG_BOOL(1);
2078+
boolonline= true;
2079+
while (BIT_CHECK(Mtm->disabledNodeMask,nodeId-1)) {
2080+
if (nowait) {
2081+
online= false;
2082+
break;
2083+
}else {
2084+
MtmSleep(STATUS_POLL_DELAY);
2085+
}
2086+
}
2087+
if (!nowait) {
2088+
/* Just wait some time until logical repication channels will be reestablished */
2089+
MtmSleep(MtmNodeDisableDelay);
2090+
}
2091+
PG_RETURN_BOOL(online);
2092+
}
2093+
20722094
Datum
20732095
mtm_recover_node(PG_FUNCTION_ARGS)
20742096
{

‎contrib/mmts/t/001_basic_recovery.pl‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@
6060
diag("starting node 2");
6161
$cluster->{nodes}->[2]->start;
6262
diag("sleeping 10");
63-
sleep(10);# XXX: here we can poll
63+
#sleep(10); # XXX: here we can poll
64+
$cluster->psql(0,'postgres',"select mtm.poll_node(3);");
6465
diag("inserting 3");
6566
$cluster->psql(0,'postgres',"insert into t values(3, 30);");
6667
diag("selecting");

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp