Skip to content

Commit f48a003

Browse files
markhannumakshatsikarwar
authored andcommitted
register_replicant filters inactive nodes
Signed-off-by: Mark Hannum <[email protected]>
1 parent 404ca15 commit f48a003

File tree

4 files changed

+120
-73
lines changed

4 files changed

+120
-73
lines changed

lua/lib/physrep_register_replicant.lua

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ local function main(dbname, hostname, lsn, source_dbname, source_hosts)
5959
" WHERE p.source_dbname = t.dbname AND p.source_host = t.host " ..
6060
" AND p.dbname = c.dbname AND p.host = c.host " ..
6161
" AND (c.file >= " .. pfile .. " AND " ..
62-
" (c.firstfile IS NULL OR c.firstfile <= " .. pfile .. "))), " ..
62+
" (c.firstfile IS NULL OR c.firstfile <= " .. pfile .. "))" ..
63+
" AND (c.last_keepalive > (NOW() - cast (600 as sec)))), " ..
6364
" child_count (dbname, host, tier, cnt) AS " ..
6465
" (SELECT t.dbname, t.host, t.tier, count (*) c" ..
6566
" FROM tiers t LEFT OUTER JOIN comdb2_physrep_connections p " ..
@@ -78,8 +79,10 @@ local function main(dbname, hostname, lsn, source_dbname, source_hosts)
7879
" host IN (" .. source_hosts ..") " ..
7980
" UNION ALL " ..
8081
" SELECT p.dbname, p.host, t.tier+1 " ..
81-
" FROM comdb2_physrep_connections p, tiers t " ..
82-
" WHERE p.source_dbname = t.dbname AND p.source_host = t.host), " ..
82+
" FROM comdb2_physrep_connections p, tiers t, comdb2_physreps c" ..
83+
" WHERE p.source_dbname = t.dbname AND p.source_host = t.host" ..
84+
" AND p.dbname = c.dbname AND p.host = c.host " ..
85+
" AND (c.last_keepalive > (NOW() - cast (600 as sec)))), " ..
8386
" child_count (dbname, host, tier, cnt) AS " ..
8487
" (SELECT t.dbname, t.host, t.tier, count (*) " ..
8588
" FROM tiers t LEFT OUTER JOIN comdb2_physrep_connections p " ..

tests/phys_rep_tiered.test/lrl.options

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ ctrace_dbdir 1
1010
allow_lua_print 1
1111
reverse_hosts_v2 1
1212
physrep_keepalive_v2 1
13+
physrep_reconnect_interval 10

tests/phys_rep_tiered.test/register_replicant.lua

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)