Skip to content

Commit 72513db

Browse files
committed
Physrep poll-time set by physrep_pollms tunable
Signed-off-by: Mark Hannum <mhannum@bloomberg.net>
1 parent 238c977 commit 72513db

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

db/db_tunables.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,7 @@ extern int gbl_physrep_reconnect_interval;
510510
extern int gbl_physrep_shuffle_host_list;
511511
extern int gbl_physrep_ignore_queues;
512512
extern int gbl_physrep_max_rollback;
513+
extern int gbl_physrep_pollms;
513514

514515
/* source-name / host is from lrl */
515516
extern char *gbl_physrep_source_dbname;

db/db_tunables.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1907,6 +1907,8 @@ REGISTER_TUNABLE("physrep_ignore_queues", "Don't replicate queues.", TUNABLE_BOO
19071907
READONLY, NULL, NULL, NULL, NULL);
19081908
REGISTER_TUNABLE("physrep_max_rollback", "Maximum logs physrep can rollback. (Default: 0)", TUNABLE_INTEGER,
19091909
&gbl_physrep_max_rollback, 0, NULL, NULL, NULL, NULL);
1910+
REGISTER_TUNABLE("physrep_pollms", "Physical replicant poll interval in milliseconds. (Default: 200)", TUNABLE_INTEGER,
1911+
&gbl_physrep_pollms, 0, NULL, NULL, NULL, NULL);
19101912

19111913
/* reversql-sql */
19121914
REGISTER_TUNABLE("revsql_allow_command_execution",

db/phys_rep.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include <pthread.h>
2424
#include <stdint.h>
2525
#include <unistd.h>
26-
#include <time.h>
26+
#include <poll.h>
2727

2828
#include <bdb_int.h>
2929
#include <bdbglue.h>
@@ -1277,6 +1277,7 @@ static int do_wait_for_reverse_conn(cdb2_hndl_tp *repl_metadb) {
12771277
This is the database/node that to replicant connects to retrieve and
12781278
apply physical logs.
12791279
*/
1280+
int gbl_physrep_pollms = 200;
12801281
extern __thread int physrep_out_of_order;
12811282
static void *physrep_worker(void *args)
12821283
{
@@ -1562,7 +1563,7 @@ static void *physrep_worker(void *args)
15621563
do_truncate = 1;
15631564
}
15641565
sleep_and_retry:
1565-
sleep(1);
1566+
poll(0, 0, gbl_physrep_pollms);
15661567
}
15671568

15681569
if (repl_db_connected == 1) {

0 commit comments

Comments
 (0)