Skip to content

Commit f7196e8

Browse files
committed
Remove some references to global stream_wal variable
1 parent ed5d71e commit f7196e8

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/backup.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ do_backup_pg(InstanceState *instanceState, PGconn *backup_conn,
259259
write_backup(&current, true);
260260

261261
/* In PAGE mode or in ARCHIVE wal-mode wait for current segment */
262-
if (current.backup_mode == BACKUP_MODE_DIFF_PAGE || !stream_wal)
262+
if (current.backup_mode == BACKUP_MODE_DIFF_PAGE || !current.stream)
263263
{
264264
/* Check that archive_dir can be reached */
265265
if (fio_access(instanceState->instance_wal_subdir_path, F_OK, FIO_BACKUP_HOST) != 0)
@@ -275,7 +275,7 @@ do_backup_pg(InstanceState *instanceState, PGconn *backup_conn,
275275
}
276276

277277
/* start stream replication */
278-
if (stream_wal)
278+
if (current.stream)
279279
{
280280
join_path_components(dst_backup_path, current.database_dir, PG_XLOG_DIR);
281281
fio_mkdir(dst_backup_path, DIR_PERMISSION, FIO_BACKUP_HOST);
@@ -1076,7 +1076,7 @@ pg_start_backup(const char *label, bool smooth, pgBackup *backup,
10761076

10771077
PQclear(res);
10781078

1079-
if ((!stream_wal || current.backup_mode == BACKUP_MODE_DIFF_PAGE) &&
1079+
if ((!backup->stream || backup->backup_mode == BACKUP_MODE_DIFF_PAGE) &&
10801080
!backup->from_replica &&
10811081
!(nodeInfo->server_version < 90600 &&
10821082
!nodeInfo->is_superuser))
@@ -1261,7 +1261,7 @@ pg_is_superuser(PGconn *conn)
12611261
* previous segment.
12621262
*
12631263
* Flag 'in_stream_dir' determine whether we looking for WAL in 'pg_wal' directory or
1264-
* in archive. Do note, that we cannot rely sorely on global variable 'stream_wal' because,
1264+
* in archive. Do note, that we cannot rely sorely on global variable 'stream_wal' (current.stream) because,
12651265
* for example, PAGE backup must(!) look for start_lsn in archive regardless of wal_mode.
12661266
*
12671267
* 'timeout_elevel' determine the elevel for timeout elog message. If elevel lighter than
@@ -1407,7 +1407,7 @@ wait_wal_lsn(const char *wal_segment_dir, XLogRecPtr target_lsn, bool is_start_l
14071407
wal_delivery_str, wal_segment_path);
14081408
}
14091409

1410-
if (!stream_wal && is_start_lsn && try_count == 30)
1410+
if (!current.stream && is_start_lsn && try_count == 30)
14111411
elog(WARNING, "By default pg_probackup assume WAL delivery method to be ARCHIVE. "
14121412
"If continuous archiving is not set up, use '--stream' option to make autonomous backup. "
14131413
"Otherwise check that continuous archiving works correctly.");
@@ -1753,15 +1753,15 @@ pg_stop_backup(InstanceState *instanceState, pgBackup *backup, PGconn *pg_startb
17531753
pg_create_restore_point(pg_startbackup_conn, backup->start_time);
17541754

17551755
/* Execute pg_stop_backup using PostgreSQL connection */
1756-
pg_stop_backup_send(pg_startbackup_conn, nodeInfo->server_version, current.from_replica, exclusive_backup, &query_text);
1756+
pg_stop_backup_send(pg_startbackup_conn, nodeInfo->server_version, backup->from_replica, exclusive_backup, &query_text);
17571757

17581758
/*
17591759
* Wait for the result of pg_stop_backup(), but no longer than
17601760
* archive_timeout seconds
17611761
*/
17621762
pg_stop_backup_consume(pg_startbackup_conn, nodeInfo->server_version, exclusive_backup, timeout, query_text, &stop_backup_result);
17631763

1764-
if (stream_wal)
1764+
if (backup->stream)
17651765
{
17661766
snprintf(stream_xlog_path, lengthof(stream_xlog_path),
17671767
"%s/%s/%s/%s", instanceState->instance_backup_subdir_path,
@@ -1819,7 +1819,7 @@ pg_stop_backup(InstanceState *instanceState, pgBackup *backup, PGconn *pg_startb
18191819
{
18201820
/* Wait for segment with current stop_lsn, it is ok for it to never arrive */
18211821
wait_wal_lsn(xlog_path, stop_backup_result.lsn, false, backup->tli,
1822-
false, true, WARNING, stream_wal);
1822+
false, true, WARNING, backup->stream);
18231823

18241824
/* Get the first record in segment with current stop_lsn */
18251825
lsn_tmp = get_first_record_lsn(xlog_path, segno, backup->tli,
@@ -1847,7 +1847,7 @@ pg_stop_backup(InstanceState *instanceState, pgBackup *backup, PGconn *pg_startb
18471847
* because previous record can be the contrecord.
18481848
*/
18491849
lsn_tmp = wait_wal_lsn(xlog_path, stop_backup_result.lsn, false, backup->tli,
1850-
true, false, ERROR, stream_wal);
1850+
true, false, ERROR, backup->stream);
18511851

18521852
/* sanity */
18531853
if (!XRecOffIsValid(lsn_tmp) || XLogRecPtrIsInvalid(lsn_tmp))
@@ -1861,7 +1861,7 @@ pg_stop_backup(InstanceState *instanceState, pgBackup *backup, PGconn *pg_startb
18611861
{
18621862
/* Wait for segment with current stop_lsn */
18631863
wait_wal_lsn(xlog_path, stop_backup_result.lsn, false, backup->tli,
1864-
false, true, ERROR, stream_wal);
1864+
false, true, ERROR, backup->stream);
18651865

18661866
/* Get the next closest record in segment with current stop_lsn */
18671867
lsn_tmp = get_next_record_lsn(xlog_path, segno, backup->tli,
@@ -1924,9 +1924,9 @@ pg_stop_backup(InstanceState *instanceState, pgBackup *backup, PGconn *pg_startb
19241924
*/
19251925
if (!stop_lsn_exists)
19261926
stop_backup_lsn = wait_wal_lsn(xlog_path, stop_backup_result.lsn, false, backup->tli,
1927-
false, false, ERROR, stream_wal);
1927+
false, false, ERROR, backup->stream);
19281928

1929-
if (stream_wal)
1929+
if (backup->stream)
19301930
{
19311931
/* This function will also add list of xlog files
19321932
* to the passed filelist */

0 commit comments

Comments
 (0)