Blob single part upload (#8703)

* Exposing writeEntireFile up through BackupContainerFileSystem, and using it in blob worker

* Adding blob worker latency metrics

* avoid writeEntireFile if object is too large

* gracefully falling back to multi-part upload if the file is too big
This commit is contained in:
Josh Slocum
2022-11-08 17:30:01 -06:00
committed by GitHub
parent ca1f3140c4
commit baa35fbc8f
15 changed files with 120 additions and 16 deletions

View File

@@ -1131,6 +1131,16 @@ public:
return false;
}
// fallback for using existing write api if the underlying blob store doesn't support efficient writeEntireFile
ACTOR static Future<Void> writeEntireFileFallback(Reference<BackupContainerFileSystem> bc,
std::string fileName,
std::string fileContents) {
state Reference<IBackupFile> objectFile = wait(bc->writeFile(fileName));
wait(objectFile->append(&fileContents[0], fileContents.size()));
wait(objectFile->finish());
return Void();
}
ACTOR static Future<Void> createTestEncryptionKeyFile(std::string filename) {
state Reference<IAsyncFile> keyFile = wait(IAsyncFileSystem::filesystem()->open(
filename,
@@ -1484,6 +1494,12 @@ Future<Void> BackupContainerFileSystem::encryptionSetupComplete() const {
return encryptionSetupFuture;
}
Future<Void> BackupContainerFileSystem::writeEntireFileFallback(const std::string& fileName,
const std::string& fileContents) {
return BackupContainerFileSystemImpl::writeEntireFileFallback(
Reference<BackupContainerFileSystem>::addRef(this), fileName, fileContents);
}
void BackupContainerFileSystem::setEncryptionKey(Optional<std::string> const& encryptionKeyFileName) {
if (encryptionKeyFileName.present()) {
encryptionSetupFuture = BackupContainerFileSystemImpl::readEncryptionKey(encryptionKeyFileName.get());