diff mercurial/store.py @ 50641:5460424092e2

stream-clone: smoothly detect and handle a case were a revlog is split This detect and handle the most common case for a race condition around stream and revlog splitting. The one were the revlog is split between the initial collection of data and the time were we start considering stream that data. In such case, we repatch an inlined version of that revlog together when this happens. This is necessary as stream-v2 promised a specific number of bytes and a specific number of files to the client. In stream-v3, we will have the opportunity to just send a split revlog instead. Getting a better version of the protocol for stream-v3 is still useful, but it is no longer a blocket to fix that race condition. Note that another, rarer race condition exist, were the revlog is split while we creating the revlog and extracing content from it. This can be dealt with later.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 29 May 2023 18:41:58 +0200
parents 9caa860dcbec
children 6b522a9e7451
line wrap: on
line diff
--- a/mercurial/store.py	Mon May 29 14:07:58 2023 +0200
+++ b/mercurial/store.py	Mon May 29 18:41:58 2023 +0200
@@ -645,8 +645,11 @@
             if name_to_ext[f.unencoded_path] not in (b'.d', b'.i')
         ]
 
+        is_inline = b'.d' not in self._details
+
         rl = self.get_revlog_instance(repo).get_revlog()
-        rl_stream = rl.get_streams(max_changeset)
+        rl_stream = rl.get_streams(max_changeset, force_inline=is_inline)
+
         for name, s, size in rl_stream:
             if name_to_size.get(name, 0) != size:
                 msg = _(b"expected %d bytes but %d provided for %s")