Skip to content

Commit b103945

Browse files
markhannumakshatsikarwar
authored andcommitted
Remove physrep min-log logic
Signed-off-by: Mark Hannum <mhannum@bloomberg.net>
1 parent 0678c88 commit b103945

7 files changed

Lines changed: 0 additions & 142 deletions

File tree

bdb/file.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3663,8 +3663,6 @@ static void delete_log_files_int(bdb_state_type *bdb_state)
36633663
}
36643664
}
36653665

3666-
physrep_update_low_file_num(&lowfilenum, &local_lowfilenum);
3667-
36683666
/* debug: print filenums from other nodes */
36693667

36703668
/* if we have a maximum filenum defined in bdb attributes which is lower,

db/db_tunables.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,6 @@ extern int gbl_tranlog_maxpoll;
520520

521521
/* Physical replication */
522522
extern int gbl_blocking_physrep;
523-
extern int gbl_physrep_check_minlog_freq_sec;
524523
extern int gbl_physrep_debug;
525524
extern int gbl_physrep_exit_on_invalid_logstream;
526525
extern int gbl_physrep_fanout;

db/db_tunables.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1860,8 +1860,6 @@ REGISTER_TUNABLE("tranlog_incoherent_timeout", "Timeout in seconds for incoheren
18601860
TUNABLE_INTEGER, &gbl_tranlog_incoherent_timeout, 0, NULL, NULL, NULL, NULL);
18611861
REGISTER_TUNABLE("tranlog_maxpoll", "Tranlog timeout in seconds for blocking poll. (Default: 60)", TUNABLE_INTEGER,
18621862
&gbl_tranlog_maxpoll, 0, NULL, NULL, NULL, NULL);
1863-
REGISTER_TUNABLE("physrep_check_minlog_freq_sec", "Check the minimum log number to keep this often. (Default: 600)",
1864-
TUNABLE_INTEGER, &gbl_physrep_check_minlog_freq_sec, 0, NULL, NULL, NULL, NULL);
18651863
REGISTER_TUNABLE("physrep_debug", "Print extended physrep trace. (Default: off)", TUNABLE_BOOLEAN, &gbl_physrep_debug,
18661864
0, NULL, NULL, NULL, NULL);
18671865
REGISTER_TUNABLE("physrep_exit_on_invalid_logstream", "Exit physreps on invalid logstream. (Default: off)",

db/phys_rep.c

Lines changed: 0 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ int gbl_deferred_phys_flag = 0;
7070
int gbl_physrep_slow_replicant_check_freq_sec = 60;
7171
int gbl_physrep_keepalive_freq_sec = 60;
7272
int gbl_physrep_hung_replicant_check_freq_sec = 60;
73-
int gbl_physrep_check_minlog_freq_sec = 600;
7473
int gbl_physrep_hung_replicant_threshold = 60;
7574
int gbl_physrep_revconn_check_interval = 60;
7675
int gbl_physrep_update_registry_interval = 60;
@@ -79,7 +78,6 @@ int gbl_physrep_i_am_metadb = 0;
7978
int gbl_physrep_filter_by_class = 1;
8079
int gbl_started_physrep_threads = 0;
8180

82-
unsigned int physrep_min_logfile;
8381
unsigned int gbl_deferred_phys_update;
8482

8583
char *gbl_physrep_source_dbname;
@@ -1205,10 +1203,6 @@ static int send_keepalive(void)
12051203
return 0;
12061204
}
12071205

1208-
unsigned int physrep_min_filenum() {
1209-
return physrep_min_logfile;
1210-
}
1211-
12121206
extern int gbl_reverse_hosts_v2;
12131207

12141208
static int check_for_reverse_conn(cdb2_hndl_tp *hndl) {
@@ -1248,38 +1242,6 @@ static int check_for_reverse_conn(cdb2_hndl_tp *hndl) {
12481242
return (rc == 0) ? do_wait : -1;
12491243
}
12501244

1251-
void physrep_update_low_file_num(int *lowfilenum, int *local_lowfilenum) {
1252-
unsigned int physrep_minfilenum;
1253-
if ((get_dbtable_by_name("comdb2_physreps")) == NULL) {
1254-
return;
1255-
}
1256-
1257-
physrep_minfilenum = physrep_min_filenum();
1258-
if (physrep_minfilenum <= 0) {
1259-
if (gbl_physrep_debug) {
1260-
physrep_logmsg(LOGMSG_USER, "%s:%d: lowfilenum unchanged (physrep_minfilenum: %d)\n",
1261-
__func__, __LINE__, physrep_minfilenum);
1262-
}
1263-
} else {
1264-
if (physrep_minfilenum <= *lowfilenum) {
1265-
if (gbl_physrep_debug) {
1266-
physrep_logmsg(LOGMSG_USER, "%s:%d: lowfilenum %d being changed "
1267-
"physical replicant(s) (physrep_minfilenum: %d)\n",
1268-
__func__, __LINE__, *lowfilenum, physrep_minfilenum);
1269-
}
1270-
*lowfilenum = physrep_minfilenum - 1;
1271-
}
1272-
if (physrep_minfilenum <= *local_lowfilenum) {
1273-
*local_lowfilenum = physrep_minfilenum - 1;
1274-
}
1275-
}
1276-
1277-
if (gbl_physrep_debug) {
1278-
physrep_logmsg(LOGMSG_USER, "%s:%d: lowfilenum: %d (physrep_minfilenum: %d)\n",
1279-
__func__, __LINE__, *lowfilenum, physrep_minfilenum);
1280-
}
1281-
}
1282-
12831245
static int slow_replicants_count_int(cdb2_hndl_tp *metadb, unsigned int *count)
12841246
{
12851247
char query[400];
@@ -1340,94 +1302,6 @@ static int slow_replicants_count(unsigned int *count)
13401302
return badrc ? -1 : 0;
13411303
}
13421304

1343-
static int update_min_logfile_int(cdb2_hndl_tp *metadb)
1344-
{
1345-
char cmd[120+nodes_list_sz];
1346-
char *buf;
1347-
size_t buf_len;
1348-
int bytes_written;
1349-
int rc = 0;
1350-
1351-
if (gbl_ready == 0)
1352-
return 0;
1353-
1354-
bytes_written = 0;
1355-
buf = cmd;
1356-
buf_len = sizeof(cmd);
1357-
1358-
bytes_written +=
1359-
snprintf(buf+bytes_written, buf_len-bytes_written,
1360-
"WITH RECURSIVE replication_tree(dbname, host, file) AS "
1361-
" (SELECT dbname, host, file FROM comdb2_physreps "
1362-
" WHERE dbname='%s' AND host IN (",
1363-
gbl_dbname);
1364-
if (bytes_written >= buf_len) {
1365-
physrep_logmsg(LOGMSG_ERROR, "%s:%d Buffer is not long enough!\n", __func__, __LINE__);
1366-
return 1;
1367-
}
1368-
1369-
bytes_written += append_quoted_local_hosts(buf+bytes_written, buf_len-bytes_written, ",");
1370-
if (bytes_written >= buf_len) {
1371-
physrep_logmsg(LOGMSG_ERROR, "%s:%d Buffer is not long enough!\n", __func__, __LINE__);
1372-
return 1;
1373-
}
1374-
1375-
bytes_written += snprintf(buf + bytes_written, buf_len - bytes_written,
1376-
" ) "
1377-
" UNION "
1378-
" SELECT p.dbname, p.host, p.file FROM comdb2_physreps p, "
1379-
" comdb2_physrep_connections c, replication_tree t "
1380-
" WHERE p.state = 'Active' AND p.file <> 0 AND "
1381-
" t.dbname = c.source_dbname AND c.dbname = p.dbname) "
1382-
" SELECT file FROM replication_tree WHERE file IS NOT NULL ORDER BY file LIMIT 1");
1383-
if (bytes_written >= buf_len) {
1384-
physrep_logmsg(LOGMSG_ERROR, "%s:%d Buffer is not long enough!\n", __func__, __LINE__);
1385-
return 1;
1386-
}
1387-
1388-
if (gbl_physrep_debug) {
1389-
physrep_logmsg(LOGMSG_USER, "%s:%d Executing: %s\n", __func__, __LINE__, cmd);
1390-
}
1391-
1392-
ATOMIC_ADD64(gbl_physrep_metadb_sql_count, 1);
1393-
rc = cdb2_run_statement(metadb, cmd);
1394-
if (rc == CDB2_OK) {
1395-
while ((rc = cdb2_next_record(metadb)) == CDB2_OK) {
1396-
int64_t *minfile = (int64_t *)cdb2_column_value(metadb, 0);
1397-
physrep_min_logfile = minfile ? (unsigned int)*minfile : 0;
1398-
}
1399-
if (rc == CDB2_OK_DONE)
1400-
rc = 0;
1401-
} else {
1402-
physrep_logmsg(LOGMSG_ERROR, "%s:%d Failed to execute (rc: %d)\n", __func__, __LINE__, rc);
1403-
}
1404-
1405-
return rc;
1406-
}
1407-
1408-
static int update_min_logfile(void)
1409-
{
1410-
cdb2_hndl_tp *metadb;
1411-
int rc, altcnt = gbl_altmetadb_count;
1412-
1413-
if ((rc = physrep_get_metadb_or_local_hndl(&metadb)) != 0) {
1414-
logmsg(LOGMSG_ERROR, "%s: failed to get metadb handle rc=%d\n", __func__, rc);
1415-
} else {
1416-
update_min_logfile_int(metadb);
1417-
cdb2_close(metadb);
1418-
}
1419-
1420-
for (int i = 0; i < altcnt; i++) {
1421-
if ((rc = get_alt_metadb_hndl(&metadb, i)) != 0) {
1422-
logmsg(LOGMSG_ERROR, "%s: failed to get alt metadb handle %d rc=%d\n", __func__, i, rc);
1423-
continue;
1424-
}
1425-
update_min_logfile_int(metadb);
1426-
cdb2_close(metadb);
1427-
}
1428-
return 0;
1429-
}
1430-
14311305
/*
14321306
Check whether we need to wait for a connection from one of the nodes
14331307
in the source db.
@@ -1994,7 +1868,6 @@ static void *physrep_watcher(void *args) {
19941868
static int physrep_slow_replicant_last_checked;
19951869
static int physrep_keepalive_last_sent;
19961870
static int physrep_hung_replicant_last_checked;
1997-
static int physrep_minlog_last_checked;
19981871

19991872
while (!gbl_exit && stop_physrep_watcher == 0) {
20001873
sleep(1);
@@ -2030,13 +1903,6 @@ static void *physrep_watcher(void *args) {
20301903
send_keepalive();
20311904
physrep_keepalive_last_sent = now;
20321905
}
2033-
2034-
// Update the 'minimum log file' marker upto which it is safe to
2035-
// delete log files.
2036-
if ((now - physrep_minlog_last_checked) >= gbl_physrep_check_minlog_freq_sec) {
2037-
update_min_logfile();
2038-
physrep_minlog_last_checked = now;
2039-
}
20401906
}
20411907
return NULL;
20421908
}

db/phys_rep.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ int stop_physrep_threads();
4949
int physrep_exited();
5050
int physrep_get_metadb_or_local_hndl(cdb2_hndl_tp**);
5151
void physrep_cleanup(void);
52-
void physrep_update_low_file_num(int*, int*);
5352
void physrep_fanout_override(const char *dbname, int fanout);
5453
int physrep_fanout_get(const char *dbname);
5554
void physrep_fanout_dump(void);

docs/pages/operating/physical_replication.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ CREATE TABLE comdb2_physrep_sources(dbname CSTRING(60),
171171
## Tunables
172172

173173
* blocking_physrep: The `SELECT .. FROM comdb2_transaction_logs` query executed by physical replicants blocks for the next log record. (Default: `false`)
174-
* physrep_check_minlog_freq_sec: Check the minimum log number to keep this often. (Default: `600`)
175174
* physrep_debug: Print extended physrep trace. (Default: `off`)
176175
* physrep_exit_on_invalid_logstream: Exit physreps on invalid logstream. (Default: off)
177176
* physrep_fanout: Maximum number of physical replicants that a node can service (Default: `8`)

tests/tunables.test/t00_all_tunables.expected

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,6 @@
744744
(name='pgcompactpool.stacksz', description='Thread stack size.', type='INTEGER', value='1048576', read_only='N')
745745
(name='physical_ack_interval', description='For logical transactions, have the slave send an 'ack' after this many physical operations.', type='INTEGER', value='0', read_only='N')
746746
(name='physical_commit_interval', description='Force a physical commit after this many physical operations.', type='INTEGER', value='512', read_only='N')
747-
(name='physrep_check_minlog_freq_sec', description='Check the minimum log number to keep this often. (Default: 600)', type='INTEGER', value='600', read_only='N')
748747
(name='physrep_debug', description='Print extended physrep trace. (Default: off)', type='BOOLEAN', value='OFF', read_only='N')
749748
(name='physrep_exit_on_invalid_logstream', description='Exit physreps on invalid logstream. (Default: off)', type='BOOLEAN', value='OFF', read_only='N')
750749
(name='physrep_fanout', description='Maximum number of physical replicants that a node can service (Default: 8)', type='INTEGER', value='8', read_only='N')

0 commit comments

Comments
 (0)