git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v6 06/13] pkt-line: add functions to read/write flush terminated packet streams

From
Lars Schneider <larsxschneider@gmail.com>
Date
Aug 25, 2016, 19:33 UTC
Message-ID
<269094FB-81F3-4220-BE7A-F957EDF6F808@gmail.com>
In-Reply-To
<CAGZ79kaVg40H-LeDtFfDYqDFDDbr+um3ZYj8oAaqGu+q6k5e+A@mail.gmail.com>
Show 21 quoted lines
> On 25 Aug 2016, at 20:46, Stefan Beller <sbeller@google.com> wrote:
> 
>> On Thu, Aug 25, 2016 at 4:07 AM,  <larsxschneider@gmail.com> wrote:
>> From: Lars Schneider <larsxschneider@gmail.com>
>> 
>> packet_write_stream_with_flush_from_fd() and
>> packet_write_stream_with_flush_from_buf() write a stream of packets. All
>> content packets use the maximal packet size except for the last one.
>> After the last content packet a `flush` control packet is written.
>> 
>> packet_read_till_flush() reads arbitrary sized packets until it detects
>> a `flush` packet.
> 
> So the API provided by these read/write functions is intended
> to move a huge chunks of data. And as it puts the data on the wire one
> packet after the other without the possibility to intervene and e.g. send
> a side channel progress bar update, I would question the design of this.
> If I understand correctly this will be specifically  used for large
> files locally,
> so e.g. a file of 5 GB (such as a virtual machine tracked in Git), would
> require about 80k packets.

Peff suggested this approach arguing that the overhead is neglectable: http://public-inbox.org/git/20160720134916.GB19359@sigill.intra.peff.net/

Show 15 quoted lines
> Instead of having many packets of max length and then a remainder,
> I would suggest to invent larger packets for this use case. Then we can
> just send one packet instead.
> 
> Currently a packet consists of 4 bytes indicating the length in hex
> and then the payload of length-4 bytes. As the length is in hex
> the characters in the first 4 bytes are [0-9a-f], we can easily add another
> meaning for the length, e.g.:
> 
>  A packet starts with the overall length and then the payload.
>  If the first character of the length is 'v' the length is encoded as a
>  variable length quantity[1]. The high bit of the char indicates if
>  the next char is still part of the length field. The length must not exceed
>  LLONG_MAX (which results in a payload of 9223 Petabyte, so
>  enough for the foreseeable future).
Eventually I would like to resurrect Joey's cleanFromFile/smudgeToFile idea:
http://public-inbox.org/git/1468277112-9909-3-git-send-email-joeyh@joeyh.name/
Then we would not need to transfer that much data over the pipes. However, I wonder if the large amount of packets would actually be a problem. Honestly, I would prefer to not change Git's packet format in this already large series ;-)
Show 10 quoted lines
>  [1] A variable-length quantity (VLQ) is a universal code that uses
>  an arbitrary number of bytes to represent an arbitrarily large integer.
>  https://en.wikipedia.org/wiki/Variable-length_quantity
> 
> The neat thing about the packet system is we can dedicate packets
> to different channels (such as the side channels), but with the provided
> API here this makes it impossible to later add in these side channel
> as it is a pure streaming API now. So let's remove the complication
> of having to send multiple packets and just go with one large packet
> instead.
I tried to design the protocol as flexible as possible for the future with a version negotiation and a capabilities list. Therefore, I would think it should be possible to implement these ideas in the future if they are required.
Show 17 quoted lines
> --
>    I understand that my proposal would require writing code again,
>    but it has also some long term advantages in the networking stack
>    of Git: There are some worries that a capabilities line in fetch/push
>    might overflow in the far future, when there are lots of capabilities.
> 
>    Also a few days ago there was a proposal to add all symbolic refs
>    to a capabilities line, which Peff shot down as "the packet may be
>    too small".
> 
>    There is an incredible hack that allows transporting refs > 64kB IIRC.
> 
>    All these things could go away with the variable length encoded
>    packets. But to make them go away in the future we would need
>    to start with these variable length packets today. ;)
> 
> Just food for thought.
Thanks for thinking it through that thoroughly! I understand your point of view and I am curious what others thing.

Cheers, Lars

Previous: Junio C HamanoNext: Junio C Hamano
Message 18 of 66 in “Git filter protocol”
  1. 00/13 Git filter protocollarsxschneider@gmail.com, Aug 25, 2016
  2. 10/13 convert: generate large test files only oncelarsxschneider@gmail.com, Aug 25, 2016
  3. Stefan BellerAug 25, 2016
  4. Lars SchneiderAug 25, 2016
  5. Junio C HamanoAug 29, 2016
  6. Lars SchneiderAug 30, 2016
  7. Junio C HamanoAug 30, 2016
  8. Junio C HamanoAug 29, 2016
  9. Lars SchneiderAug 30, 2016
  10. Jeff KingAug 30, 2016
  11. 06/13 pkt-line: add functions to read/write flush terminated packet streamslarsxschneider@gmail.com, Aug 25, 2016
  12. Stefan BellerAug 25, 2016
  13. Junio C HamanoAug 25, 2016
  14. Jacob KellerAug 26, 2016
  15. Stefan BellerAug 26, 2016
  16. Jeff KingAug 26, 2016
  17. Junio C HamanoAug 26, 2016
  18. Lars SchneiderAug 25, 2016
  19. Junio C HamanoAug 25, 2016
  20. Lars SchneiderAug 26, 2016
  21. Junio C HamanoAug 26, 2016
  22. Lars SchneiderAug 29, 2016
  23. 01/13 pkt-line: rename packet_write() to packet_write_fmt()larsxschneider@gmail.com, Aug 25, 2016
  24. 03/13 pkt-line: add packet_write_fmt_gently()larsxschneider@gmail.com, Aug 25, 2016
  25. Stefan BellerAug 25, 2016
  26. Lars SchneiderAug 25, 2016
  27. Junio C HamanoAug 25, 2016
  28. Lars SchneiderAug 26, 2016
  29. Junio C HamanoAug 26, 2016
  30. Jeff KingAug 26, 2016
  31. 11/13 convert: make apply_filter() adhere to standard Git error handlinglarsxschneider@gmail.com, Aug 25, 2016
  32. 12/13 convert: add filter.<driver>.process optionlarsxschneider@gmail.com, Aug 25, 2016
  33. Junio C HamanoAug 29, 2016
  34. Lars SchneiderAug 30, 2016
  35. Junio C HamanoAug 30, 2016
  36. Lars SchneiderAug 30, 2016
  37. Junio C HamanoAug 30, 2016
  38. Torsten BögershausenAug 31, 2016
  39. Jakub NarębskiAug 31, 2016
  40. Jakub NarębskiAug 30, 2016
  41. Lars SchneiderSep 5, 2016
  42. 05/13 pkt-line: add packet_write_gently()larsxschneider@gmail.com, Aug 25, 2016
  43. Junio C HamanoAug 25, 2016
  44. Lars SchneiderAug 26, 2016
  45. Junio C HamanoAug 26, 2016
  46. Lars SchneiderAug 29, 2016
  47. 13/13 read-cache: make sure file handles are not inherited by child processeslarsxschneider@gmail.com, Aug 25, 2016
  48. Junio C HamanoAug 29, 2016
  49. Lars SchneiderAug 29, 2016
  50. Junio C HamanoAug 29, 2016
  51. Lars SchneiderAug 30, 2016
  52. Torsten BögershausenAug 30, 2016
  53. Junio C HamanoSep 1, 2016
  54. 02/13 pkt-line: extract set_packet_header()larsxschneider@gmail.com, Aug 25, 2016
  55. 09/13 convert: modernize testslarsxschneider@gmail.com, Aug 25, 2016
  56. Junio C HamanoAug 26, 2016
  57. Lars SchneiderAug 29, 2016
  58. 08/13 convert: quote filter names in error messageslarsxschneider@gmail.com, Aug 25, 2016
  59. Junio C HamanoAug 26, 2016
  60. 04/13 pkt-line: add packet_flush_gently()larsxschneider@gmail.com, Aug 25, 2016
  61. 07/13 pack-protocol: fix maximum pkt-line sizelarsxschneider@gmail.com, Aug 25, 2016
  62. Stefan BellerAug 25, 2016
  63. Lars SchneiderAug 25, 2016
  64. Junio C HamanoAug 26, 2016
  65. Lars SchneiderAug 29, 2016
  66. Junio C HamanoAug 29, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.