This is an archive of the discontinued Mercurial Phabricator instance.

upgrade: take lock only for part where it's required
ClosedPublic

Authored by pulkit on Jan 15 2021, 1:47 AM.

Details

Summary

The final config calculation code does not require a lock, only writing it back
does require one.

Diff Detail

Repository
rHG Mercurial
Branch
default
Lint
No Linters Available
Unit
No Unit Test Coverage

Event Timeline

pulkit created this revision.Jan 15 2021, 1:47 AM
marmoute requested changes to this revision.Jan 15 2021, 5:14 AM
marmoute added a subscriber: marmoute.

When upgrading, we need to read the requirements -with- the lock. Otherwise we can be raced by another process upgrading the requirements.

This revision now requires changes to proceed.Jan 15 2021, 5:14 AM

When upgrading, we need to read the requirements -with- the lock. Otherwise we can be raced by another process upgrading the requirements.

The requirements which we are reading here are source repository requirements. Hence the lock was no-op here. To prevent race condition, we will need to lock the source repository. Locking source repository on a command run by share sounded like a bad idea to me and hence left it.

When upgrading, we need to read the requirements -with- the lock. Otherwise we can be raced by another process upgrading the requirements.

The requirements which we are reading here are source repository requirements. Hence the lock was no-op here. To prevent race condition, we will need to lock the source repository. Locking source repository on a command run by share sounded like a bad idea to me and hence left it.

ah, I see.

However, we are mixing it with the current requirements, so we should re-read the current requirements under lock.

When upgrading, we need to read the requirements -with- the lock. Otherwise we can be raced by another process upgrading the requirements.

The requirements which we are reading here are source repository requirements. Hence the lock was no-op here. To prevent race condition, we will need to lock the source repository. Locking source repository on a command run by share sounded like a bad idea to me and hence left it.

ah, I see.
However, we are mixing it with the current requirements, so we should re-read the current requirements under lock.

Added D9822 for that.

marmoute accepted this revision.Jan 18 2021, 10:50 AM

Am I fine with the required fix being a follow up and such follow up now exist. So I think we are good to go.

(code could be a bit clearer, but nothing blocking)

This revision now requires review to proceed.Jan 18 2021, 10:50 AM
mharbison72 accepted this revision.Jan 18 2021, 9:08 PM
This revision is now accepted and ready to land.Jan 18 2021, 9:08 PM
This revision was automatically updated to reflect the committed changes.