comparison tests/test-remotefilelog-repack.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
52 $TESTTMP/hgcache/master/packs 52 $TESTTMP/hgcache/master/packs
53 $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histidx 53 $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histidx
54 $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histpack 54 $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histpack
55 $TESTTMP/hgcache/master/packs/b1e0cfc7f345e408a7825e3081501959488d59ce.dataidx 55 $TESTTMP/hgcache/master/packs/b1e0cfc7f345e408a7825e3081501959488d59ce.dataidx
56 $TESTTMP/hgcache/master/packs/b1e0cfc7f345e408a7825e3081501959488d59ce.datapack 56 $TESTTMP/hgcache/master/packs/b1e0cfc7f345e408a7825e3081501959488d59ce.datapack
57 $TESTTMP/hgcache/master/packs/repacklock
58 $TESTTMP/hgcache/repos 57 $TESTTMP/hgcache/repos
59 58
60 # Test that the packs are readonly 59 # Test that the packs are readonly
61 $ ls_l $CACHEDIR/master/packs 60 $ ls_l $CACHEDIR/master/packs
62 -r--r--r-- 1145 1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histidx 61 -r--r--r-- 1145 1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histidx
63 -r--r--r-- 172 1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histpack 62 -r--r--r-- 172 1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histpack
64 -r--r--r-- 1074 b1e0cfc7f345e408a7825e3081501959488d59ce.dataidx 63 -r--r--r-- 1074 b1e0cfc7f345e408a7825e3081501959488d59ce.dataidx
65 -r--r--r-- 72 b1e0cfc7f345e408a7825e3081501959488d59ce.datapack 64 -r--r--r-- 72 b1e0cfc7f345e408a7825e3081501959488d59ce.datapack
66 -rw-r--r-- 0 repacklock
67 65
68 # Test that the data in the new packs is accessible 66 # Test that the data in the new packs is accessible
69 $ hg cat -r . x 67 $ hg cat -r . x
70 x 68 x
71 x 69 x
85 $TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/d4a3ed9310e5bd9887e3bf779da5077efab28216 83 $TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/d4a3ed9310e5bd9887e3bf779da5077efab28216
86 $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histidx 84 $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histidx
87 $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histpack 85 $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histpack
88 $TESTTMP/hgcache/master/packs/b1e0cfc7f345e408a7825e3081501959488d59ce.dataidx 86 $TESTTMP/hgcache/master/packs/b1e0cfc7f345e408a7825e3081501959488d59ce.dataidx
89 $TESTTMP/hgcache/master/packs/b1e0cfc7f345e408a7825e3081501959488d59ce.datapack 87 $TESTTMP/hgcache/master/packs/b1e0cfc7f345e408a7825e3081501959488d59ce.datapack
90 $TESTTMP/hgcache/master/packs/repacklock
91 $TESTTMP/hgcache/repos 88 $TESTTMP/hgcache/repos
92 89
93 # First assert that with --packsonly, the loose object will be ignored: 90 # First assert that with --packsonly, the loose object will be ignored:
94 91
95 $ hg repack --packsonly 92 $ hg repack --packsonly
98 $TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/d4a3ed9310e5bd9887e3bf779da5077efab28216 95 $TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/d4a3ed9310e5bd9887e3bf779da5077efab28216
99 $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histidx 96 $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histidx
100 $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histpack 97 $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histpack
101 $TESTTMP/hgcache/master/packs/b1e0cfc7f345e408a7825e3081501959488d59ce.dataidx 98 $TESTTMP/hgcache/master/packs/b1e0cfc7f345e408a7825e3081501959488d59ce.dataidx
102 $TESTTMP/hgcache/master/packs/b1e0cfc7f345e408a7825e3081501959488d59ce.datapack 99 $TESTTMP/hgcache/master/packs/b1e0cfc7f345e408a7825e3081501959488d59ce.datapack
103 $TESTTMP/hgcache/master/packs/repacklock
104 $TESTTMP/hgcache/repos 100 $TESTTMP/hgcache/repos
105 101
106 $ hg repack --traceback 102 $ hg repack --traceback
107 103
108 $ find $CACHEDIR -type f | sort 104 $ find $CACHEDIR -type f | sort
109 $TESTTMP/hgcache/master/packs/78840d69389c7404327f7477e3931c89945c37d1.dataidx 105 $TESTTMP/hgcache/master/packs/78840d69389c7404327f7477e3931c89945c37d1.dataidx
110 $TESTTMP/hgcache/master/packs/78840d69389c7404327f7477e3931c89945c37d1.datapack 106 $TESTTMP/hgcache/master/packs/78840d69389c7404327f7477e3931c89945c37d1.datapack
111 $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histidx 107 $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histidx
112 $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histpack 108 $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histpack
113 $TESTTMP/hgcache/master/packs/repacklock
114 $TESTTMP/hgcache/repos 109 $TESTTMP/hgcache/repos
115 110
116 # Verify all the file data is still available 111 # Verify all the file data is still available
117 $ hg cat -r . x 112 $ hg cat -r . x
118 x 113 x
128 $ find $CACHEDIR -type f | sort 123 $ find $CACHEDIR -type f | sort
129 $TESTTMP/hgcache/master/packs/78840d69389c7404327f7477e3931c89945c37d1.dataidx 124 $TESTTMP/hgcache/master/packs/78840d69389c7404327f7477e3931c89945c37d1.dataidx
130 $TESTTMP/hgcache/master/packs/78840d69389c7404327f7477e3931c89945c37d1.datapack 125 $TESTTMP/hgcache/master/packs/78840d69389c7404327f7477e3931c89945c37d1.datapack
131 $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histidx 126 $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histidx
132 $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histpack 127 $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histpack
133 $TESTTMP/hgcache/master/packs/repacklock
134 $TESTTMP/hgcache/repos 128 $TESTTMP/hgcache/repos
135 129
136 # Run two repacks at once 130 # Run two repacks at once
137 $ hg repack --config "hooks.prerepack=sleep 3" & 131 $ hg repack --config "hooks.prerepack=sleep 3" &
138 $ sleep 1 132 $ sleep 1
152 $TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/1bb2e6237e035c8f8ef508e281f1ce075bc6db72 146 $TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/1bb2e6237e035c8f8ef508e281f1ce075bc6db72
153 $TESTTMP/hgcache/master/packs/78840d69389c7404327f7477e3931c89945c37d1.dataidx 147 $TESTTMP/hgcache/master/packs/78840d69389c7404327f7477e3931c89945c37d1.dataidx
154 $TESTTMP/hgcache/master/packs/78840d69389c7404327f7477e3931c89945c37d1.datapack 148 $TESTTMP/hgcache/master/packs/78840d69389c7404327f7477e3931c89945c37d1.datapack
155 $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histidx 149 $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histidx
156 $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histpack 150 $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histpack
157 $TESTTMP/hgcache/master/packs/repacklock
158 $TESTTMP/hgcache/repos 151 $TESTTMP/hgcache/repos
159 152
160 $ hg repack --background 153 $ hg repack --background
161 (running background repack) 154 (running background repack)
162 $ sleep 0.5 155 $ sleep 0.5
164 $ find $CACHEDIR -type f | sort 157 $ find $CACHEDIR -type f | sort
165 $TESTTMP/hgcache/master/packs/39443fa1064182e93d968b5cba292eb5283260d0.dataidx 158 $TESTTMP/hgcache/master/packs/39443fa1064182e93d968b5cba292eb5283260d0.dataidx
166 $TESTTMP/hgcache/master/packs/39443fa1064182e93d968b5cba292eb5283260d0.datapack 159 $TESTTMP/hgcache/master/packs/39443fa1064182e93d968b5cba292eb5283260d0.datapack
167 $TESTTMP/hgcache/master/packs/604552d403a1381749faf656feca0ca265a6d52c.histidx 160 $TESTTMP/hgcache/master/packs/604552d403a1381749faf656feca0ca265a6d52c.histidx
168 $TESTTMP/hgcache/master/packs/604552d403a1381749faf656feca0ca265a6d52c.histpack 161 $TESTTMP/hgcache/master/packs/604552d403a1381749faf656feca0ca265a6d52c.histpack
169 $TESTTMP/hgcache/master/packs/repacklock
170 $TESTTMP/hgcache/repos 162 $TESTTMP/hgcache/repos
171 163
172 # Test debug commands 164 # Test debug commands
173 165
174 $ hg debugdatapack $TESTTMP/hgcache/master/packs/*.datapack 166 $ hg debugdatapack $TESTTMP/hgcache/master/packs/*.datapack
241 $ ls $TESTTMP/hgcache/master/packs 233 $ ls $TESTTMP/hgcache/master/packs
242 bfd60adb76018bb952e27cd23fc151bf94865d7d.histidx 234 bfd60adb76018bb952e27cd23fc151bf94865d7d.histidx
243 bfd60adb76018bb952e27cd23fc151bf94865d7d.histpack 235 bfd60adb76018bb952e27cd23fc151bf94865d7d.histpack
244 fb3aa57b22789ebcc45706c352e2d6af099c5816.dataidx 236 fb3aa57b22789ebcc45706c352e2d6af099c5816.dataidx
245 fb3aa57b22789ebcc45706c352e2d6af099c5816.datapack 237 fb3aa57b22789ebcc45706c352e2d6af099c5816.datapack
246 repacklock
247 $ hg debughistorypack $TESTTMP/hgcache/master/packs/*.histidx 238 $ hg debughistorypack $TESTTMP/hgcache/master/packs/*.histidx
248 239
249 x 240 x
250 Node P1 Node P2 Node Link Node Copy From 241 Node P1 Node P2 Node Link Node Copy From
251 cd410a44d584 577959738234 000000000000 609547eda446 y 242 cd410a44d584 577959738234 000000000000 609547eda446 y