Merge lp:~yajo/duplicity/duplicity into lp:~duplicity-team/duplicity/0.7-series
- duplicity
- Merge into 0.7-series
Status: | Merged |
---|---|
Merged at revision: | 1373 |
Proposed branch: | lp:~yajo/duplicity/duplicity |
Merge into: | lp:~duplicity-team/duplicity/0.7-series |
Diff against target: |
126 lines (+44/-7) 4 files modified
bin/duplicity (+28/-7) bin/duplicity.1 (+8/-0) duplicity/commandline.py (+5/-0) duplicity/globals.py (+3/-0) |
To merge this branch: | bzr merge lp:~yajo/duplicity/duplicity |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
edso | Approve | ||
Review via email: mp+366358@code.launchpad.net |
Commit message
Description of the change
Support partial metadata sync.
Fixes bug #1823858 by letting the user to choose partial syncing. Only the metadata for the target chain will be downloaded. If older (or newer) chains are encrypted with a different passphrase, the user will be able to restore to a given time by supplying only the passphrase for the chain selected by the `--restore-time` option when using this new option.
A side effect is that using this flag reduces dramatically the sync time when moving files from one to another location, in cases where big amounts of chains are found.
Aaron Whitehouse (aaron-whitehouse) wrote : | # |
edso (ed.so) wrote : | # |
hi Yajo,
the approach seems sound. however here some small issues, apart from the merge request against the old stable branch.
1. leftover debugger import
+ import pudb; pudb.set_trace()
2. new default sync mode should be partial, as it is faster and transfers only needed files
3.
+from gettext import gettext as _
looks redundant. gettext should be imported by 'duplicity/
nice that you updated the manpage accordingly already!
..ede/duply.net
- 1373. By Yajo
-
Support partial metadata sync.
Fixes bug #1823858 by letting the user to choose partial syncing. Only the metadata for the target chain will be downloaded. If older (or newer) chains are encrypted with a different passphrase, the user will be able to restore to a given time by supplying only the passphrase for the chain selected by the `--restore-time` option when using this new option.
A side effect is that using this flag reduces dramatically the sync time when moving files from one to another location, in cases where big amounts of chains are found.
Yajo (yajo) wrote : | # |
Hi there, concerns 1 and 3 fixed.
About number 2, the problem is that I really need this patch in 0.7 because I'm hitting bug #1823858 it in production, whereas 0.8 is not yet released. This is half feature half bugfix, but TBH what motivated me most to push the MR is the bugfix.
I thought that a good approach would be to add the feature but disable it by default (as I did) in 0.7, but in 0.8 we could default to the partial sync mode because, as you say, it is has most benefits.
Or can you think a better solution?
edso (ed.so) wrote : | # |
> Hi there, concerns 1 and 3 fixed.
thx
> About number 2, the problem is that I really need this patch in 0.7 because I'm hitting bug #1823858 it in production, whereas 0.8 is not yet released. This is half feature half bugfix, but TBH what motivated me most to push the MR is the bugfix.
sounds reasonable. disabled by default even 0.7 could benefit.
> I thought that a good approach would be to add the feature but disable it by default (as I did) in 0.7, but in 0.8 we could default to the partial sync mode because, as you say, it is has most benefits.
>
> Or can you think a better solution?
nope. perfectly valid reasoning. in the end it's up to Ken the maintainer.
@Ken: what do you say?
..ede/duply.net
Yajo (yajo) wrote : | # |
Thanks for the merge!
Could you push a new 0.7 release with this patch included?
Kenneth Loafman (kenneth-loafman) wrote : | # |
Yes, I'll do that soon.
On Mon, Apr 29, 2019 at 2:44 AM Yajo <email address hidden> wrote:
> Thanks for the merge!
>
> Could you push a new 0.7 release with this patch included?
> --
> https:/
> You are subscribed to branch lp:duplicity/0.7-series.
>
edso (ed.so) wrote : | # |
hey Ken,
it's not committed to 0.8 so far. please do not forget.
also i'd say we make 'partial' default from 0.8 on, as argumented in the merge ticket. ..ede
On 29.04.2019 14:06, Kenneth Loafman wrote:
> Yes, I'll do that soon.
>
> On Mon, Apr 29, 2019 at 2:44 AM Yajo <email address hidden> wrote:
>
>> Thanks for the merge!
>>
>> Could you push a new 0.7 release with this patch included?
>> --
>> https:/
>> You are subscribed to branch lp:duplicity/0.7-series.
>>
>
Kenneth Loafman (kenneth-loafman) wrote : | # |
Hi ede,
I'm working on it now. Have to do some of the changes manually for 0.8.
Lots of changes since 0.7!
...Ken
On Mon, Apr 29, 2019 at 7:19 AM edso <email address hidden> wrote:
> hey Ken,
>
> it's not committed to 0.8 so far. please do not forget.
>
> also i'd say we make 'partial' default from 0.8 on, as argumented in the
> merge ticket. ..ede
>
> On 29.04.2019 14:06, Kenneth Loafman wrote:
> > Yes, I'll do that soon.
> >
> > On Mon, Apr 29, 2019 at 2:44 AM Yajo <email address hidden> wrote:
> >
> >> Thanks for the merge!
> >>
> >> Could you push a new 0.7 release with this patch included?
> >> --
> >> https:/
> >> You are subscribed to branch lp:duplicity/0.7-series.
> >>
> >
>
>
> --
> https:/
> You are subscribed to branch lp:duplicity/0.7-series.
>
edso (ed.so) wrote : | # |
maybe Yajo wants to help wrt. this issue in 0.8? Yajo got the time? ..ede/duply.net
On 03.05.2019 21:39, Kenneth Loafman wrote:
> Hi ede,
>
> I'm working on it now. Have to do some of the changes manually for 0.8.
> Lots of changes since 0.7!
>
> ...Ken
>
> On Mon, Apr 29, 2019 at 7:19 AM edso <email address hidden> wrote:
>
>> hey Ken,
>>
>> it's not committed to 0.8 so far. please do not forget.
>>
>> also i'd say we make 'partial' default from 0.8 on, as argumented in the
>> merge ticket. ..ede
>>
>> On 29.04.2019 14:06, Kenneth Loafman wrote:
>>> Yes, I'll do that soon.
>>>
>>> On Mon, Apr 29, 2019 at 2:44 AM Yajo <email address hidden> wrote:
>>>
>>>> Thanks for the merge!
>>>>
>>>> Could you push a new 0.7 release with this patch included?
>>>> --
>>>> https:/
>>>> You are subscribed to branch lp:duplicity/0.7-series.
>>>>
>>>
>>
>>
>> --
>> https:/
>> You are subscribed to branch lp:duplicity/0.7-series.
>>
>
Kenneth Loafman (kenneth-loafman) wrote : | # |
ede,
Manual merge is done. Should have it out in a couple of days.
...Ken
On Sat, May 4, 2019 at 5:06 AM edso <email address hidden> wrote:
> maybe Yajo wants to help wrt. this issue in 0.8? Yajo got the time? ..ede/
> duply.net
>
> On 03.05.2019 21:39, Kenneth Loafman wrote:
> > Hi ede,
> >
> > I'm working on it now. Have to do some of the changes manually for 0.8.
> > Lots of changes since 0.7!
> >
> > ...Ken
> >
> > On Mon, Apr 29, 2019 at 7:19 AM edso <email address hidden> wrote:
> >
> >> hey Ken,
> >>
> >> it's not committed to 0.8 so far. please do not forget.
> >>
> >> also i'd say we make 'partial' default from 0.8 on, as argumented in the
> >> merge ticket. ..ede
> >>
> >> On 29.04.2019 14:06, Kenneth Loafman wrote:
> >>> Yes, I'll do that soon.
> >>>
> >>> On Mon, Apr 29, 2019 at 2:44 AM Yajo <email address hidden> wrote:
> >>>
> >>>> Thanks for the merge!
> >>>>
> >>>> Could you push a new 0.7 release with this patch included?
> >>>> --
> >>>> https:/
> >>>> You are subscribed to branch lp:duplicity/0.7-series.
> >>>>
> >>>
> >>
> >>
> >> --
> >> https:/
> >> You are subscribed to branch lp:duplicity/0.7-series.
> >>
> >
>
>
> --
> https:/
> You are subscribed to branch lp:duplicity/0.7-series.
>
edso (ed.so) wrote : | # |
Ken,
probably local at your box still? it's not merged afaics https:/
..ede
On 04.05.2019 18:30, Kenneth Loafman wrote:
> ede,
>
> Manual merge is done. Should have it out in a couple of days.
>
> ...Ken
>
>
> On Sat, May 4, 2019 at 5:06 AM edso <email address hidden> wrote:
>
>> maybe Yajo wants to help wrt. this issue in 0.8? Yajo got the time? ..ede/
>> duply.net
>>
>> On 03.05.2019 21:39, Kenneth Loafman wrote:
>>> Hi ede,
>>>
>>> I'm working on it now. Have to do some of the changes manually for 0.8.
>>> Lots of changes since 0.7!
>>>
>>> ...Ken
>>>
>>> On Mon, Apr 29, 2019 at 7:19 AM edso <email address hidden> wrote:
>>>
>>>> hey Ken,
>>>>
>>>> it's not committed to 0.8 so far. please do not forget.
>>>>
>>>> also i'd say we make 'partial' default from 0.8 on, as argumented in the
>>>> merge ticket. ..ede
>>>>
>>>> On 29.04.2019 14:06, Kenneth Loafman wrote:
>>>>> Yes, I'll do that soon.
>>>>>
>>>>> On Mon, Apr 29, 2019 at 2:44 AM Yajo <email address hidden> wrote:
>>>>>
>>>>>> Thanks for the merge!
>>>>>>
>>>>>> Could you push a new 0.7 release with this patch included?
>>>>>> --
>>>>>> https:/
>>>>>> You are subscribed to branch lp:duplicity/0.7-series.
>>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> https:/
>>>> You are subscribed to branch lp:duplicity/0.7-series.
>>>>
>>>
>>
>>
>> --
>> https:/
>> You are subscribed to branch lp:duplicity/0.7-series.
>>
>
Kenneth Loafman (kenneth-loafman) wrote : | # |
ede,
It's there now. Was unable to test. My python3 install needs to be fixed.
Please test and let me know.
...Ken
On Sun, May 5, 2019 at 6:33 AM edso <email address hidden> wrote:
> Ken,
>
> probably local at your box still? it's not merged afaics
> https:/
>
> ..ede
>
> On 04.05.2019 18:30, Kenneth Loafman wrote:
> > ede,
> >
> > Manual merge is done. Should have it out in a couple of days.
> >
> > ...Ken
> >
> >
> > On Sat, May 4, 2019 at 5:06 AM edso <email address hidden> wrote:
> >
> >> maybe Yajo wants to help wrt. this issue in 0.8? Yajo got the time?
> ..ede/
> >> duply.net
> >>
> >> On 03.05.2019 21:39, Kenneth Loafman wrote:
> >>> Hi ede,
> >>>
> >>> I'm working on it now. Have to do some of the changes manually for
> 0.8.
> >>> Lots of changes since 0.7!
> >>>
> >>> ...Ken
> >>>
> >>> On Mon, Apr 29, 2019 at 7:19 AM edso <email address hidden> wrote:
> >>>
> >>>> hey Ken,
> >>>>
> >>>> it's not committed to 0.8 so far. please do not forget.
> >>>>
> >>>> also i'd say we make 'partial' default from 0.8 on, as argumented in
> the
> >>>> merge ticket. ..ede
> >>>>
> >>>> On 29.04.2019 14:06, Kenneth Loafman wrote:
> >>>>> Yes, I'll do that soon.
> >>>>>
> >>>>> On Mon, Apr 29, 2019 at 2:44 AM Yajo <email address hidden> wrote:
> >>>>>
> >>>>>> Thanks for the merge!
> >>>>>>
> >>>>>> Could you push a new 0.7 release with this patch included?
> >>>>>> --
> >>>>>> https:/
> >>>>>> You are subscribed to branch lp:duplicity/0.7-series.
> >>>>>>
> >>>>>
> >>>>
> >>>>
> >>>> --
> >>>> https:/
> >>>> You are subscribed to branch lp:duplicity/0.7-series.
> >>>>
> >>>
> >>
> >>
> >> --
> >> https:/
> >> You are subscribed to branch lp:duplicity/0.7-series.
> >>
> >
>
>
> --
> https:/
> You are subscribed to branch lp:duplicity/0.7-series.
>
edso (ed.so) wrote : | # |
unfortunately no time, no setup. Yajo, would you mind? ..ede
On 05.05.2019 14:21, Kenneth Loafman wrote:
> ede,
>
> It's there now. Was unable to test. My python3 install needs to be fixed.
>
> Please test and let me know.
>
> ...Ken
>
> On Sun, May 5, 2019 at 6:33 AM edso <email address hidden> wrote:
>
>> Ken,
>>
>> probably local at your box still? it's not merged afaics
>> https:/
>>
>> ..ede
>>
>> On 04.05.2019 18:30, Kenneth Loafman wrote:
>>> ede,
>>>
>>> Manual merge is done. Should have it out in a couple of days.
>>>
>>> ...Ken
>>>
>>>
>>> On Sat, May 4, 2019 at 5:06 AM edso <email address hidden> wrote:
>>>
>>>> maybe Yajo wants to help wrt. this issue in 0.8? Yajo got the time?
>> ..ede/
>>>> duply.net
>>>>
>>>> On 03.05.2019 21:39, Kenneth Loafman wrote:
>>>>> Hi ede,
>>>>>
>>>>> I'm working on it now. Have to do some of the changes manually for
>> 0.8.
>>>>> Lots of changes since 0.7!
>>>>>
>>>>> ...Ken
>>>>>
>>>>> On Mon, Apr 29, 2019 at 7:19 AM edso <email address hidden> wrote:
>>>>>
>>>>>> hey Ken,
>>>>>>
>>>>>> it's not committed to 0.8 so far. please do not forget.
>>>>>>
>>>>>> also i'd say we make 'partial' default from 0.8 on, as argumented in
>> the
>>>>>> merge ticket. ..ede
>>>>>>
>>>>>> On 29.04.2019 14:06, Kenneth Loafman wrote:
>>>>>>> Yes, I'll do that soon.
>>>>>>>
>>>>>>> On Mon, Apr 29, 2019 at 2:44 AM Yajo <email address hidden> wrote:
>>>>>>>
>>>>>>>> Thanks for the merge!
>>>>>>>>
>>>>>>>> Could you push a new 0.7 release with this patch included?
>>>>>>>> --
>>>>>>>> https:/
>>>>>>>> You are subscribed to branch lp:duplicity/0.7-series.
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> https:/
>>>>>> You are subscribed to branch lp:duplicity/0.7-series.
>>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> https:/
>>>> You are subscribed to branch lp:duplicity/0.7-series.
>>>>
>>>
>>
>>
>> --
>> https:/
>> You are subscribed to branch lp:duplicity/0.7-series.
>>
>
Preview Diff
1 | === modified file 'bin/duplicity' | |||
2 | --- bin/duplicity 2018-09-28 13:55:53 +0000 | |||
3 | +++ bin/duplicity 2019-04-24 07:53:33 +0000 | |||
4 | @@ -1020,7 +1020,7 @@ | |||
5 | 1020 | _("Rerun command with --force option to actually delete.")) | 1020 | _("Rerun command with --force option to actually delete.")) |
6 | 1021 | 1021 | ||
7 | 1022 | 1022 | ||
9 | 1023 | def sync_archive(): | 1023 | def sync_archive(col_stats): |
10 | 1024 | """ | 1024 | """ |
11 | 1025 | Synchronize local archive manifest file and sig chains to remote archives. | 1025 | Synchronize local archive manifest file and sig chains to remote archives. |
12 | 1026 | Copy missing files from remote to local as needed to make sure the local | 1026 | Copy missing files from remote to local as needed to make sure the local |
13 | @@ -1031,6 +1031,27 @@ | |||
14 | 1031 | """ | 1031 | """ |
15 | 1032 | suffixes = [".g", ".gpg", ".z", ".gz", ".part"] | 1032 | suffixes = [".g", ".gpg", ".z", ".gz", ".part"] |
16 | 1033 | 1033 | ||
17 | 1034 | def is_needed(filename): | ||
18 | 1035 | """Indicates if the metadata file should be synced. | ||
19 | 1036 | |||
20 | 1037 | In full sync mode, or if there's a collection misbehavior, all files | ||
21 | 1038 | are needed. | ||
22 | 1039 | |||
23 | 1040 | Otherwise, only the metadata for the target chain needs sync. | ||
24 | 1041 | """ | ||
25 | 1042 | if globals.metadata_sync_mode == "full": | ||
26 | 1043 | return True | ||
27 | 1044 | assert globals.metadata_sync_mode == "partial" | ||
28 | 1045 | parsed = file_naming.parse(filename) | ||
29 | 1046 | try: | ||
30 | 1047 | target_chain = col_stats.get_backup_chain_at_time( | ||
31 | 1048 | globals.restore_time or dup_time.curtime) | ||
32 | 1049 | except collections.CollectionsError: | ||
33 | 1050 | # With zero or multiple chains at this time, do a full sync | ||
34 | 1051 | return True | ||
35 | 1052 | return parsed.end_time >= target_chain.start_time and \ | ||
36 | 1053 | parsed.start_time <= target_chain.end_time | ||
37 | 1054 | |||
38 | 1034 | def get_metafiles(filelist): | 1055 | def get_metafiles(filelist): |
39 | 1035 | """ | 1056 | """ |
40 | 1036 | Return metafiles of interest from the file list. | 1057 | Return metafiles of interest from the file list. |
41 | @@ -1180,7 +1201,7 @@ | |||
42 | 1180 | # already have a local partial. The local partial will already be | 1201 | # already have a local partial. The local partial will already be |
43 | 1181 | # complete in this case (seems we got interrupted before we could move | 1202 | # complete in this case (seems we got interrupted before we could move |
44 | 1182 | # it to its final location). | 1203 | # it to its final location). |
46 | 1183 | if key not in local_keys and key not in local_partials: | 1204 | if key not in local_keys and key not in local_partials and is_needed(key): |
47 | 1184 | local_missing.append(remote_metafiles[key]) | 1205 | local_missing.append(remote_metafiles[key]) |
48 | 1185 | 1206 | ||
49 | 1186 | for key in local_keys: | 1207 | for key in local_keys: |
50 | @@ -1414,15 +1435,15 @@ | |||
51 | 1414 | # check for disk space and available file handles | 1435 | # check for disk space and available file handles |
52 | 1415 | check_resources(action) | 1436 | check_resources(action) |
53 | 1416 | 1437 | ||
54 | 1417 | # check archive synch with remote, fix if needed | ||
55 | 1418 | if action not in ["collection-status"]: | ||
56 | 1419 | sync_archive() | ||
57 | 1420 | |||
58 | 1421 | # get current collection status | 1438 | # get current collection status |
59 | 1422 | col_stats = collections.CollectionsStatus(globals.backend, | 1439 | col_stats = collections.CollectionsStatus(globals.backend, |
60 | 1423 | globals.archive_dir, | 1440 | globals.archive_dir, |
61 | 1424 | action).set_values() | 1441 | action).set_values() |
62 | 1425 | 1442 | ||
63 | 1443 | # check archive synch with remote, fix if needed | ||
64 | 1444 | if action not in ["collection-status"]: | ||
65 | 1445 | sync_archive(col_stats) | ||
66 | 1446 | |||
67 | 1426 | while True: | 1447 | while True: |
68 | 1427 | # if we have to clean up the last partial, then col_stats are invalidated | 1448 | # if we have to clean up the last partial, then col_stats are invalidated |
69 | 1428 | # and we have to start the process all over again until clean. | 1449 | # and we have to start the process all over again until clean. |
70 | @@ -1488,7 +1509,7 @@ | |||
71 | 1488 | elif action == "remove-all-but-n-full" or action == "remove-all-inc-of-but-n-full": | 1509 | elif action == "remove-all-but-n-full" or action == "remove-all-inc-of-but-n-full": |
72 | 1489 | remove_all_but_n_full(col_stats) | 1510 | remove_all_but_n_full(col_stats) |
73 | 1490 | elif action == "sync": | 1511 | elif action == "sync": |
75 | 1491 | sync_archive() | 1512 | sync_archive(col_stats) |
76 | 1492 | else: | 1513 | else: |
77 | 1493 | assert action == "inc" or action == "full", action | 1514 | assert action == "inc" or action == "full", action |
78 | 1494 | # the passphrase for full and inc is used by --sign-key | 1515 | # the passphrase for full and inc is used by --sign-key |
79 | 1495 | 1516 | ||
80 | === modified file 'bin/duplicity.1' | |||
81 | --- bin/duplicity.1 2019-01-26 16:37:54 +0000 | |||
82 | +++ bin/duplicity.1 2019-04-24 07:53:33 +0000 | |||
83 | @@ -882,6 +882,14 @@ | |||
84 | 882 | .BR "A NOTE ON SSL CERTIFICATE VERIFICATION" . | 882 | .BR "A NOTE ON SSL CERTIFICATE VERIFICATION" . |
85 | 883 | 883 | ||
86 | 884 | .TP | 884 | .TP |
87 | 885 | .BI "--metadata-sync-mode " mode | ||
88 | 886 | This option defaults to 'full', but you can set it to 'partial' | ||
89 | 887 | to avoid syncing metadata for backup chains that you are not going to use. | ||
90 | 888 | This saves time when restoring for the first time, and lets you restore an | ||
91 | 889 | old backup that was encrypted with a different passphrase by supplying only | ||
92 | 890 | the target passphrase. | ||
93 | 891 | |||
94 | 892 | .TP | ||
95 | 885 | .BI "--tempdir " directory | 893 | .BI "--tempdir " directory |
96 | 886 | Use this existing directory for duplicity temporary files instead of | 894 | Use this existing directory for duplicity temporary files instead of |
97 | 887 | the system default, which is usually the /tmp directory. This option | 895 | the system default, which is usually the /tmp directory. This option |
98 | 888 | 896 | ||
99 | === modified file 'duplicity/commandline.py' | |||
100 | --- duplicity/commandline.py 2018-02-01 21:17:08 +0000 | |||
101 | +++ duplicity/commandline.py 2019-04-24 07:53:33 +0000 | |||
102 | @@ -491,6 +491,11 @@ | |||
103 | 491 | callback=lambda o, s, v, p: (setattr(p.values, o.dest, True), | 491 | callback=lambda o, s, v, p: (setattr(p.values, o.dest, True), |
104 | 492 | old_fn_deprecation(s))) | 492 | old_fn_deprecation(s))) |
105 | 493 | 493 | ||
106 | 494 | # Sync only required metadata | ||
107 | 495 | parser.add_option("--metadata-sync-mode", | ||
108 | 496 | default="full", | ||
109 | 497 | choices=("full", "partial")) | ||
110 | 498 | |||
111 | 494 | # Level of Redundancy in % for Par2 files | 499 | # Level of Redundancy in % for Par2 files |
112 | 495 | parser.add_option("--par2-redundancy", type="int", metavar=_("number")) | 500 | parser.add_option("--par2-redundancy", type="int", metavar=_("number")) |
113 | 496 | 501 | ||
114 | 497 | 502 | ||
115 | === modified file 'duplicity/globals.py' | |||
116 | --- duplicity/globals.py 2018-02-01 21:17:08 +0000 | |||
117 | +++ duplicity/globals.py 2019-04-24 07:53:33 +0000 | |||
118 | @@ -225,6 +225,9 @@ | |||
119 | 225 | # Can be changed with a command line argument. | 225 | # Can be changed with a command line argument. |
120 | 226 | imap_mailbox = "INBOX" | 226 | imap_mailbox = "INBOX" |
121 | 227 | 227 | ||
122 | 228 | # Sync all metadata by default | ||
123 | 229 | metadata_sync_mode = "full" | ||
124 | 230 | |||
125 | 228 | # Whether the old filename format is in effect. | 231 | # Whether the old filename format is in effect. |
126 | 229 | old_filenames = False | 232 | old_filenames = False |
127 | 230 | 233 |
Thank you for your work, Yajo.
Is there a reason that you have requested to merge this into the 0.7 series instead of the main duplicity (0.8 series)?
0.7 is not really suited for new features at this point.