Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 4cb028c

Browse files
author
Artur Zakirov
committed
Show dashes if there isn't recovery time of a backup
1 parent bf2830b commit 4cb028c

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
lines changed

show.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,13 +189,14 @@ show_backup_list(FILE *out, parray *backup_list)
189189
pgBackup *backup;
190190
const char *modes[] = { "", "PAGE", "PTRACK", "FULL", "", "PAGE+STREAM", "PTRACK+STREAM", "FULL+STREAM"};
191191
TimeLineID parent_tli;
192-
char timestamp[20];
192+
char timestamp[20] = "----";
193193
char duration[20] = "----";
194194
char data_bytes_str[10] = "----";
195195

196196
backup = parray_get(backup_list, i);
197197

198-
time2iso(timestamp, lengthof(timestamp), backup->recovery_time);
198+
if (backup->recovery_time != (time_t) 0)
199+
time2iso(timestamp, lengthof(timestamp), backup->recovery_time);
199200
if (backup->end_time != (time_t) 0)
200201
snprintf(duration, lengthof(duration), "%lum",
201202
(backup->end_time - backup->start_time) / 60);

tests/pb_lib.py

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,30 @@ def dir_files(base_dir):
1919

2020
class ShowBackup(object):
2121
def __init__(self, split_line):
22-
self.id = split_line[0]
22+
self.counter = 0
23+
24+
self.id = self.get_inc(split_line)
2325
# TODO: parse to datetime
24-
self.recovery_time = "%s %s" % (split_line[1], split_line[2])
25-
self.mode = split_line[3]
26-
self.cur_tli = split_line[4]
27-
self.parent_tli = split_line[6]
26+
if len(split_line) == 10:
27+
self.recovery_time = "%s %s" % (self.get_inc(split_line),
28+
self.get_inc(split_line))
29+
# if recovery time is '----'
30+
else:
31+
self.recovery_time = self.get_inc(split_line)
32+
self.mode = self.get_inc(split_line)
33+
self.cur_tli = self.get_inc(split_line)
34+
# slash
35+
self.counter += 1
36+
self.parent_tli = self.get_inc(split_line)
2837
# TODO: parse to interval
29-
self.time = split_line[7]
38+
self.time = self.get_inc(split_line)
3039
# TODO: maybe rename to size?
31-
self.data = split_line[8]
32-
self.status = split_line[9]
40+
self.data = self.get_inc(split_line)
41+
self.status = self.get_inc(split_line)
42+
43+
def get_inc(self, split_line):
44+
self.counter += 1
45+
return split_line[self.counter - 1]
3346

3447

3548
class ProbackupTest(object):

0 commit comments

Comments
 (0)