Mercurial > public > mercurial-scm > hg-stable
changeset 52929:9abf173a958b
stream-clone-v2: use the pass through for threaded stream clone
The reader thread just want to iterate over chunk, so let it do just that. This avoid some silly layer of filechunkiter and chunk buffer.
Before this change, we had the following layers:
bundle2part (iterator of chunks)
? chunkbuffer (iterator of chunks to file-like)
? filechunkiter (file-like to chunkgs)
? _DataQueue (thread safe iterator of chunks)
? chunkbuffer (iterator of chunks to file-like).
We now have removed the first layer of chunkbuffer + filechunkiter:
bundle2part (iterator of chunks)
? _DataQueue (thread safe iterator of chunks)
? chunkbuffer (iterator of chunks to file-like).
This fix the output order change that was previously introduced.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 21 Jan 2025 04:28:11 +0100 |
parents | f863fc99bef9 |
children | e4552f135e35 |
files | mercurial/streamclone.py tests/test-stream-bundle-v2.t |
diffstat | 2 files changed, 5 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/streamclone.py Mon Jan 27 18:08:34 2025 +0100 +++ b/mercurial/streamclone.py Tue Jan 21 04:28:11 2025 +0100 @@ -1138,11 +1138,9 @@ data_queue = _DataQueue() raw_data = util.chunkbuffer(data_queue) - # XXX we will drop this extra filechunkiter layer soon - part_content = util.filechunkiter(fp) w = threading.Thread( target=data_queue.fill_from, - args=(part_content,), + args=(fp,), ) workers.append(w) w.start()
--- a/tests/test-stream-bundle-v2.t Mon Jan 27 18:08:34 2025 +0100 +++ b/tests/test-stream-bundle-v2.t Tue Jan 21 04:28:11 2025 +0100 @@ -132,8 +132,6 @@ 14 files to transfer, 1.78 KB of data (rust !) starting 4 threads for background file closing (?) starting 4 threads for background file closing (?) - bundle2-input-part: total payload size 1857 (no-rust threaded !) - bundle2-input-part: total payload size 2025 (rust threaded !) adding [s] data/A.i (66 bytes) adding [s] data/B.i (66 bytes) adding [s] data/C.i (66 bytes) @@ -148,8 +146,8 @@ adding [c] branch2-served (94 bytes) adding [c] rbc-names-v2 (7 bytes) adding [c] rbc-revs-v2 (40 bytes) - bundle2-input-part: total payload size 1857 (no-rust no-threaded !) - bundle2-input-part: total payload size 2025 (rust no-threaded !) + bundle2-input-part: total payload size 1857 (no-rust !) + bundle2-input-part: total payload size 2025 (rust !) stream-cloned 12 files / 1.65 KB in * seconds (* */sec) (glob) (no-rust !) stream-cloned 14 files / 1.78 KB in * seconds (* */sec) (glob) (rust !) bundle2-input-bundle: 1 parts total @@ -197,8 +195,6 @@ 14 files to transfer, 1.78 KB of data (rust !) starting 4 threads for background file closing (?) starting 4 threads for background file closing (?) - bundle2-input-part: total payload size 1857 (no-rust threaded !) - bundle2-input-part: total payload size 2025 (rust threaded !) adding [s] data/A.i (66 bytes) adding [s] data/B.i (66 bytes) adding [s] data/C.i (66 bytes) @@ -213,8 +209,8 @@ adding [c] branch2-served (94 bytes) adding [c] rbc-names-v2 (7 bytes) adding [c] rbc-revs-v2 (40 bytes) - bundle2-input-part: total payload size 1857 (no-rust no-threaded !) - bundle2-input-part: total payload size 2025 (rust no-threaded !) + bundle2-input-part: total payload size 1857 (no-rust !) + bundle2-input-part: total payload size 2025 (rust !) stream-cloned 12 files / 1.65 KB in * seconds (* */sec) (glob) (no-rust !) stream-cloned 14 files / 1.78 KB in * seconds (* */sec) (glob) (rust !) bundle2-input-bundle: 1 parts total