aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2021-01-19 09:30:59 -0500
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2021-01-19 09:30:59 -0500
commitbc1e04e6e7f8d5a68d037ad83c9dcd1fe9c69fbb (patch)
tree598e6b1f0ad52897a87204cc37e2d3ba06c7efe0
parent0e0d2e1da1d2417d6e60bd25450b8cab56544468 (diff)
downloadgrokmirror-bc1e04e6e7f8d5a68d037ad83c9dcd1fe9c69fbb.tar.gz
Don't hold manifest lock during obstrepo fsck
If there are obstrepo changes, we're holding on to the manifest lock for too long. Grab the lock only after we're done analyzing obstrepos. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rwxr-xr-xgrokmirror/fsck.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/grokmirror/fsck.py b/grokmirror/fsck.py
index 19cdca1..967d4d1 100755
--- a/grokmirror/fsck.py
+++ b/grokmirror/fsck.py
@@ -991,9 +991,6 @@ def fsck_mirror(config, force=False, repack_only=False, conn_only=False,
if obst_changes:
# Refresh the alt repo map cache
amap = grokmirror.get_altrepo_map(toplevel, refresh=True)
- # Lock and re-read manifest, so we can update reference and forkgroup data
- grokmirror.manifest_lock(manifile)
- manifest = grokmirror.read_manifest(manifile)
obstrepos = grokmirror.find_all_gitdirs(obstdir, normalize=True, exclude_objstore=False)
@@ -1197,7 +1194,18 @@ def fsck_mirror(config, force=False, repack_only=False, conn_only=False,
if obst_changes:
# We keep the same mtime, because the repos themselves haven't changed
- grokmirror.write_manifest(manifile, manifest, pretty=pretty)
+ grokmirror.manifest_lock(manifile)
+ # Re-read manifest, so we can update reference and forkgroup data
+ disk_manifest = grokmirror.read_manifest(manifile)
+ # Go through my manifest and update and changes in forkgroup data
+ for gitdir in manifest:
+ if gitdir not in disk_manifest:
+ # What happened here?
+ continue
+ disk_manifest[gitdir]['reference'] = manifest[gitdir]['reference']
+ disk_manifest[gitdir]['forkgroup'] = manifest[gitdir]['forkgroup']
+
+ grokmirror.write_manifest(manifile, disk_manifest, pretty=pretty)
grokmirror.manifest_unlock(manifile)
if not len(to_process):