Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for generating incremental streams when pushing volumes #657

Merged
merged 18 commits into from
Sep 5, 2014

Conversation

exarkun
Copy link
Contributor

@exarkun exarkun commented Sep 3, 2014

This partially addresses #46 - but does not completely resolve it.

Added here is support for a new parameter to Filesystem.reader to specifying which snapshots the receiver has. The implementation uses this to generate an incremental stream if possible. Also added is IFilesystem.snapshots which can be used to get a value to pass for this parameter.

Work to glue this together with the actual push implementation will come in a follow-up.

…ssary for the other new functional test, as well as for other reasons).
…re-use elsewhere. Also change the behavior slightly so that the results are sorted by creation time rather than name.

Previously we considered encoding the creation time in the snapshot name itself but we have not actually done this yet.
The creation property that zfs itself maintains lets us get snapshots in a useful order.
The incremental send code wants to use the most recent snapshot - so having them ordered by creation time helps.
Also add a generic interface test for the extremely boring case - which
happens to be the only case the other implementation handles.
…t should have before. Also fix the test to catch this.
results = []
for snapshot in snapshots:
try:
results.append(SnapshotName.from_bytes(snapshot.name))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seems to be some inversion of abstraction going on here. File an issue.

@tomprince tomprince added accepted and removed review labels Sep 5, 2014
``some`` and ``others`` If no ``Snapshot`` appears in both, ``None`` is
returned.
"""
in_others = set(others).__contains__
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry @exarkun I didn't understand this 😕 Can you add an explanatory comment. Why not just:

others = set(others)
...
if snapshot in others:

@@ -165,8 +201,15 @@ def get_path(self):
return self._mountpoint

@contextmanager
def reader(self):
"""Send zfs stream of contents."""
def reader(self, remote_snapshots=None):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not part of this branch, but I find the reader / writer names a little confusing. I associate reader with the receiving end and writer with the sender. Do you think sender and receiver might be better names? For another ticket perhaps.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find it confusing too. When we switch to having a protocol I think these will probably just go away and we won't have to worry about the naming.

# snapshot will be able to exclude the data written above.
# Ultimately it would be better to have an API the purpose of which
# is explicitly to take a snapshot and to use that here instead of
# relying on `reader` to do this.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Link to a ticket?

@wallrj
Copy link
Contributor

wallrj commented Sep 5, 2014

Thanks @exarkun

LGTM too. I left a few additional inline comments. Feel free to ignore any that don't make sense.

exarkun added a commit that referenced this pull request Sep 5, 2014
…n-46

Add support for generating incremental streams when pushing volumes.
@exarkun exarkun merged commit 07fa05d into master Sep 5, 2014
@tomprince tomprince deleted the incremental-push-implementation-46 branch September 8, 2014 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants