Mercurial > hg
comparison mercurial/osutil.c @ 23201:7e97bf6ee2d6
changelog: rework the delayupdate mechanism
The current way we use the 'delayupdate' mechanism is wrong. We call
'delayupdate' right after the transaction retrieval, then we call 'finalize'
right before calling 'tr.close()'. The 'finalize' call will -always- result in a
flush to disk, making the data available to all readers. But the 'tr.close()' may
be a no-op if the transaction is nested. This would result in data:
1) exposed to reader too early,
2) rolled back by other part of the transaction after such exposure
So we need to end up in a situation where we call 'finalize' a single time when
the transaction actually closes. For this purpose we need to be able to call
'delayupdate' and '_writepending' multiple times and 'finalize' once. This was
not possible with the previous state of the code.
This changeset refactors the code to makes this possible. We buffer data in memory
as much as possible and fall-back to writing to a ".a" file after the first call
to '_writepending'.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Sat, 18 Oct 2014 01:12:18 -0700 |
parents | 4ca434500dbf |
children | bc851e2851b1 |
comparison
equal
deleted
inserted
replaced
23200:48a2eefd3d20 | 23201:7e97bf6ee2d6 |
---|