mirror of
https://github.com/facebook/sapling.git
synced 2025-01-06 04:43:19 +03:00
remotefilelog: commit the dirty shared mutable packs on transaction abort
Summary: Since the shared mutable packs contain fetched data from the network, not commiting them means that we would need to redownload the data again. Let's persist them on disk instead to avoid having to redownload them. Reviewed By: quark-zju Differential Revision: D17115796 fbshipit-source-id: 3e213461c7a864156ee4c6c68e6a042294883f9d
This commit is contained in:
parent
4b28370d5e
commit
0f125b4073
@ -529,10 +529,8 @@ class remotefileslog(filelog.fileslog):
|
||||
def getmutablesharedpacks(self):
|
||||
return self._mutablesharedpacks.getmutablepack()
|
||||
|
||||
def commitpending(self):
|
||||
"""Used in alternative filelog implementations to commit pending
|
||||
additions."""
|
||||
self._mutablelocalpacks.commit()
|
||||
def commitsharedpacks(self):
|
||||
"""Persist the dirty data written to the shared packs."""
|
||||
dpackpath, hpackpath = self._mutablesharedpacks.commit()
|
||||
|
||||
self.repo.fileservice.updatecache(dpackpath, hpackpath)
|
||||
@ -540,12 +538,17 @@ class remotefileslog(filelog.fileslog):
|
||||
self.contentstore.markforrefresh()
|
||||
self.metadatastore.markforrefresh()
|
||||
|
||||
def commitpending(self):
|
||||
"""Used in alternative filelog implementations to commit pending
|
||||
additions."""
|
||||
self._mutablelocalpacks.commit()
|
||||
self.commitsharedpacks()
|
||||
|
||||
def abortpending(self):
|
||||
"""Used in alternative filelog implementations to throw out pending
|
||||
additions."""
|
||||
self._mutablelocalpacks.abort()
|
||||
# XXX: Maybe we actually want to commit these
|
||||
self._mutablesharedpacks.abort()
|
||||
self.commitsharedpacks()
|
||||
|
||||
def makeunionstores(self):
|
||||
"""Union stores iterate the other stores and return the first result."""
|
||||
|
@ -894,16 +894,20 @@ class basetreemanifestlog(object):
|
||||
)
|
||||
return node
|
||||
|
||||
def commitpending(self):
|
||||
self._mutablelocalpacks.commit()
|
||||
def commitsharedpacks(self):
|
||||
"""Persist the dirty trees written to the shared packs."""
|
||||
self._mutablesharedpacks.commit()
|
||||
|
||||
self.datastore.markforrefresh()
|
||||
self.historystore.markforrefresh()
|
||||
|
||||
def commitpending(self):
|
||||
self._mutablelocalpacks.commit()
|
||||
self.commitsharedpacks()
|
||||
|
||||
def abortpending(self):
|
||||
self._mutablelocalpacks.abort()
|
||||
self._mutablesharedpacks.abort()
|
||||
self.commitsharedpacks()
|
||||
|
||||
def __nonzero__(self):
|
||||
return True
|
||||
|
Loading…
Reference in New Issue
Block a user