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

multiple formats (or reguar expression matching) #2

Open
hvisage opened this issue Sep 5, 2021 · 3 comments
Open

multiple formats (or reguar expression matching) #2

hvisage opened this issue Sep 5, 2021 · 3 comments

Comments

@hvisage
Copy link

hvisage commented Sep 5, 2021

Perhaps an option to include multiple matches, especially when there is hourly/monthly/frequent snapshots already pre-created or a naming change happened.

@apreiml
Copy link
Owner

apreiml commented Sep 5, 2021

I also have the case where I did not change an error in the backup filename format yet, because of prunef.
I've accidentally switched the month with the day like backup-2021-09-05 which is annoying, because it's not sorted properly.

Though adding the possibility to include multiple matches may lead to annoying issues. Like if I would change my format to %m-%d and add %d-%m and %m-%d as format options to prunef, new entries will also be parsed with the old format, if the day is below 13, which may result in the unexpected loss of backups.

So I'm rather against adding this option.

A fix would be just to rename the old filenames, but what can one do, if renaming is not possible?

@hvisage
Copy link
Author

hvisage commented Sep 5, 2021

swapping things like %d-%m and %m-%d is not my example, but rather similar to my example I gave on the other issue:

zfs list -t snap  data1/ClientA/mariadb04_log > /tmp/list
grep frequent /tmp/list | prunef --keep-minutely 2880 --keep-hourly 48 'data1/ClientA/mariadb04_log@zfs-auto-snap_frequent-%Y-%m-%d-%H%M'
grep hourly /tmp/list  | prunef --keep-hourly 336  'data1/ClientA/mariadb04_log@zfs-auto-snap_hourly-%Y-%m-%d-%H%M'
grep daily /tmp/list  | prunef --keep-weekly 12 --keep-monthly 24 --keep-yearly 20 --keep-daily 30  'data1/ClientA/mariadb04_log@zfs-auto-snap_daily-%Y-%m-%d-%H%M'

I'd actually would've like to "merge" these (reason for my regex type request). These names comes from a different system, and sometimes those daily gets missed for known reasons related to the up syncing and those getting removed before the sync, and why I'd like to then continue using the best frequent (in the absence of hourly/daily).

Would save me to do continuous (on the receiving side) renames, but again, if there are reasons for not implementing, I'll handle it accordingly

@apreiml
Copy link
Owner

apreiml commented Sep 10, 2021

There is no reason against implementing. I'm just considering options and possible disadvantages that may arise when implementing.

What about glob? https://pkg.go.dev/path#Match would this work for your case? You could maybe make a rule like data1/ClientA/mariadb04_log@zfs-auto-snap_*-%Y-%m-%d-%H%M

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

No branches or pull requests

2 participants