Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 66ebfcb

Browse files
committed
Remove --remote option
1 parent f8e9af6 commit 66ebfcb

File tree

6 files changed

+13
-17
lines changed

6 files changed

+13
-17
lines changed

src/backup.c

+7-6
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ do_backup_instance(void)
492492
current.data_bytes = 0;
493493

494494
/* Obtain current timeline */
495-
if (instance_config.remote.enabled)
495+
if (IsReplicationProtocol())
496496
{
497497
char *sysidentifier;
498498
TimeLineID starttli;
@@ -632,7 +632,8 @@ do_backup_instance(void)
632632
backup_files_list = parray_new();
633633

634634
/* list files with the logical path. omit $PGDATA */
635-
if (instance_config.remote.enabled)
635+
636+
if (IsReplicationProtocol())
636637
get_remote_pgdata_filelist(backup_files_list);
637638
else
638639
dir_list_file(backup_files_list, instance_config.pgdata,
@@ -699,7 +700,7 @@ do_backup_instance(void)
699700
char *dir_name;
700701
char database_path[MAXPGPATH];
701702

702-
if (!instance_config.remote.enabled)
703+
if (!IsReplicationProtocol())
703704
dir_name = GetRelativePath(file->path, instance_config.pgdata);
704705
else
705706
dir_name = file->path;
@@ -749,7 +750,7 @@ do_backup_instance(void)
749750

750751
elog(VERBOSE, "Start thread num: %i", i);
751752

752-
if (!instance_config.remote.enabled)
753+
if (!IsReplicationProtocol())
753754
pthread_create(&threads[i], NULL, backup_files, arg);
754755
else
755756
pthread_create(&threads[i], NULL, remote_backup_files, arg);
@@ -902,7 +903,7 @@ do_backup(time_t start_time)
902903
check_server_version();
903904

904905
/* TODO fix it for remote backup*/
905-
if (!instance_config.remote.enabled)
906+
if (!IsReplicationProtocol())
906907
current.checksum_version = get_data_checksum_version(true);
907908

908909
is_checksum_enabled = pg_checksum_enable();
@@ -958,7 +959,7 @@ do_backup(time_t start_time)
958959
* belogns to the same instance.
959960
*/
960961
/* TODO fix it for remote backup */
961-
if (!instance_config.remote.enabled)
962+
if (!IsReplicationProtocol())
962963
check_system_identifiers();
963964

964965

src/configure.c

-5
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,6 @@ ConfigOption instance_options[] =
204204
&instance_config.remote.ssh_config, SOURCE_CMD, 0,
205205
OPTION_REMOTE_GROUP, 0, option_get_value
206206
},
207-
{
208-
'b', 225, "remote",
209-
&instance_config.remote.enabled, SOURCE_CMD, 0,
210-
OPTION_REMOTE_GROUP, 0, option_get_value
211-
},
212207
{ 0 }
213208
};
214209

src/pg_probackup.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ main(int argc, char *argv[])
333333
if (!is_absolute_path(backup_path))
334334
elog(ERROR, "-B, --backup-path must be an absolute path");
335335

336-
if (IsSshConnection()
336+
if (IsSshProtocol()
337337
&& (backup_subcmd == BACKUP_CMD || backup_subcmd == ADD_INSTANCE_CMD || backup_subcmd == RESTORE_CMD ||
338338
backup_subcmd == ARCHIVE_PUSH_CMD || backup_subcmd == ARCHIVE_GET_CMD))
339339
{
@@ -501,7 +501,7 @@ main(int argc, char *argv[])
501501
return do_init();
502502
case BACKUP_CMD:
503503
current.stream = stream_wal;
504-
if (IsSshConnection() && !remote_agent)
504+
if (IsSshProtocol() && !remote_agent)
505505
{
506506
current.status = BACKUP_STATUS_DONE;
507507
StrNCpy(current.program_version, PROGRAM_VERSION,
@@ -519,7 +519,7 @@ main(int argc, char *argv[])
519519

520520
elog(INFO, "Backup start, pg_probackup version: %s, backup ID: %s, backup mode: %s, instance: %s, stream: %s, remote %s",
521521
PROGRAM_VERSION, base36enc(start_time), backup_mode, instance_name,
522-
stream_wal ? "true" : "false", instance_config.remote.enabled ? "true" : "false");
522+
stream_wal ? "true" : "false", instance_config.remote.host ? "true" : "false");
523523

524524
return do_backup(start_time);
525525
}

src/pg_probackup.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,8 @@ typedef struct
348348
XLByteInSeg(xlrp, logSegNo)
349349
#endif
350350

351-
#define IsSshConnection() (instance_config.remote.enabled && strcmp(instance_config.remote.proto, "ssh") == 0)
351+
#define IsSshProtocol() (instance_config.remote.host && strcmp(instance_config.remote.proto, "ssh") == 0)
352+
#define IsReplicationProtocol() (instance_config.remote.host && strcmp(instance_config.remote.proto, "replication") == 0)
352353

353354
/* directory options */
354355
extern char *backup_path;

src/utils/file.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ static bool fio_is_remote(fio_location location)
4949
{
5050
return location == FIO_REMOTE_HOST
5151
|| (location == FIO_BACKUP_HOST && remote_agent) /* agent is launched at Postgres side */
52-
|| (location == FIO_DB_HOST && !remote_agent && IsSshConnection());
52+
|| (location == FIO_DB_HOST && !remote_agent && IsSshProtocol());
5353
}
5454

5555
/* Try to read specified amount of bytes unless error or EOF are encountered */

src/utils/remote.h

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ typedef struct RemoteConfig
1818
char* path;
1919
char *ssh_config;
2020
char *ssh_options;
21-
bool enabled;
2221
} RemoteConfig;
2322

2423
#endif

0 commit comments

Comments
 (0)