Make version_id an optional parameter again.

This commit is contained in:
Vitaly Baranov 2023-01-27 14:12:29 +01:00
parent aea9ccdb60
commit f9282cfcac
2 changed files with 7 additions and 7 deletions

View File

@ -155,7 +155,7 @@ void KeeperSnapshotManagerS3::uploadSnapshotImpl(const std::string & snapshot_pa
auto snapshot_name = fs::path(snapshot_path).filename().string();
auto lock_file = fmt::format(".{}_LOCK", snapshot_name);
if (S3::objectExists(*s3_client->client, s3_client->uri.bucket, snapshot_name, {}, request_settings_1))
if (S3::objectExists(*s3_client->client, s3_client->uri.bucket, snapshot_name))
{
LOG_ERROR(log, "Snapshot {} already exists", snapshot_name);
return;
@ -163,7 +163,7 @@ void KeeperSnapshotManagerS3::uploadSnapshotImpl(const std::string & snapshot_pa
// First we need to verify that there isn't already a lock file for the snapshot we want to upload
// Only leader uploads a snapshot, but there can be a rare case where we have 2 leaders in NuRaft
if (S3::objectExists(*s3_client->client, s3_client->uri.bucket, lock_file, {}, request_settings_1))
if (S3::objectExists(*s3_client->client, s3_client->uri.bucket, lock_file))
{
LOG_ERROR(log, "Lock file for {} already, exists. Probably a different node is already uploading the snapshot", snapshot_name);
return;

View File

@ -17,17 +17,17 @@ struct ObjectInfo
time_t last_modification_time = 0;
};
ObjectInfo getObjectInfo(const Aws::S3::S3Client & client, const String & bucket, const String & key, const String & version_id, const S3Settings::RequestSettings & settings, bool for_disk_s3 = false, bool throw_on_error = true);
ObjectInfo getObjectInfo(const Aws::S3::S3Client & client, const String & bucket, const String & key, const String & version_id = {}, const S3Settings::RequestSettings & settings = {}, bool for_disk_s3 = false, bool throw_on_error = true);
size_t getObjectSize(const Aws::S3::S3Client & client, const String & bucket, const String & key, const String & version_id, const S3Settings::RequestSettings & settings, bool for_disk_s3 = false, bool throw_on_error = true);
size_t getObjectSize(const Aws::S3::S3Client & client, const String & bucket, const String & key, const String & version_id = {}, const S3Settings::RequestSettings & settings = {}, bool for_disk_s3 = false, bool throw_on_error = true);
bool objectExists(const Aws::S3::S3Client & client, const String & bucket, const String & key, const String & version_id, const S3Settings::RequestSettings & settings, bool for_disk_s3 = false);
bool objectExists(const Aws::S3::S3Client & client, const String & bucket, const String & key, const String & version_id = {}, const S3Settings::RequestSettings & settings = {}, bool for_disk_s3 = false);
/// Throws an exception if a specified object doesn't exist. `description` is used as a part of the error message.
void checkObjectExists(const Aws::S3::S3Client & client, const String & bucket, const String & key, const String & version_id, const S3Settings::RequestSettings & settings, bool for_disk_s3 = false, std::string_view description = {});
void checkObjectExists(const Aws::S3::S3Client & client, const String & bucket, const String & key, const String & version_id = {}, const S3Settings::RequestSettings & settings = {}, bool for_disk_s3 = false, std::string_view description = {});
/// Returns the object's metadata.
std::map<String, String> getObjectMetadata(const Aws::S3::S3Client & client, const String & bucket, const String & key, const String & version_id, const S3Settings::RequestSettings & settings, bool for_disk_s3 = false, bool throw_on_error = true);
std::map<String, String> getObjectMetadata(const Aws::S3::S3Client & client, const String & bucket, const String & key, const String & version_id = {}, const S3Settings::RequestSettings & settings = {}, bool for_disk_s3 = false, bool throw_on_error = true);
bool isNotFoundError(Aws::S3::S3Errors error);