Re: [PATCH 18/19] index-helper: autorun
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Mar 18, 2016, 07:17 UTC
- Message-ID
- <alpine.DEB.2.20.1603180815160.4690@virtualbox>
- In-Reply-To
- <CACsJy8Dx4=igm3YVYkTDdRSxevDo2xRij9P5m7VPxkVrq3oq8Q@mail.gmail.com>
Hi Duy,
On Fri, 18 Mar 2016, Duy Nguyen wrote:
Show 21 quoted lines
> > Well, the way I read the code it is possible that: > > > > 1. Git process 1 starts, reading the index > > 2. Git process 2 starts, poking the index-helper > > 3. The index-helper updates the .pid file (why not set a bit in the shared > > memory?) with a prefix "W" > > 4. Git process 2 reads the .pid file and waits for the "W" to go away > > (what if index-helper is not fast enough to write the "W"?) > > 5. Git process 1 access the index, happily oblivious that it is being > > updated and the data is in an inconsistent state > > No, if process 1 reads the index file, then that file will remain > consistent/unchanged all the time. index-helper is not allowed to > touch that file at all. > > The process 2 gets the index content from shm (cached by the index > helper), verifies that it's good (with the signature at the end of the > shm). If watchman is used, process 2 can also read the list of > modified files from another shm, combine it with the in-core index, > then write it down the normal way. Only then process 1 (or process 3) > can see the new index content from the file.
So how do you deal with releasing the shared memory instances that are essentially created for every index update?
Ciao, Dscho