summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2024-08-27 12:42:34 +0200
committerKlaus Aehlig <klaus.aehlig@huawei.com>2024-08-27 16:47:38 +0200
commit283bf43b9bb7f673eb49058f25374aaa419365c9 (patch)
treee77f78f67e8cfaf910b25fcf9b3e314e36b6a548 /src
parentb46b207b1903f3a0ab4ff2d36db5a7c2964f5629 (diff)
downloadjustbuild-283bf43b9bb7f673eb49058f25374aaa419365c9.tar.gz
CasClient: Fall back to single blob upload, if batch uploading made no progress
We already accept short writes in batch uploads, but when no progress is made, we cannot simply retry, as this might lead to an infinite loop. Instead, we give up on batching and upload each blob one by one.
Diffstat (limited to 'src')
-rw-r--r--src/buildtool/execution_api/remote/bazel/bazel_cas_client.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_cas_client.cpp b/src/buildtool/execution_api/remote/bazel/bazel_cas_client.cpp
index aa6b7c9f..aac7f2a5 100644
--- a/src/buildtool/execution_api/remote/bazel/bazel_cas_client.cpp
+++ b/src/buildtool/execution_api/remote/bazel/bazel_cas_client.cpp
@@ -592,6 +592,20 @@ auto BazelCasClient::BatchUpdateBlobs(
missing_blobs.begin(),
missing_blobs.end());
}
+ if (result.empty() and missing > 0) {
+ // The batch upload did not make _any_ progress. So there is no value in
+ // trying that again; instead, we fall back to uploading each blob
+ // sequentially.
+ logger_.Emit(LogLevel::Debug, "Falling back to sequential blob upload");
+ std::size_t count = 0;
+ std::for_each(
+ begin, end, [this, &count, &instance_name](auto const& blob) {
+ if (UpdateSingleBlob(instance_name, *blob)) {
+ count += 1;
+ }
+ });
+ return count;
+ }
return result.size();
}