Fri, 13 Apr 2018 11:17:45 -0700 hg: use command executor for wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 13 Apr 2018 11:17:45 -0700] rev 37640
hg: use command executor for wire protocol commands As part of this, I realized that some uses of lookup in a loop could be converted to use a batch request. But I didn't change behavior and left in a todo to track potentially changing this. Differential Revision: https://phab.mercurial-scm.org/D3291
Fri, 13 Apr 2018 11:14:54 -0700 logexchange: use command executor for wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 13 Apr 2018 11:14:54 -0700] rev 37639
logexchange: use command executor for wire protocol commands Differential Revision: https://phab.mercurial-scm.org/D3290
Fri, 13 Apr 2018 11:14:19 -0700 streamclone: use command executor for wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 13 Apr 2018 11:14:19 -0700] rev 37638
streamclone: use command executor for wire protocol commands Differential Revision: https://phab.mercurial-scm.org/D3289
Fri, 13 Apr 2018 11:13:05 -0700 discovery: use command executor interface
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 13 Apr 2018 11:13:05 -0700] rev 37637
discovery: use command executor interface We're trying to port all wire protocol code to use the new interface so we can implement wire protocol version 2 clients. Differential Revision: https://phab.mercurial-scm.org/D3288
Wed, 11 Apr 2018 17:24:43 -0700 discovery: don't redundantly call branchmap
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 11 Apr 2018 17:24:43 -0700] rev 37636
discovery: don't redundantly call branchmap We were calling the remote command twice without mutation the remote in between. Derp. Differential Revision: https://phab.mercurial-scm.org/D3287
Fri, 13 Apr 2018 11:12:19 -0700 wireproto: convert legacy commands to command executor
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 13 Apr 2018 11:12:19 -0700] rev 37635
wireproto: convert legacy commands to command executor Calls to the legacy commands "changegroup" and "changegroupsubset" have been ported to the new command executor interface. Because we always pass arguments by name and not position, some inconsistent names throughout the code base have been unified. As part of this change, we no longer had any remaining callers of the legacy command methods {between, branches, changegroup, changegroupsubset}. So, these interfaces/methods have been dropped from peer interfaces. We still have an interface declaring these methods. But that interface is implemented on the concrete peer types and isn't part of the generic peer interface. (The implementations of the command executor continue to call these methods.) The ultimate goal is to remove the per-command methods from the generic peer interface: the only interface-conforming way to call a command will be with the new executor API. At some point, we may want to move the methods outside of the peer classes and change the executor implementations to not call methods directly on a peer instance. Differential Revision: https://phab.mercurial-scm.org/D3273
Fri, 13 Apr 2018 11:10:59 -0700 treediscovery: switch to command executor interface
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 13 Apr 2018 11:10:59 -0700] rev 37634
treediscovery: switch to command executor interface We now have a new interface for requesting that commands run. Switch to it. Differential Revision: https://phab.mercurial-scm.org/D3272
Wed, 11 Apr 2018 16:18:26 -0700 wireproto: remove iterbatch() from peer interface (API)
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 11 Apr 2018 16:18:26 -0700] rev 37633
wireproto: remove iterbatch() from peer interface (API) Good riddance. Some tests have been ported to the new API. This probably should have been done in earlier commits. But duplicating the test coverage would have been difficult. It was easier this way. .. api:: The wire protocol peer's ``iterbatch()`` for bulk executing commands has been remove.d Use ``peer.commandexecutor()`` instead. Differential Revision: https://phab.mercurial-scm.org/D3271
Fri, 13 Apr 2018 11:08:46 -0700 largefiles: use command executor for batch operation
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 13 Apr 2018 11:08:46 -0700] rev 37632
largefiles: use command executor for batch operation This is the only other user of iterbatch() in core. Tests changed because the new command executor is smart enough to not send a "batch" command over the wire if only 1 command was requested. There is still coverage for the "batch" command in this test though. Differential Revision: https://phab.mercurial-scm.org/D3270
Fri, 13 Apr 2018 11:02:34 -0700 wireproto: implement batching on peer executor interface
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 13 Apr 2018 11:02:34 -0700] rev 37631
wireproto: implement batching on peer executor interface This is a bit more complicated than non-batch requests because we need to buffer sends until the last request arrives *and* we need to support resolving futures as data arrives from the remote. In a classical concurrent.futures executor model, the future "starts" as soon as it is submitted. However, we have nothing to start until the last command is submitted. If we did nothing, calling result() would deadlock, since the future hasn't "started." So in the case where we queue the command, we return a special future type whose result() will trigger sendcommands(). This eliminates the deadlock potential. It also serves as a check against callers who may be calling result() prematurely, as it will prevent any subsequent callcommands() from working. This behavior is slightly annoying and a bit restrictive. But it's the world that half duplex connections forces on us. In order to support streaming responses, we were previously using a generator. But with a futures-based API, we're using futures and not generators. So in order to get streaming, we need a background thread to read data from the server. The approach taken in this patch is to leverage the ThreadPoolExecutor from concurrent.futures for managing a background thread. We create an executor and future that resolves when all response data is processed (or an error occurs). When exiting the context manager, we wait on that background reading before returning. I was hoping we could manually spin up a threading.Thread and this would be simple. But I ran into a few deadlocks when implementing. After looking at the source code to concurrent.futures, I figured it would just be easier to use a ThreadPoolExecutor than implement all the code needed to manually manage a thread. To prove this works, a use of the batch API in discovery has been updated. Differential Revision: https://phab.mercurial-scm.org/D3269
(0) -30000 -10000 -3000 -1000 -300 -100 -10 +10 +100 +300 +1000 +3000 +10000 tip