*** a/src/backend/replication/walsender.c --- b/src/backend/replication/walsender.c *************** *** 66,71 **** bool am_walsender = false; /* Am I a walsender process ? */ --- 66,72 ---- /* User-settable parameters for walsender */ int max_wal_senders = 0; /* the maximum number of concurrent walsenders */ int WalSndDelay = 200; /* max sleep time between some actions */ + int WalSndSleep = 200; #define NAPTIME_PER_CYCLE 100000L /* max sleep time between cycles (100ms) */ *************** *** 208,213 **** WalSndHandshake(void) --- 209,218 ---- char sysid[32]; char tli[11]; + elog(LOG, "start sleeping"); + pg_usleep(WalSndSleep * 1000L); + elog(LOG, "stop sleeping"); + /* * Reply with a result set with one row, two columns. * First col is system ID, and second if timeline ID *** a/src/backend/utils/misc/guc.c --- b/src/backend/utils/misc/guc.c *************** *** 1729,1734 **** static struct config_int ConfigureNamesInt[] = --- 1729,1744 ---- }, { + {"wal_sender_sleep", PGC_SIGHUP, DEVELOPER_OPTIONS, + gettext_noop(""), + NULL, + GUC_UNIT_MS | GUC_NOT_IN_SAMPLE + }, + &WalSndSleep, + 200, 1, 600000, NULL, NULL + }, + + { {"commit_delay", PGC_USERSET, WAL_SETTINGS, gettext_noop("Sets the delay in microseconds between transaction commit and " "flushing WAL to disk."), *** a/src/include/replication/walsender.h --- b/src/include/replication/walsender.h *************** *** 39,44 **** extern bool am_walsender; --- 39,45 ---- /* user-settable parameters */ extern int WalSndDelay; + extern int WalSndSleep; extern int WalSenderMain(void); extern void WalSndSignals(void);