bundle-uri capability: Only advertise when bundle exist
This commit modify the way `bundle-uri` capability is advertied to the client to only make it so when a bundle exist for the given repository. For SSH, this change does not provide much benefit since the whole packfile negociation flow is performed on a single connection. In other words, the flow starts when the client starts the upload-pack service, and it ends when the client received all the objects it needed. For SmartHTTP, however, this is different. Each request/command sent by the client (`ls-refs`, `bundle-uri`, `fetch`) is sent on different, stateless, RPC calls. There is no way to know what command the client is sending to the git-upload-pack process until that process is actually started, which means that the Git config injected into the process must be computed in advance for every request; this implies computing the SignedURL of the bundle if it exist. By advertising `bundle-uri` capability only when a bundle exists for the given repository, we make sure the client won't send a `bundle-uri` command if no bundle exist. This not only reduces by 1 the number of round-trip request and the number of Git config computation, but it also make it easier to monitor the use of `bundle-uri` feature, since now we can be sure that when a client sends the `bundle-uri` command, it is because: 1. A bundle exists 2. The server advertised the capability 3. The client support the capability Thus, we now have a way to know if a client is using `bundle-uri` or not. References: https://gitlab.com/gitlab-org/gitaly/-/issues/6572
Showing
- internal/bundleuri/git_config.go 29 additions, 41 deletionsinternal/bundleuri/git_config.go
- internal/bundleuri/git_config_test.go 60 additions, 116 deletionsinternal/bundleuri/git_config_test.go
- internal/bundleuri/manager.go 18 additions, 0 deletionsinternal/bundleuri/manager.go
- internal/gitaly/service/smarthttp/inforefs.go 1 addition, 1 deletioninternal/gitaly/service/smarthttp/inforefs.go
- internal/gitaly/service/smarthttp/server.go 2 additions, 2 deletionsinternal/gitaly/service/smarthttp/server.go
- internal/gitaly/service/smarthttp/upload_pack.go 4 additions, 6 deletionsinternal/gitaly/service/smarthttp/upload_pack.go
- internal/gitaly/service/smarthttp/upload_pack_test.go 26 additions, 27 deletionsinternal/gitaly/service/smarthttp/upload_pack_test.go
- internal/gitaly/service/ssh/upload_pack.go 3 additions, 7 deletionsinternal/gitaly/service/ssh/upload_pack.go
Please register or sign in to comment