8000 Introduce a mode where notes updates are persisted immediately or in a transactioned manner · Issue #1397 · gitgitgadget/gitgitgadget · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Introduce a mode where notes updates are persisted immediately or in a transactioned manner #1397

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

Open
dscho opened this issue Aug 23, 2023 · 1 comment

Comments

@dscho
Copy link
Member
dscho commented Aug 23, 2023

In the near future, I would like to move towards a GitHub Actions-based variant of GitGitGadget (see #609 for more details).

There is one obscure challenge this brings with it: currently, GitGitGadget only ever runs one Azure Pipeline at a time, which is ensured by having a single agent pool service those Pipelines, and that agent pool contains a single VM.

This is necessary because GitGitGadget's functionality has a state, and that state is persisted in refs/notes/gitgitgadget. That state is typically fetched at the beginning of the Pipeline run, updated via git notes --ref=gitgitgadget add [...] calls, and pushed at the end of the run.

This same single-VM strategy won't work with GitHub Actions because self-hosted runners are a security risk on public GitHub repositories.

The best strategy to deal with refs/notes/gitgitgadget updates which I can think of is to move to a transaction pattern, where a failed push will force-fetch the notes ref, then try again to modify the state and push again. This will allow concurrent jobs to modify refs/notes/gitgitgadget "at the same time" (for all practical purposes, at least, that's an accurate-enough mental model of this strategy).

I imagine the implementation to move https://github.com/gitgitgadget/gitgitgadget/blob/main/lib/git-notes.ts to a transaction-like interface where a number of operations are stored (and even applied to the notes ref), and upon a commit() try to push, if it fails enter that retry loop with incrementing delays.

This will change the interface of the GitNotes class noticeably, e.g. by making getString()/setString() private and it will have to pull the functionality to update the IGitGitGadgetOptions instance into a transactioned model rather than letting the caller do the "read it, deserialize it, modify it, serialize it, overwrite it" dance.

EDIT: An alternative strategy would be to enclose each and every call to GitNotes that updates a note in a retry loop. This seems a bit less elegant to me, though.

@dscho dscho changed the title Introduce a mode where notes updates are persisted immediately Introduce a mode where notes updates are persisted immediately or in a transactioned manner Aug 23, 2023
@dscho
Copy link
Member Author
dscho commented Aug 23, 2023

Note that pushing refs/notes/gitgitgadget is currently not even part of most of GitGitGadget's functionality, it's the Azure Pipelines' responsibility to push that note at the end, at least in most scenarios. We need to change that of course.

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

1 participant
0