Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5e0e881

Browse files
committed
New option: delete --expired. Minor bugfixes.
1 parent1edaabf commit5e0e881

File tree

3 files changed

+25
-8
lines changed

3 files changed

+25
-8
lines changed

‎dir.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,23 @@ pgFileNew(const char *path, bool omit_symlink)
128128
strerror(errno));
129129
}
130130

131+
file=pgFileInit(path);
132+
file->size=st.st_size;
133+
file->mode=st.st_mode;
134+
135+
returnfile;
136+
}
137+
138+
pgFile*
139+
pgFileInit(constchar*path)
140+
{
141+
pgFile*file;
131142
file= (pgFile*)pgut_malloc(sizeof(pgFile));
132143

133-
file->size=st.st_size;
144+
file->size=0;
145+
file->mode=0;
134146
file->read_size=0;
135147
file->write_size=0;
136-
file->mode=st.st_mode;
137148
file->crc=0;
138149
file->is_datafile= false;
139150
file->linked=NULL;
@@ -142,10 +153,9 @@ pgFileNew(const char *path, bool omit_symlink)
142153
file->ptrack_path=NULL;
143154
file->segno=0;
144155
file->path=pgut_malloc(strlen(path)+1);
156+
strcpy(file->path,path);/* enough buffer size guaranteed */
145157
file->generation=-1;
146158
file->is_partial_copy=0;
147-
strcpy(file->path,path);/* enough buffer size guaranteed */
148-
149159
returnfile;
150160
}
151161

@@ -725,7 +735,7 @@ dir_read_file_list(const char *root, const char *file_txt)
725735
else
726736
strcpy(filepath,path);
727737

728-
file=pgFileNew(filepath, false);
738+
file=pgFileInit(filepath);
729739

730740
file->write_size=write_size;
731741
file->mode=mode;

‎pg_probackup.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,11 @@ static pgut_option options[] =
8383
{'b',12,"wal",&delete_wal,SOURCE_CMDLINE },
8484
{'b',16,"expired",&delete_expired,SOURCE_CMDLINE },
8585
{'b',17,"all",&apply_to_all,SOURCE_CMDLINE },
86+
/* TODO not implemented yet */
8687
{'b',18,"force",&force_delete,SOURCE_CMDLINE },
8788
/* configure options */
88-
{'u',13,"set-retention-redundancy",&retention_redundancy,SOURCE_CMDLINE },
89-
{'u',14,"set-retention-window",&retention_window,SOURCE_CMDLINE },
89+
{'u',13,"retention-redundancy",&retention_redundancy,SOURCE_CMDLINE },
90+
{'u',14,"retention-window",&retention_window,SOURCE_CMDLINE },
9091
/* other */
9192
{'U',15,"system-identifier",&system_identifier,SOURCE_FILE_STRICT },
9293

@@ -235,7 +236,12 @@ main(int argc, char *argv[])
235236
caseSHOW:
236237
returndo_show(current.backup_id);
237238
caseDELETE:
238-
returndo_delete(current.backup_id);
239+
if (delete_expired&&backup_id_string_param)
240+
elog(ERROR,"You cannot specify --delete-expired and --backup-id options together");
241+
if (delete_expired)
242+
returndo_retention_purge();
243+
else
244+
returndo_delete(current.backup_id);
239245
caseCONFIGURE:
240246
/* TODO fixit */
241247
if (argc==4)

‎pg_probackup.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ extern int dir_create_dir(const char *path, mode_t mode);
329329
externbooldir_is_empty(constchar*path);
330330

331331
externpgFile*pgFileNew(constchar*path,boolomit_symlink);
332+
externpgFile*pgFileInit(constchar*path);
332333
externvoidpgFileDelete(pgFile*file);
333334
externvoidpgFileFree(void*file);
334335
externpg_crc32pgFileGetCRC(pgFile*file);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp