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

make createtxg and guid properties public #6102

Merged
merged 1 commit into from
May 9, 2017

Conversation

problame
Copy link
Contributor

@problame problame commented May 5, 2017

Description

Document the existence of createtxg and guid native properties in
man pages and zfs command output.

Motivation and Context

One of the great features of ZFS is incremental replication of
snapshots, possibly between pools on different machines.

Shell scripts are commonly used to auomate this procedure. They have to
find the most recent common snapshot between both sides and then
perform incremental send & recv.
Currently, scripts rely on the sorting order of zfs list, which
defaults to createtxg, and the assumption that snapshot names on
either side do not change.

By making createtxg and guid part of the public ZFS interface,
scripts are enabled to use

a) createtxg to determine the logical & temporal order of snapshots
(the creation property is not an equivalent substitute since
multiple snapshots may be created within one second)
b) guid to uniquely identify a snapshot, independent of its current
display name

This has the potential of making scripts safer and correct.

How Has This Been Tested?

The module was built on ArchLinux and Debian Jessie, up-to-date on 05 May 2017.
The output of zfs get and man zfs was checked to include the now public properties.

Types of changes

  • man pages
  • zfs get output
  • remove C comment

Checklist:

  • My code follows the ZFS on Linux code style requirements.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • All commit messages are properly formatted and contain Signed-off-by.
  • Change has been approved by a ZFS on Linux member.

Remarks from author

Should this be upstreamed?

@mention-bot
Copy link

@problame, thanks for your PR! By analyzing the history of the files in this pull request, we identified @behlendorf, @ahrens and @rlaager to be potential reviewers.

man/man8/zfs.8 Outdated
.ad
.sp .6
.RS 4n
The transaction group (TXG) in which the dataset or bookmark was created. It is suitable for ordering a list of snapshots, e.g. for incremental \fBsend\fR & \fBrecv\fR.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it should be made more clear that a bookmark's createtxg is not the TXG in which the bookmark itself was created, but in which the snapshot from which the bookmark was derived from was created. Hence a snapshot and its bookmark (assuming both exist at the same time) will have the same createtxg value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adressed in a4da85a

Should I squash each time I respond to a comment or rather squash right before merge?

Copy link
Member

Choose a reason for hiding this comment

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

You can squash immediately if your changes are not so big, it will make the merge process faster.

Copy link
Member

@rlaager rlaager left a comment

Choose a reason for hiding this comment

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

Looking only at the diff (having not run the code), this looks good.

@DeHackEd
Copy link
Contributor

DeHackEd commented May 5, 2017

If I had to be really really picky, snapshots are already sorted by createtxg when they are a member of the same dataset. But that's a pretty minor complaint.

(Default sort order is by name for non-snapshots, then by createtxg for snapshots of the same dataset)

Document the existence of `createtxg` and `guid` native properties in
man pages and zfs command output.

One of the great features of ZFS is incremental replication of
snapshots, possibly between pools on different machines.

Shell scripts are commonly used to auomate this procedure. They have to
find the most recent common snapshot between both sides and then
perform incremental send & recv.
Currently, scripts rely on the sorting order of `zfs list`, which
defaults to `createtxg`, and the assumption that snapshot names on
either side do not change.

By making `createtxg` and `guid` part of the public ZFS interface,
scripts are enabled to use

  a) `createtxg` to determine the logical & temporal order of snapshots
     (the creation property is not an equivalent substitute since
      multiple snapshots may be created within one second)
  b) `guid` to uniquely identify a snapshot, independent of its current
      display name

This has the potential of making scripts safer and correct.

Signed-off-by: Christian Schwarz <me@cschwarz.com>
@problame
Copy link
Contributor Author

problame commented May 6, 2017

Squashed and ready to go.

@rlaager do I have to take care of upstreaming the change to OpenZFS myself or is this done in some automated fashion?

@rlaager
Copy link
Member

rlaager commented May 7, 2017

It's a separate process (with I'm not familiar with) to upstream to OpenZFS.

Copy link
Contributor

@behlendorf behlendorf left a comment

Choose a reason for hiding this comment

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

Thanks. Looks good.

@behlendorf behlendorf merged commit 305bc4b into openzfs:master May 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants