comparison tests/test-remotefilelog-repack-fast.t @ 42943:5fadf6103790

remotefilelog: replace repack lock to solve race condition 2c74337e6483 reduced the probability of race-conditions when starting background repack and prefetch and we saw the difference in our CI instance with all failures disappearing except one where one call to waitonrepack seems to returns too early. I'm not sure what exactly goes wrong but I realized that while the prefetch operation uses a standard Mercurial lock, the repack operation is using a custom lock based on `fcntl.flock` on available platforms. As `extutil.flock` fallback on traditional Mercurial locks on other platforms and the tests are stable on my laptop, our CI environment and GCC112, I'm sending this patch to standardize the behavior across environments. Differential Revision: https://phab.mercurial-scm.org/D6844
author Boris Feld <boris.feld@octobus.net>
date Wed, 11 Sep 2019 17:41:13 +0200
parents 2c74337e6483
children 88ab1295db4c
comparison
equal deleted inserted replaced
42942:adac17faa72e 42943:5fadf6103790
54 $TESTTMP/hgcache/master/packs 54 $TESTTMP/hgcache/master/packs
55 $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histidx 55 $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histidx
56 $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histpack 56 $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histpack
57 $TESTTMP/hgcache/master/packs/b1e0cfc7f345e408a7825e3081501959488d59ce.dataidx 57 $TESTTMP/hgcache/master/packs/b1e0cfc7f345e408a7825e3081501959488d59ce.dataidx
58 $TESTTMP/hgcache/master/packs/b1e0cfc7f345e408a7825e3081501959488d59ce.datapack 58 $TESTTMP/hgcache/master/packs/b1e0cfc7f345e408a7825e3081501959488d59ce.datapack
59 $TESTTMP/hgcache/master/packs/repacklock
60 $TESTTMP/hgcache/repos 59 $TESTTMP/hgcache/repos
61 60
62 # Test that the packs are readonly 61 # Test that the packs are readonly
63 $ ls_l $CACHEDIR/master/packs 62 $ ls_l $CACHEDIR/master/packs
64 -r--r--r-- 1145 1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histidx 63 -r--r--r-- 1145 1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histidx
65 -r--r--r-- 172 1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histpack 64 -r--r--r-- 172 1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histpack
66 -r--r--r-- 1074 b1e0cfc7f345e408a7825e3081501959488d59ce.dataidx 65 -r--r--r-- 1074 b1e0cfc7f345e408a7825e3081501959488d59ce.dataidx
67 -r--r--r-- 72 b1e0cfc7f345e408a7825e3081501959488d59ce.datapack 66 -r--r--r-- 72 b1e0cfc7f345e408a7825e3081501959488d59ce.datapack
68 -rw-r--r-- 0 repacklock
69 67
70 # Test that the data in the new packs is accessible 68 # Test that the data in the new packs is accessible
71 $ hg cat -r . x 69 $ hg cat -r . x
72 x 70 x
73 x 71 x
87 $TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/d4a3ed9310e5bd9887e3bf779da5077efab28216 85 $TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/d4a3ed9310e5bd9887e3bf779da5077efab28216
88 $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histidx 86 $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histidx
89 $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histpack 87 $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histpack
90 $TESTTMP/hgcache/master/packs/b1e0cfc7f345e408a7825e3081501959488d59ce.dataidx 88 $TESTTMP/hgcache/master/packs/b1e0cfc7f345e408a7825e3081501959488d59ce.dataidx
91 $TESTTMP/hgcache/master/packs/b1e0cfc7f345e408a7825e3081501959488d59ce.datapack 89 $TESTTMP/hgcache/master/packs/b1e0cfc7f345e408a7825e3081501959488d59ce.datapack
92 $TESTTMP/hgcache/master/packs/repacklock
93 $TESTTMP/hgcache/repos 90 $TESTTMP/hgcache/repos
94 91
95 $ hg repack --traceback 92 $ hg repack --traceback
96 93
97 $ find $CACHEDIR -type f | sort 94 $ find $CACHEDIR -type f | sort
98 $TESTTMP/hgcache/master/packs/78840d69389c7404327f7477e3931c89945c37d1.dataidx 95 $TESTTMP/hgcache/master/packs/78840d69389c7404327f7477e3931c89945c37d1.dataidx
99 $TESTTMP/hgcache/master/packs/78840d69389c7404327f7477e3931c89945c37d1.datapack 96 $TESTTMP/hgcache/master/packs/78840d69389c7404327f7477e3931c89945c37d1.datapack
100 $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histidx 97 $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histidx
101 $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histpack 98 $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histpack
102 $TESTTMP/hgcache/master/packs/repacklock
103 $TESTTMP/hgcache/repos 99 $TESTTMP/hgcache/repos
104 100
105 # Verify all the file data is still available 101 # Verify all the file data is still available
106 $ hg cat -r . x 102 $ hg cat -r . x
107 x 103 x
117 $ find $CACHEDIR -type f | sort 113 $ find $CACHEDIR -type f | sort
118 $TESTTMP/hgcache/master/packs/78840d69389c7404327f7477e3931c89945c37d1.dataidx 114 $TESTTMP/hgcache/master/packs/78840d69389c7404327f7477e3931c89945c37d1.dataidx
119 $TESTTMP/hgcache/master/packs/78840d69389c7404327f7477e3931c89945c37d1.datapack 115 $TESTTMP/hgcache/master/packs/78840d69389c7404327f7477e3931c89945c37d1.datapack
120 $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histidx 116 $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histidx
121 $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histpack 117 $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histpack
122 $TESTTMP/hgcache/master/packs/repacklock
123 $TESTTMP/hgcache/repos 118 $TESTTMP/hgcache/repos
124 119
125 # Run two repacks at once 120 # Run two repacks at once
126 $ hg repack --config "hooks.prerepack=sleep 3" & 121 $ hg repack --config "hooks.prerepack=sleep 3" &
127 $ sleep 1 122 $ sleep 1
141 $TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/1bb2e6237e035c8f8ef508e281f1ce075bc6db72 136 $TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/1bb2e6237e035c8f8ef508e281f1ce075bc6db72
142 $TESTTMP/hgcache/master/packs/78840d69389c7404327f7477e3931c89945c37d1.dataidx 137 $TESTTMP/hgcache/master/packs/78840d69389c7404327f7477e3931c89945c37d1.dataidx
143 $TESTTMP/hgcache/master/packs/78840d69389c7404327f7477e3931c89945c37d1.datapack 138 $TESTTMP/hgcache/master/packs/78840d69389c7404327f7477e3931c89945c37d1.datapack
144 $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histidx 139 $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histidx
145 $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histpack 140 $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histpack
146 $TESTTMP/hgcache/master/packs/repacklock
147 $TESTTMP/hgcache/repos 141 $TESTTMP/hgcache/repos
148 142
149 $ hg repack --background 143 $ hg repack --background
150 (running background repack) 144 (running background repack)
151 $ sleep 0.5 145 $ sleep 0.5
153 $ find $CACHEDIR -type f | sort 147 $ find $CACHEDIR -type f | sort
154 $TESTTMP/hgcache/master/packs/39443fa1064182e93d968b5cba292eb5283260d0.dataidx 148 $TESTTMP/hgcache/master/packs/39443fa1064182e93d968b5cba292eb5283260d0.dataidx
155 $TESTTMP/hgcache/master/packs/39443fa1064182e93d968b5cba292eb5283260d0.datapack 149 $TESTTMP/hgcache/master/packs/39443fa1064182e93d968b5cba292eb5283260d0.datapack
156 $TESTTMP/hgcache/master/packs/604552d403a1381749faf656feca0ca265a6d52c.histidx 150 $TESTTMP/hgcache/master/packs/604552d403a1381749faf656feca0ca265a6d52c.histidx
157 $TESTTMP/hgcache/master/packs/604552d403a1381749faf656feca0ca265a6d52c.histpack 151 $TESTTMP/hgcache/master/packs/604552d403a1381749faf656feca0ca265a6d52c.histpack
158 $TESTTMP/hgcache/master/packs/repacklock
159 $TESTTMP/hgcache/repos 152 $TESTTMP/hgcache/repos
160 153
161 # Test debug commands 154 # Test debug commands
162 155
163 $ hg debugdatapack $TESTTMP/hgcache/master/packs/*.datapack 156 $ hg debugdatapack $TESTTMP/hgcache/master/packs/*.datapack
230 $ ls $TESTTMP/hgcache/master/packs 223 $ ls $TESTTMP/hgcache/master/packs
231 bfd60adb76018bb952e27cd23fc151bf94865d7d.histidx 224 bfd60adb76018bb952e27cd23fc151bf94865d7d.histidx
232 bfd60adb76018bb952e27cd23fc151bf94865d7d.histpack 225 bfd60adb76018bb952e27cd23fc151bf94865d7d.histpack
233 fb3aa57b22789ebcc45706c352e2d6af099c5816.dataidx 226 fb3aa57b22789ebcc45706c352e2d6af099c5816.dataidx
234 fb3aa57b22789ebcc45706c352e2d6af099c5816.datapack 227 fb3aa57b22789ebcc45706c352e2d6af099c5816.datapack
235 repacklock
236 $ hg debughistorypack $TESTTMP/hgcache/master/packs/*.histidx 228 $ hg debughistorypack $TESTTMP/hgcache/master/packs/*.histidx
237 229
238 x 230 x
239 Node P1 Node P2 Node Link Node Copy From 231 Node P1 Node P2 Node Link Node Copy From
240 cd410a44d584 577959738234 000000000000 609547eda446 y 232 cd410a44d584 577959738234 000000000000 609547eda446 y