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

Commitfd8bde8

Browse files
author
Michael Paquier
committed
Merge "show timeline" and "show" as a single command
It is just troublesome to have to type a subcommands for something thatcould be merged into a single table. The output could be made in asmarter way though...
1 parentef44c4f commitfd8bde8

File tree

3 files changed

+14
-53
lines changed

3 files changed

+14
-53
lines changed

‎pg_rman.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ main(int argc, char *argv[])
104104
constchar*cmd=NULL;
105105
constchar*range1=NULL;
106106
constchar*range2=NULL;
107-
boolshow_timeline= false;
108107
pgBackupRangerange;
109108
inti;
110109

@@ -121,9 +120,6 @@ main(int argc, char *argv[])
121120
{
122121
if (cmd==NULL)
123122
cmd=argv[i];
124-
elseif (pg_strcasecmp(argv[i],"timeline")==0&&
125-
pg_strcasecmp(cmd,"show")==0)
126-
show_timeline= true;
127123
elseif (range1==NULL)
128124
range1=argv[i];
129125
elseif (range2==NULL)
@@ -207,7 +203,7 @@ main(int argc, char *argv[])
207203
target_inclusive,target_tli,is_hard_copy);
208204
}
209205
elseif (pg_strcasecmp(cmd,"show")==0)
210-
returndo_show(&range,show_timeline,show_all);
206+
returndo_show(&range,show_all);
211207
elseif (pg_strcasecmp(cmd,"validate")==0)
212208
returndo_validate(&range);
213209
elseif (pg_strcasecmp(cmd,"delete")==0)
@@ -227,7 +223,6 @@ pgut_help(bool details)
227223
printf(_(" %s OPTION backup\n"),PROGRAM_NAME);
228224
printf(_(" %s OPTION restore\n"),PROGRAM_NAME);
229225
printf(_(" %s OPTION show [DATE]\n"),PROGRAM_NAME);
230-
printf(_(" %s OPTION show timeline [DATE]\n"),PROGRAM_NAME);
231226
printf(_(" %s OPTION validate [DATE]\n"),PROGRAM_NAME);
232227
printf(_(" %s OPTION delete DATE\n"),PROGRAM_NAME);
233228

‎pg_rman.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ extern int do_restore(const char *target_time,
247247
externintdo_init(void);
248248

249249
/* in show.c */
250-
externintdo_show(pgBackupRange*range,boolshow_timeline,boolshow_all);
250+
externintdo_show(pgBackupRange*range,boolshow_all);
251251

252252
/* in delete.c */
253253
externintdo_delete(pgBackupRange*range,boolforce);

‎show.c

Lines changed: 12 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include"pg_rman.h"
1111

1212
staticvoidshow_backup_list(FILE*out,parray*backup_list,boolshow_all);
13-
staticvoidshow_timeline_backup_list(FILE*out,parray*backup_list,boolshow_all);
1413
staticvoidshow_backup_detail(FILE*out,pgBackup*backup);
1514

1615
/*
@@ -19,7 +18,7 @@ static void show_backup_detail(FILE *out, pgBackup *backup);
1918
* backup indicated by id.
2019
*/
2120
int
22-
do_show(pgBackupRange*range,boolshow_timeline,boolshow_all)
21+
do_show(pgBackupRange*range,boolshow_all)
2322
{
2423
if (pgBackupRangeIsSingle(range))
2524
{
@@ -49,10 +48,7 @@ do_show(pgBackupRange *range, bool show_timeline, bool show_all)
4948
elog(ERROR_SYSTEM,_("can't process any more."));
5049
}
5150

52-
if (!show_timeline)
53-
show_backup_list(stdout,backup_list,show_all);
54-
else
55-
show_timeline_backup_list(stdout,backup_list,show_all);
51+
show_backup_list(stdout,backup_list,show_all);
5652

5753
/* cleanup */
5854
parray_walk(backup_list,pgBackupFree);
@@ -165,13 +161,15 @@ show_backup_list(FILE *out, parray *backup_list, bool show_all)
165161
inti;
166162

167163
/* show header */
168-
fputs("============================================================================\n",out);
169-
fputs("Start Time Total Data WAL Log Backup Status \n",out);
170-
fputs("============================================================================\n",out);
164+
fputs("===========================================================================================================\n",out);
165+
fputs("StartMode Current TLI Parent TLITime Total Data WAL Log Backup Status \n",out);
166+
fputs("===========================================================================================================\n",out);
171167

172168
for (i=0;i<parray_num(backup_list);i++)
173169
{
174170
pgBackup*backup;
171+
constchar*modes[]= {"","ARCH","INCR","FULL"};
172+
TimeLineIDparent_tli;
175173
chartimestamp[20];
176174
charduration[20]="----";
177175
chartotal_data_bytes_str[10]="----";
@@ -206,45 +204,13 @@ show_backup_list(FILE *out, parray *backup_list, bool show_all)
206204
pretty_size(backup->write_bytes,write_bytes_str,
207205
lengthof(write_bytes_str));
208206

209-
fprintf(out,"%-19s %5s %6s %6s %6s %6s %6s %s\n",
210-
timestamp,duration,
211-
total_data_bytes_str,read_data_bytes_str,read_arclog_bytes_str,
212-
read_srvlog_bytes_str,write_bytes_str,status2str(backup->status));
213-
}
214-
}
215-
216-
staticvoid
217-
show_timeline_backup_list(FILE*out,parray*backup_list,boolshow_all)
218-
{
219-
inti;
220-
221-
/* show header */
222-
fputs("============================================================\n",out);
223-
fputs("Start Mode Current TLI Parent TLI Status \n",out);
224-
fputs("============================================================\n",out);
225-
226-
for (i=0;i<parray_num(backup_list);i++)
227-
{
228-
staticconstchar*modes[]= {"","ARCH","INCR","FULL"};
229-
230-
pgBackup*backup;
231-
chartimestamp[20];
232-
TimeLineIDparent_tli;
233-
234-
backup=parray_get(backup_list,i);
235-
236-
/* skip deleted backup and serverlog backup */
237-
if ((backup->status==BACKUP_STATUS_DELETED|| !HAVE_ARCLOG(backup))&&
238-
!show_all)
239-
continue;
240-
241-
time2iso(timestamp,lengthof(timestamp),backup->start_time);
242-
207+
/* Get parent timeline before printing */
243208
parent_tli=get_parent_tli(backup->tli);
244209

245-
fprintf(out,"%-19s %-4s %10d %10d %s\n",
246-
timestamp,modes[backup->backup_mode],backup->tli,parent_tli,
247-
status2str(backup->status));
210+
fprintf(out,"%-19s %-4s %10d %10d %5s %6s %6s %6s %6s %6s %s\n",
211+
timestamp,modes[backup->backup_mode],backup->tli,parent_tli,duration,
212+
total_data_bytes_str,read_data_bytes_str,read_arclog_bytes_str,
213+
read_srvlog_bytes_str,write_bytes_str,status2str(backup->status));
248214
}
249215
}
250216

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp