Skip to content

Commit 17bd528

Browse files
committed
[PGPRO-5421] cleanup patch code
1 parent b3c2673 commit 17bd528

File tree

2 files changed

+33
-35
lines changed

2 files changed

+33
-35
lines changed

src/archive.c

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ static int get_wal_file_internal(const char *from_path, const char *to_path, FIL
3030
#ifdef HAVE_LIBZ
3131
static const char *get_gz_error(gzFile gzf, int errnum);
3232
#endif
33-
// static void copy_file_attributes(const char *from_path,
34-
// fio_location from_location,
35-
// const char *to_path, fio_location to_location,
36-
// bool unlink_on_error);
33+
//static void copy_file_attributes(const char *from_path,
34+
// fio_location from_location,
35+
// const char *to_path, fio_location to_location,
36+
// bool unlink_on_error);
3737

3838
static bool next_wal_segment_exists(TimeLineID tli, XLogSegNo segno, const char *prefetch_dir, uint32 wal_seg_size);
3939
static uint32 run_wal_prefetch(const char *prefetch_dir, const char *archive_dir, TimeLineID tli,
@@ -120,6 +120,7 @@ do_archive_push(InstanceState *instanceState, InstanceConfig *instance, char *wa
120120
uint64 i;
121121
char current_dir[MAXPGPATH];
122122
char pg_xlog_dir[MAXPGPATH];
123+
char xlog_wal_path[MAXPGPATH];
123124
char archive_status_dir[MAXPGPATH];
124125
uint64 system_id;
125126
bool is_compress = false;
@@ -141,23 +142,21 @@ do_archive_push(InstanceState *instanceState, InstanceConfig *instance, char *wa
141142
parray *batch_files = NULL;
142143
int n_threads;
143144

144-
char xlog_wal_path[MAXPGPATH];
145-
146145
if (wal_file_name == NULL)
147146
elog(ERROR, "Required parameter is not specified: --wal-file-name %%f");
148147

149148
join_path_components(xlog_wal_path, PG_XLOG_DIR, wal_file_name);
150149

151150
if (wal_file_path == NULL)
152151
{
153-
elog(INFO, "Required parameter is not specified: --wal_file_path %%p "
152+
elog(INFO, "Optional parameter is not specified: --wal_file_path %%p "
154153
"Setting wal-file-path by default");
155154
wal_file_path = xlog_wal_path;
156155
}
157156

158-
if (strcmp(wal_file_path, xlog_wal_path)!=0)
157+
if (strcmp(wal_file_path, xlog_wal_path) != 0)
159158
{
160-
elog(INFO, "wal_file_path is setted by user %s", wal_file_path);
159+
elog(INFO, "wal_file_path is setted by user %s", wal_file_path);
161160

162161
join_path_components(pg_xlog_dir, instance->pgdata, XLOGDIR);
163162
}
@@ -178,7 +177,7 @@ do_archive_push(InstanceState *instanceState, InstanceConfig *instance, char *wa
178177
if (system_id != instance->system_identifier)
179178
elog(ERROR, "Refuse to push WAL segment %s into archive. Instance parameters mismatch."
180179
"Instance '%s' should have SYSTEM_ID = " UINT64_FORMAT " instead of " UINT64_FORMAT,
181-
wal_file_name, instance->name, instance->system_identifier, system_id);
180+
wal_file_name, instanceState->instance_name, instance->system_identifier, system_id);
182181

183182
if (instance->compress_alg == PGLZ_COMPRESS)
184183
elog(ERROR, "Cannot use pglz for WAL compression");
@@ -927,30 +926,30 @@ get_gz_error(gzFile gzf, int errnum)
927926
}
928927
#endif
929928

930-
// /* Copy file attributes */
931-
// static void
932-
// copy_file_attributes(const char *from_path, fio_location from_location,
933-
// const char *to_path, fio_location to_location,
934-
// bool unlink_on_error)
935-
// {
936-
// struct stat st;
937-
938-
// if (fio_stat(from_path, &st, true, from_location) == -1)
939-
// {
940-
// if (unlink_on_error)
941-
// fio_unlink(to_path, to_location);
942-
// elog(ERROR, "Cannot stat file \"%s\": %s",
943-
// from_path, strerror(errno));
944-
// }
945-
946-
// if (fio_chmod(to_path, st.st_mode, to_location) == -1)
947-
// {
948-
// if (unlink_on_error)
949-
// fio_unlink(to_path, to_location);
950-
// elog(ERROR, "Cannot change mode of file \"%s\": %s",
951-
// to_path, strerror(errno));
952-
// }
953-
// }
929+
/* Copy file attributes */
930+
//static void
931+
//copy_file_attributes(const char *from_path, fio_location from_location,
932+
// const char *to_path, fio_location to_location,
933+
// bool unlink_on_error)
934+
//{
935+
// struct stat st;
936+
//
937+
// if (fio_stat(from_path, &st, true, from_location) == -1)
938+
// {
939+
// if (unlink_on_error)
940+
// fio_unlink(to_path, to_location);
941+
// elog(ERROR, "Cannot stat file \"%s\": %s",
942+
// from_path, strerror(errno));
943+
// }
944+
//
945+
// if (fio_chmod(to_path, st.st_mode, to_location) == -1)
946+
// {
947+
// if (unlink_on_error)
948+
// fio_unlink(to_path, to_location);
949+
// elog(ERROR, "Cannot change mode of file \"%s\": %s",
950+
// to_path, strerror(errno));
951+
// }
952+
//}
954953

955954
/* Look for files with '.ready' suffix in archive_status directory
956955
* and pack such files into batch sized array.

src/pg_probackup.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ extern const char *PROGRAM_EMAIL;
9191
#define DEFAULT_PERMANENT_SLOT_NAME "pg_probackup_perm_slot";
9292

9393
/* Timeout defaults */
94-
#define PARTIAL_WAL_TIMER 60
9594
#define ARCHIVE_TIMEOUT_DEFAULT 300
9695
#define REPLICA_TIMEOUT_DEFAULT 300
9796
#define LOCK_TIMEOUT 60

0 commit comments

Comments
 (0)