Mercurial > evolve
changeset 6338:a55b9b917a08 stable
evolve: make _obshashcache slightly more tolerant to fs issues (issue6246)
It will fall back to memory db when there are problems opening the persistent
cache file.
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Thu, 01 Dec 2022 17:09:47 +0400 |
parents | 58115cf37211 |
children | b4df25613811 |
files | hgext3rd/evolve/obsdiscovery.py tests/test-discovery-obshashrange-cache.t tests/test-discovery-obshashrange.t tests/test-evolve-issue6246.t tests/test-pullbundle.t |
diffstat | 5 files changed, 31 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/obsdiscovery.py Thu Dec 01 16:29:56 2022 +0400 +++ b/hgext3rd/evolve/obsdiscovery.py Thu Dec 01 17:09:47 2022 +0400 @@ -485,6 +485,7 @@ if self._con is None: self._cachekey = self.emptykey self._ondiskcachekey = self.emptykey + repo.ui.debug(b'obshashrange cache: unable to load, regenerating\n') assert self._cachekey is not None def _db(self): @@ -494,8 +495,11 @@ return None if self._createmode is not None: pre_existed = os.access(self._path, os.R_OK) - con = sqlite3.connect(encoding.strfromlocal(self._path), timeout=30, - isolation_level=r"IMMEDIATE") + try: + con = sqlite3.connect(encoding.strfromlocal(self._path), + timeout=30, isolation_level=r"IMMEDIATE") + except sqlite3.OperationalError: + return None con.text_factory = bytes if self._createmode is not None and not pre_existed: try:
--- a/tests/test-discovery-obshashrange-cache.t Thu Dec 01 16:29:56 2022 +0400 +++ b/tests/test-discovery-obshashrange-cache.t Thu Dec 01 17:09:47 2022 +0400 @@ -156,6 +156,21 @@ no changes found [1] +suddenly cache is inaccessible, check that the push still succeeds (issue6246) + + $ chmod 0000 server/.hg/cache/*.sqlite + + $ hg -R main push ssh://user@dummy/server + pushing to ssh://user@dummy/server + searching for changes + OBSEXC: computing relevant nodes + OBSEXC: looking for common markers in 8 nodes + OBSEXC: markers already in sync + no changes found + [1] + + $ chmod 0644 server/.hg/cache/*.sqlite + client cache is warm $ f -s main/.hg/cache/evoext*
--- a/tests/test-discovery-obshashrange.t Thu Dec 01 16:29:56 2022 +0400 +++ b/tests/test-discovery-obshashrange.t Thu Dec 01 17:09:47 2022 +0400 @@ -199,6 +199,7 @@ OBSEXC: computing relevant nodes OBSEXC: looking for common markers in 6 nodes stable-range cache: unable to load, regenerating + obshashrange cache: unable to load, regenerating query 0; add more sample (target 100, current 1) query 0; sample size is 9, largest range 5 sending evoext_obshashrange_v1 command @@ -326,6 +327,7 @@ * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> stable-range cache: unable to load, regenerating (glob) * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> updated evo-ext-depthcache in *.???? seconds (6r) (glob) * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> updated evo-ext-stablerange-mergepoint in *.???? seconds (6r) (glob) + * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> obshashrange cache: unable to load, regenerating (glob) * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> updated evo-ext-obshashrange in *.???? seconds (6r, 4o) (glob) * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> query 0; add more sample (target 100, current 1) (glob) * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> query 0; sample size is 9, largest range 5 (glob) @@ -1116,6 +1118,7 @@ [1] $ hg debugupdatecache --debug stable-range cache: unable to load, regenerating + obshashrange cache: unable to load, regenerating updating the branch cache $ f -s .hg/cache/evoext* .hg/cache/evoext-depthcache-00: size=96
--- a/tests/test-evolve-issue6246.t Thu Dec 01 16:29:56 2022 +0400 +++ b/tests/test-evolve-issue6246.t Thu Dec 01 17:09:47 2022 +0400 @@ -23,4 +23,10 @@ 1ea73414a91b-0 (0, 1, 1) [leaf] - 66f7d451a68b-1 (1, 2, 1) [leaf] - + $ hg debugobshashrange --rev tip --debug + stable-range cache: unable to load, regenerating + rev node index size depth obshash + obshashrange cache: unable to load, regenerating + 6 f69452c5b1af 0 7 7 000000000000 + $ cd ..
--- a/tests/test-pullbundle.t Thu Dec 01 16:29:56 2022 +0400 +++ b/tests/test-pullbundle.t Thu Dec 01 17:09:47 2022 +0400 @@ -187,6 +187,7 @@ bundle2-input-bundle: 7 parts total checking for updated bookmarks stable-range cache: unable to load, regenerating + obshashrange cache: unable to load, regenerating updating the branch cache added 1235 changesets with 0 changes to 0 files new changesets 1ea73414a91b:f864bc82f6a2