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

subcommand for job renames #327

Open
3 tasks
problame opened this issue Jun 1, 2020 · 5 comments
Open
3 tasks

subcommand for job renames #327

problame opened this issue Jun 1, 2020 · 5 comments
Labels
Milestone

Comments

@problame
Copy link
Member

problame commented Jun 1, 2020

  • job names are persisted locally on disk / in zfs abstractions
  • job names are not persisted on remote systems

Therefore, a CLI command could do the job.

Requirements:

  • be able to render a plan of what it is going to do
  • be idempotent (i.e. work even if it crashes in the middle)
    • allowed to make the assumption that the original job name has not yet been reused
  • 3-step interaction
    • persist somewhere that the job is being renamed
    • make sure the job is not running in the daemon (and won't run on restart)
      • sufficient to kill the daemon and have some kind of disabled blacklist somewhere
    • do the idempotent rename operation(s)
    • tell the user to
      • rename the job in the zrepl.yml
      • invoke a zrepl rename complete OLDJOB NEWJOB command that
        • un-blacklists the old job name (making it available for a new job definition)
        • re-starts the new job name (pbly ok to just restart the daemon, or tell the user to do it)

Additional thoughts:

  • we could also think about having job GUIDs and only aliases to refer to jobs, but those GUIDs would also need to be stored in some kind of database etc
    • design proposals welcome, in the meantime, a rename command is pbly good enough
@problame problame added this to the 0.4 milestone Jun 1, 2020
@problame problame modified the milestones: 0.4, 0.5 Feb 20, 2021
@helamonster
Copy link
Contributor

i see that job names are used in the zfs CURSOR bookmarks. Are they used anywhere else?

@problame
Copy link
Member Author

They are used in the step holds as well (see 'Overview' in the docs). If I remember correctly, that's about it at this time.

@mdlayher
Copy link

I ran into a case today where this would be useful. I'm an experienced Go programmer and wouldn't mind digging in a bit to see if I could contribute. I notice this formerly had a "good first issue" tag but that was removed?

@problame
Copy link
Member Author

Compared to the other issues marked 'good first issue', this one is a little more complicated. But nothing that can't be done.

I guess the file endpoint/endpoint_zfs_abstraction.go is a good place to start. Specifically, search for callers of Abstraction.GetJobID():

GetJobID() *JobID // may return nil if the abstraction does not have a JobID

@problame
Copy link
Member Author

Also, I'm willing to relax the requirements on crash consistency a little:

  • only allow the operation to take place when the daemon is not running (best effort check)
  • if the rename fails mid-way, require that the user
    • retry the command until it succeeds (=> idempotency)
    • not restart the daemon until then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants