Enhancement #69187
opencephfs-mirror: please sync the newest snapshot first, not oldest one
0%
Description
Let's suppose that there is a large directory with many pre-existing snapshots, and there are more changes between snapshots than usual. Let's say, 12 weekly snapshots, with 15% of data being replaced per week and not much data added. And also a CEO who demands that we back it up in an off-site cluster ASAP for business continuity reasons, and a decision to use cephfs-mirror for that.
So, CephFS mirroring is set up for that directory, and the data retention policy is modified to ensure that no snapshots are deleted until the process is complete.
Actual result: upon addition of that directory, cephfs-mirror tries to synchronize the oldest snapshot. Due to the sheer volume of data, it takes two weeks. Then, cephfs-mirror continues incrementally mirroring the next snapshot, and the next, and so on. It is projected to catch up in five more weeks. However, in two more weeks, the CEO wakes up and yells: "you still don't have a recent backup??? are you saying that your tool wasted time on the least important things without getting to the point??? you know you could have finished the backup of the current data in two weeks if you didn't waste time???"
In other words, cephfs-mirror gets the priorities backwards: business people want the most recently snapshotted data backed up first, and historical snapshots later, while cephfs-mirror mirrors the oldest snapshot (with the least business value) first. Please implement reverse chronological order for snapshot mirroring as an option or, maybe, even as the default behavior.
Updated by Venky Shankar over 1 year ago
- Assignee set to Jos Collin
- Target version set to v20.0.0
Updated by Alexander Patrakov about 1 year ago
On a second thought, this feature request should be put on hold until functionality is implemented to revert to an older snapshot quickly. Otherwise, if new snapshots are created while the hystorical ones are not all synced, there will be back-and-forth syncing of the whole diff between the oldest synced snapshot and the current state. If there are no plans to implement the revert functionality, please mark this feature request as invalid.
#69188 should be the way to go until then.
Updated by Jos Collin about 1 year ago
@patrakov @Venky Shankar
I think we could add option(s) to mention the Start Snapshot (Full Sync) and (if necessary) the End Snapshot, so that the user could configure the Sync List based on their business requirement. Wouldn't it resolve these two issues #69187 and #69188?
For example, if we have S1, S2, .... S10. The user could configure the Sync List as {S7, S10} or {S9, S10} based on their urgency. This way, there's no need to implement the reverse order sync. The user could also do {S10, S10} or just use the option --sync-only-the-latest-snapshot. WDYT?
Updated by Alexander Patrakov about 1 year ago
The start snapshot is definitely needed. I don't know if I want the end snapshot or not, so probably not. In other words, I don't see a use case for stopping earlier than the end of the history or for disallowing further mirroring.
The --sync-only-the-latest-snapshot option (when adding a directory) makes sense, as long as subsequent snapshots will also get mirrored. However, the name is ambiguous, so let's make it two options:
- One as a shorthand for starting with the latest snapshot, not mirroring anything earlier, but mirroring all snapshots after that.
- One for starting with the latest snapshot, and, once it is done, mirroring the then-latest snapshot, thus skipping everything in the middle, for the situation where cephfs-mirror is obviously too slow to catch up with every snapshot and thus has to skip, and so on.
Something else that I can think of, in addition to the start snapshot, is a filter for snapshot names based on a positive and a negative regular expression. For example, I would like to disallow mirroring of snapshots that include the word "daily" in their name (as the mirroring will likely spend too much time), or specifically allow it to mirror only snapshots that have the "auto" word in their name.
Updated by Jos Collin about 1 year ago ยท Edited
Alexander Patrakov wrote in #note-4:
The start snapshot is definitely needed. I don't know if I want the end snapshot or not, so probably not. In other words, I don't see a use case for stopping earlier than the end of the history or for disallowing further mirroring.
The --sync-only-the-latest-snapshot option (when adding a directory) makes sense, as long as subsequent snapshots will also get mirrored. However, the name is ambiguous, so let's make it two options:
- One as a shorthand for starting with the latest snapshot, not mirroring anything earlier, but mirroring all snapshots after that.
This new option (let's say --sync-only-the-latest-snapshot) makes sense only when the mirroring of a particular directory is in the off state and the user keep snapshot-ting. Then the user turn on mirroring by 'mirror add'ing the directory using --sync-only-the-latest-snapshot option and it syncs only the latest snapshot of that directory. The sync would be on from that point onwards.
If we have the first option (--sync-only-the-latest-snapshot), then the user could work it out by:
- One for starting with the latest snapshot, and, once it is done, mirroring the then-latest snapshot, thus skipping everything in the middle, for the situation where cephfs-mirror is obviously too slow to catch up with every snapshot and thus has to skip, and so on.
- Take snapshots without adding a directory.
- Turn on mirroring by adding the directory using --sync-only-the-latest-snapshot option.
- Turn it off (remove) and take more snapshots.
- Turn it on using --sync-only-the-latest-snapshot option.
Thus the intermediate snapshots for that directory would be skipped.
Something else that I can think of, in addition to the start snapshot, is a filter for snapshot names based on a positive and a negative regular expression. For example, I would like to disallow mirroring of snapshots that include the word "daily" in their name (as the mirroring will likely spend too much time), or specifically allow it to mirror only snapshots that have the "auto" word in their name.
This would be another enhancement and should be tracked separately.
Updated by Alexander Patrakov about 1 year ago
If we have the first option (--sync-only-the-latest-snapshot), then the user could work it out by:
Take snapshots without adding a directory.
Turn on mirroring by adding the directory using --sync-only-the-latest-snapshot option.
Turn it off (remove) and take more snapshots.
Turn it on using --sync-only-the-latest-snapshot option.Thus the intermediate snapshots for that directory would be skipped.
This would require changes to the automation that creates the snapshots. I would like to avoid this.
Besides, that automation should not know which snapshots are skipped. It should be decided by cephfs-mirror every time it finishes mirroring a snapshot (which is not the same time as the cron job that creates snapshots runs). Besides, if a user uses the built-in manager support for snapshot schedules (I don't), this suggestion becomes infeasible, because there is no point where a user would be able to insert the "turn on" / "turn off" steps.
In short: I would like to be able to take more automated snapshots than cephfs-mirror can process, as easily as possible and without any mirror-aware scripting, and still have a recent snapshot on the remote side.
Updated by Venky Shankar about 1 year ago
Alexander Patrakov wrote in #note-6:
If we have the first option (--sync-only-the-latest-snapshot), then the user could work it out by:
Take snapshots without adding a directory.
Turn on mirroring by adding the directory using --sync-only-the-latest-snapshot option.
Turn it off (remove) and take more snapshots.
Turn it on using --sync-only-the-latest-snapshot option.Thus the intermediate snapshots for that directory would be skipped.
This would require changes to the automation that creates the snapshots. I would like to avoid this.
Besides, that automation should not know which snapshots are skipped. It should be decided by cephfs-mirror every time it finishes mirroring a snapshot (which is not the same time as the cron job that creates snapshots runs). Besides, if a user uses the built-in manager support for snapshot schedules (I don't), this suggestion becomes infeasible, because there is no point where a user would be able to insert the "turn on" / "turn off" steps.
In short: I would like to be able to take more automated snapshots than cephfs-mirror can process, as easily as possible and without any mirror-aware scripting, and still have a recent snapshot on the remote side.
I like the idea in https://tracker.ceph.com/issues/69187#note-4.
@Jos Collin - suggest coming up with the CLI interfaces for the suggested enhancements before starting implementation.
Updated by Jos Collin about 1 year ago
- Status changed from New to In Progress
Venky Shankar wrote in #note-8:
Alexander Patrakov wrote in #note-6:
If we have the first option (--sync-only-the-latest-snapshot), then the user could work it out by:
Take snapshots without adding a directory.
Turn on mirroring by adding the directory using --sync-only-the-latest-snapshot option.
Turn it off (remove) and take more snapshots.
Turn it on using --sync-only-the-latest-snapshot option.Thus the intermediate snapshots for that directory would be skipped.
This would require changes to the automation that creates the snapshots. I would like to avoid this.
Besides, that automation should not know which snapshots are skipped. It should be decided by cephfs-mirror every time it finishes mirroring a snapshot (which is not the same time as the cron job that creates snapshots runs). Besides, if a user uses the built-in manager support for snapshot schedules (I don't), this suggestion becomes infeasible, because there is no point where a user would be able to insert the "turn on" / "turn off" steps.
In short: I would like to be able to take more automated snapshots than cephfs-mirror can process, as easily as possible and without any mirror-aware scripting, and still have a recent snapshot on the remote side.
I like the idea in https://tracker.ceph.com/issues/69187#note-4.
@Jos Collin - suggest coming up with the CLI interfaces for the suggested enhancements before starting implementation.
@Venky Shankar
We should continue using forward syncing which is feasible.
A new option '--sync-from-snapshot <snap_id>' for the command `fs snapshot mirror add` would work for all the cases mentioned in this ticket. Additionally, the CLI should also have a command to list the (snap_id, snap_name) for a given directory. It would be convenient for the user to do `fs snapshot mirror ls snaps <dir>` and decide which snapshot to start with.
Updated by Alexander Patrakov about 1 year ago
I agree that '--sync-from-snapshot <snap_id>' is the major part of the solution. It does cover all use cases except one, where cephfs-mirror is obviously too slow and the user would like to admit that. I will split this use case out into a separate ticket.
Updated by Jos Collin about 1 year ago
- Status changed from In Progress to Fix Under Review
- Pull request ID set to 61929