git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 2/7] maintenance: store the "last run" time in config

From
Derrick Stolee <stolee@gmail.com>
Date
Aug 27, 2020, 13:02 UTC
Message-ID
<c30d745f-4d30-0404-420f-2009870da95b@gmail.com>
In-Reply-To
<xmqqzh6huyoi.fsf@gitster.c.googlers.com>
On 8/26/2020 1:03 PM, Junio C Hamano wrote:
Show 20 quoted lines
> Derrick Stolee <stolee@gmail.com> writes:
> 
>>>>  1. The time the task takes to execute should not contribute to the
>>>>     interval between running the tasks.
>>>
>>> ... as long as the run time is sufficiently shorter than the
>>> interval, that is.  If a task takes 10-30 minutes depending on how
>>> dirty the repository is, it does not make sense to even try to run
>>> it every 15 minutes.
>>
>> Definitely. The lock on the object database from earlier prevents these
>> longer-than-anticipated tasks from stacking.
> 
> Hmph, I actually was (anticipating|hoping) that you would give a
> good argument for having maintenance subsystem in change of
> scheduling rather than cron, as it can monitor how the already
> running job is goind and skip one cycle if needed.  The above is
> instead a good argument that independent cron jobs can still
> coordinate and there is no central and custom scheduler in the form
> of 'maintenance run'.

While the lock does prevent concurrent 'maintenance run' commands from colliding and causing unpredictable behavior as they both modify the object database, this does not help ensure that maintenance tasks actually happen if certain tasks are fired independently by cron and consistently collide.

This is the main motivation for me using a single crontab entry. More discussion of all of the tradeoffs is in [1].

[1] https://lore.kernel.org/git/bd4e18b7-6265-73e7-bc1a-a7d647eafd0a@gmail.com/
Show 14 quoted lines
>>>>  2. If the task fails for some unforseen reason, it would be good to
>>>>     indicate that we _attempted_ the task at a certain timestamp. This
>>>>     will avoid spamming a repository that is in a bad state.
>>>
>>> Absolutely.
> 
> Somebody already mentioned that using the configuration file for
> recordkeeping may not be a good idea, and I tend to agree, by the
> way.  I may want to periodically take a snapshot of my configuration
> to notice and remember changes I made myself intentionally
> (e.g. switched access method of a hosting site from ssh:// to
> https://, added a new branch that builds on something else, etc.) by
> comparing the snapshot with previous ones (and might even put it
> under version-control) and mechanical noise would interfere with it.
 
I will think of another way to handle this, then. If we cannot infer
that "this task was launched, therefore it is due to run" from an
optimal cron schedule, then I'll probably create a new file in the
.git repository that stores these values. That file would be in the
config format to make parsing easy.

Thanks, -Stolee

Previous: Junio C HamanoNext: Derrick Stolee via GitGitGadget
Message 22 of 41 in “[RFC] Maintenance III: background maintenance”
  1. 0/7 [RFC] Maintenance III: background maintenanceDerrick Stolee via GitGitGadget, Aug 19, 2020
  2. 1/7 maintenance: optionally skip --auto processDerrick Stolee via GitGitGadget, Aug 19, 2020
  3. Đoàn Trần Công DanhAug 20, 2020
  4. Derrick StoleeAug 20, 2020
  5. 4/7 for-each-repo: run subcommands on configured reposDerrick Stolee via GitGitGadget, Aug 19, 2020
  6. Đoàn Trần Công DanhAug 20, 2020
  7. 3/7 maintenance: add --scheduled option and configDerrick Stolee via GitGitGadget, Aug 19, 2020
  8. Đoàn Trần Công DanhAug 20, 2020
  9. Derrick StoleeAug 24, 2020
  10. 5/7 maintenance: add [un]register subcommandsDerrick Stolee via GitGitGadget, Aug 19, 2020
  11. 6/7 maintenance: add start/stop subcommandsDerrick Stolee via GitGitGadget, Aug 19, 2020
  12. 7/7 maintenance: recommended schedule in register/startDerrick Stolee via GitGitGadget, Aug 19, 2020
  13. 0/7 [RFC] Maintenance III: background maintenanceDerrick Stolee via GitGitGadget, Aug 25, 2020
  14. 1/7 maintenance: optionally skip --auto processDerrick Stolee via GitGitGadget, Aug 25, 2020
  15. Junio C HamanoAug 25, 2020
  16. Derrick StoleeAug 26, 2020
  17. Junio C HamanoAug 26, 2020
  18. 2/7 maintenance: store the "last run" time in configDerrick Stolee via GitGitGadget, Aug 25, 2020
  19. Junio C HamanoAug 25, 2020
  20. Derrick StoleeAug 26, 2020
  21. Junio C HamanoAug 26, 2020
  22. Derrick StoleeAug 27, 2020
  23. 3/7 maintenance: add --scheduled option and configDerrick Stolee via GitGitGadget, Aug 25, 2020
  24. Junio C HamanoAug 25, 2020
  25. Derrick StoleeAug 26, 2020
  26. Derrick StoleeAug 27, 2020
  27. 4/7 for-each-repo: run subcommands on configured reposDerrick Stolee via GitGitGadget, Aug 25, 2020
  28. Junio C HamanoAug 25, 2020
  29. Derrick StoleeAug 26, 2020
  30. 6/7 maintenance: add start/stop subcommandsDerrick Stolee via GitGitGadget, Aug 25, 2020
  31. 7/7 maintenance: recommended schedule in register/startDerrick Stolee via GitGitGadget, Aug 25, 2020
  32. 5/7 maintenance: add [un]register subcommandsDerrick Stolee via GitGitGadget, Aug 25, 2020
  33. 0/6 [RFC] Maintenance III: background maintenanceDerrick Stolee via GitGitGadget, Aug 28, 2020
  34. 2/6 maintenance: add --schedule option and configDerrick Stolee via GitGitGadget, Aug 28, 2020
  35. 4/6 maintenance: add [un]register subcommandsDerrick Stolee via GitGitGadget, Aug 28, 2020
  36. 1/6 maintenance: optionally skip --auto processDerrick Stolee via GitGitGadget, Aug 28, 2020
  37. 5/6 maintenance: add start/stop subcommandsDerrick Stolee via GitGitGadget, Aug 28, 2020
  38. 6/6 maintenance: recommended schedule in register/startDerrick Stolee via GitGitGadget, Aug 28, 2020
  39. 3/6 for-each-repo: run subcommands on configured reposDerrick Stolee via GitGitGadget, Aug 28, 2020
  40. Michal SuchánekAug 26, 2020
  41. Đoàn Trần Công DanhAug 20, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.