Skip to content

Commit 7e8cffb

Browse files
committed
some changes
1 parent d0092bb commit 7e8cffb

File tree

6 files changed

+30
-7
lines changed

6 files changed

+30
-7
lines changed

src/backup.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -552,9 +552,16 @@ do_backup_instance(void)
552552
join_path_components(dst_backup_path, database_path, PG_XLOG_DIR);
553553
dir_create_dir(dst_backup_path, DIR_PERMISSION);
554554

555+
if (start_stream_mut == NULL){
556+
pthread_mutex_init(&start_stream_mut,NULL);
557+
}
558+
555559
pthread_mutex_lock(&start_stream_mut);
556560
pthread_create(&stream_thread, NULL, (void *(*)(void *)) StreamLog, dst_backup_path);
557561
pthread_mutex_lock(&start_stream_mut);
562+
#ifdef WIN32
563+
sleep(10);
564+
#endif
558565
if (conn == NULL)
559566
elog(ERROR, "Cannot continue backup because stream connect has failed.");
560567

@@ -936,7 +943,7 @@ check_system_identifiers(void)
936943

937944
system_id_pgdata = get_system_identifier(pgdata);
938945
system_id_conn = get_remote_system_identifier(backup_conn);
939-
946+
940947
if (system_id_conn != system_identifier)
941948
elog(ERROR, "Backup data directory was initialized for system id %ld, but connected instance system id is %ld",
942949
system_identifier, system_id_conn);
@@ -959,14 +966,15 @@ confirm_block_size(const char *name, int blcksz)
959966
res = pgut_execute(backup_conn, "SELECT current_setting($1)", 1, &name, true);
960967
if (PQntuples(res) != 1 || PQnfields(res) != 1)
961968
elog(ERROR, "cannot get %s: %s", name, PQerrorMessage(backup_conn));
962-
969+
963970
block_size = strtol(PQgetvalue(res, 0, 0), &endp, 10);
964-
PQclear(res);
965-
966971
if ((endp && *endp) || block_size != blcksz)
967972
elog(ERROR,
968973
"%s(%d) is not compatible(%d expected)",
969974
name, block_size, blcksz);
975+
976+
PQclear(res);//bad pointer to endp
977+
970978
}
971979

972980
/*
@@ -2864,4 +2872,5 @@ pthread_join(pthread_t th, void **thread_return)
28642872
return 0;
28652873
}
28662874

2875+
28672876
#endif /* WIN32 */

src/configure.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ writeBackupCatalogConfig(FILE *out, pgBackupConfig *config)
114114

115115
fprintf(out, "#Backup instance info\n");
116116
fprintf(out, "PGDATA = %s\n", config->pgdata);
117-
fprintf(out, "system-identifier = %li\n", config->system_identifier);
117+
//fprintf(out, "system-identifier = %li\n", config->system_identifier);
118+
fprintf(out, "system-identifier = %" INT64_MODIFIER "u\n", config->system_identifier);
118119

119120
fprintf(out, "#Connection parameters:\n");
120121
if (config->pgdatabase)

src/dir.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ pgFileInit(const char *path)
150150
pgFile *file;
151151
file = (pgFile *) pgut_malloc(sizeof(pgFile));
152152

153+
file->name = 0;
154+
153155
file->size = 0;
154156
file->mode = 0;
155157
file->read_size = 0;
@@ -520,7 +522,7 @@ dir_list_file_internal(parray *files, const char *root, bool exclude,
520522
break;
521523
}
522524
}
523-
else if (strcmp(file->name, pgdata_exclude_dir[i]) == 0)
525+
else if (file->name!=0 && strcmp(file->name, pgdata_exclude_dir[i]) == 0)
524526
{
525527
skip = true;
526528
break;

src/pg_probackup.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,7 @@ main(int argc, char *argv[])
434434

435435
start_time = time(NULL);
436436
backup_mode = deparse_backup_mode(current.backup_mode);
437+
current.stream = stream_wal;
437438

438439
elog(INFO, "Backup start, pg_probackup version: %s, backup ID: %s, backup mode: %s, instance: %s, stream: %s, remote: %s",
439440
PROGRAM_VERSION, base36enc(start_time), backup_mode, instance_name,

src/pg_probackup.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,5 +506,15 @@ extern void pgBackup_init(pgBackup *backup);
506506

507507
/* in status.c */
508508
extern bool is_pg_running(void);
509+
#ifdef WIN32
510+
#ifdef _DEBUG
511+
#define lseek _lseek
512+
#define open _open
513+
#define fstat _fstat
514+
#define read _read
515+
#define close _close
516+
#define write _write
517+
#endif
518+
#endif
509519

510520
#endif /* PG_PROBACKUP_H */

src/utils/pgut.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1221,7 +1221,7 @@ get_next_token(const char *src, char *dst, const char *line)
12211221
}
12221222
else
12231223
{
1224-
i = j = strcspn(s, "# \n\r\t\v");
1224+
i = j = strcspn(s, "#\n\r\t\v");//removed space
12251225
memcpy(dst, s, j);
12261226
}
12271227

0 commit comments

Comments
 (0)