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

job snapshots prefix for replication filtering #459

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

calistoc
Copy link
Contributor

@calistoc calistoc commented Apr 7, 2021

This PR will allow job snapshots prefix for replication filtering.

Added optional parameter replication_snapshots_prefix that will tell zrepl to replicate only snapshots with the prefix provided, it is configurable only for push and source jobs and will be filtering the snapshots from the sender side. If not used zrepl will keep working as it used to replicating every snapshot created in the filesystem.

zrepl.yml syntax example:

  • type: push
    replication_snapshots_prefix: “zrepl_”

Should address #403

Please give it a try and see if it helps

Copy link
Member

@problame problame left a comment

Choose a reason for hiding this comment

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

Captured some of my comments from the thread in #403 so I don't forget them if we chose to go with the approach implemented in this PR.

zfs/versions.go Outdated
// Workaround when using JobSnapPrefix because bookmarks are not following
// the snapshotting prefix but they have fixed prefix:
// replicationCursorBookmarkNamePrefix = "zrepl_CURSOR"
if len(o.ShortnamePrefix) > 0 && len(o.Types) == 0 && v.Type == Bookmark && strings.HasPrefix(v.Name, "zrepl_CURSOR") {
Copy link
Member

Choose a reason for hiding this comment

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

We should just allow all bookmarks, probably rename ShortnamePrefix to SnapPrefix.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, thanks

Snapshotting SnapshottingEnum `yaml:"snapshotting"`
Filesystems FilesystemsFilter `yaml:"filesystems"`
Send *SendOptions `yaml:"send,fromdefaults,optional"`
JobSnapPrefix string `yaml:"replication_snapshots_prefix,optional"`
Copy link
Member

Choose a reason for hiding this comment

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

Needs coverage in docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added some docs, I hope I did it right and also it is enough, feel free to change anything.

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 got some errors with the circleci checks.
It looks better now but the test-go-on-latest-go-release check is still failing, no idea why yet, any help is welcome:)

fsvs, err := zfs.ZFSListFilesystemVersions(ctx, lp, zfs.ListFilesystemVersionsOptions{})

fsvs, err := zfs.ZFSListFilesystemVersions(ctx, lp, zfs.ListFilesystemVersionsOptions{
ShortnamePrefix: s.config.JobSnapPrefix,
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should have something more flexible than just prefix matching?
See my ideas in #403 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure there is space for improvements, I’ll think about it but I can’t promise anything in a short time.

@wrenix
Copy link

wrenix commented Oct 6, 2023

any update on this?

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.

None yet

3 participants