Browse Source
Opening a readable channel can be expensive and the number of channels can be limited in DFS. Ensure that caller of BlockBasedFile.readOneBlock() is responsible for opening and closing the file, and that the ReadableChannel is reused in the request. As a side effect, this makes the code easier to read, with better use of try-with-resources. The downside is that this means a readable channel is always opened, even when the entire pack is already available for copying from cache. This should be an acceptable cost: it's rare enough not to overload the server and from a client latency perspective, the latency cost is in the noise relative to the data transfer cost involved in a clone. If this turns out to be a problem in practice, we can reintroduce that optimization in a followup change. Change-Id: I340428ee4bacd2dce019d5616ef12339a0c85f0b Signed-off-by: Minh Thai <mthai@google.com> Signed-off-by: Jonathan Nieder <jrn@google.com>stable-5.3
Minh Thai
6 years ago
committed by
Jonathan Nieder
4 changed files with 75 additions and 87 deletions
Loading…
Reference in new issue