[PATCH 2 of 3] phases: make advance/retractboundary() atomic

Patrick Mézard patrick at mezard.eu
Sat May 12 04:28:11 CDT 2012


Le 12/05/12 11:16, Pierre-Yves David a écrit :
> On Sat, May 12, 2012 at 12:49:49AM +0200, Patrick Mezard wrote:
>> # HG changeset patch
>> # User Patrick Mezard <patrick at mezard.eu>
>> # Date 1336775047 -7200
>> # Node ID a15de64e5817ca7bf105e6b56c2ffa37cd20c42b
>> # Parent  7cd39b49030833bec83b23c25871a2a18d80ce2a
>> phases: make advance/retractboundary() atomic
>>
>> Before this, if advanceboundary() failed after updating some roots but
>> before calling retractboundary(), the phase cache would be left in an
>> invalid state, marked dirty, and written as such. This patch approach is
>> to turn advance/retractboundary() into phasecache methods, then operate
>> on copies and merge them back on success.
>>
>> With the same technique, we can ensure the atomicity of combinations of
>> advance/retractboundary() calls, like those performed in changegroup
>> handling code.
> 
> This looks like a move in the right direction.
> 
>> +    phcache = repo._phasecache.copy()
>> +    phcache.retractboundary(repo, targetphase, nodes)
>> +    repo._phasecache.replace(phcache)
>>  
>>  def listphases(repo):
>>      """List phases root for serialisation over pushkey"""
> 
> Are you sure replacing the whole phasecache object is a good idea ?

I don't know, what do you suggest?

> Do we do that for changelog too ?

Not really, but we have transactions for revlogs.

--
Patrick Mézard



More information about the Mercurial-devel mailing list