18
18
* --wal-file-path %p --wal-file-name %f', to move backups into arclog_path.
19
19
* Where archlog_path is $BACKUP_PATH/wal/system_id.
20
20
* Currently it just copies wal files to the new location.
21
- * TODO: Planned options: compress, list the arclog content,
21
+ * TODO: Planned options: list the arclog content,
22
22
* compute and validate checksums.
23
23
*/
24
24
int
25
- do_archive_push (char * wal_file_path , char * wal_file_name )
25
+ do_archive_push (char * wal_file_path , char * wal_file_name , bool overwrite )
26
26
{
27
27
char backup_wal_file_path [MAXPGPATH ];
28
28
char absolute_wal_file_path [MAXPGPATH ];
29
29
char current_dir [MAXPGPATH ];
30
30
int64 system_id ;
31
31
pgBackupConfig * config ;
32
+ bool is_compress = false;
32
33
33
34
if (wal_file_name == NULL && wal_file_path == NULL )
34
- elog (ERROR , "required parameters are not specified: --wal_file_name %%f --wal_file_path %%p" );
35
+ elog (ERROR , "required parameters are not specified: --wal-file-name %%f --wal-file-path %%p" );
35
36
36
37
if (wal_file_name == NULL )
37
- elog (ERROR , "required parameter not specified: --wal_file_name %%f" );
38
+ elog (ERROR , "required parameter not specified: --wal-file-name %%f" );
38
39
39
40
if (wal_file_path == NULL )
40
- elog (ERROR , "required parameter not specified: --wal_file_path %%p" );
41
+ elog (ERROR , "required parameter not specified: --wal-file-path %%p" );
41
42
42
43
if (!getcwd (current_dir , sizeof (current_dir )))
43
44
elog (ERROR , "getcwd() error" );
@@ -61,10 +62,16 @@ do_archive_push(char *wal_file_path, char *wal_file_name)
61
62
join_path_components (backup_wal_file_path , arclog_path , wal_file_name );
62
63
63
64
elog (INFO , "pg_probackup archive-push from %s to %s" , absolute_wal_file_path , backup_wal_file_path );
64
- if (access (backup_wal_file_path , F_OK ) != -1 )
65
- elog (ERROR , "file '%s', already exists." , backup_wal_file_path );
66
65
67
- copy_wal_file (absolute_wal_file_path , backup_wal_file_path );
66
+ #ifdef HAVE_LIBZ
67
+ if (compress_alg == PGLZ_COMPRESS )
68
+ elog (ERROR , "pglz compression is not supported" );
69
+ if (compress_alg == ZLIB_COMPRESS )
70
+ is_compress = IsXLogFileName (wal_file_name );
71
+ #endif
72
+
73
+ push_wal_file (absolute_wal_file_path , backup_wal_file_path , is_compress ,
74
+ overwrite );
68
75
elog (INFO , "pg_probackup archive-push completed successfully" );
69
76
70
77
return 0 ;
@@ -82,22 +89,23 @@ do_archive_get(char *wal_file_path, char *wal_file_name)
82
89
char current_dir [MAXPGPATH ];
83
90
84
91
if (wal_file_name == NULL && wal_file_path == NULL )
85
- elog (ERROR , "required parameters are not specified: --wal_file_name %%f --wal_file_path %%p" );
92
+ elog (ERROR , "required parameters are not specified: --wal-file-name %%f --wal-file-path %%p" );
86
93
87
94
if (wal_file_name == NULL )
88
- elog (ERROR , "required parameter not specified: --wal_file_name %%f" );
95
+ elog (ERROR , "required parameter not specified: --wal-file-name %%f" );
89
96
90
97
if (wal_file_path == NULL )
91
- elog (ERROR , "required parameter not specified: --wal_file_path %%p" );
98
+ elog (ERROR , "required parameter not specified: --wal-file-path %%p" );
92
99
93
100
if (!getcwd (current_dir , sizeof (current_dir )))
94
101
elog (ERROR , "getcwd() error" );
95
102
96
103
join_path_components (absolute_wal_file_path , current_dir , wal_file_path );
97
104
join_path_components (backup_wal_file_path , arclog_path , wal_file_name );
98
105
99
- elog (INFO , "pg_probackup archive-get from %s to %s" , backup_wal_file_path , absolute_wal_file_path );
100
- copy_wal_file (backup_wal_file_path , absolute_wal_file_path );
106
+ elog (INFO , "pg_probackup archive-get from %s to %s" ,
107
+ backup_wal_file_path , absolute_wal_file_path );
108
+ get_wal_file (backup_wal_file_path , absolute_wal_file_path );
101
109
elog (INFO , "pg_probackup archive-get completed successfully" );
102
110
103
111
return 0 ;
0 commit comments