Skip to content

Commit

Permalink
s3: remove invalid reference to request outcomes
Browse files Browse the repository at this point in the history
this fixes a regression from 3.0.9.
also update changelog and version number.
  • Loading branch information
breuner committed Jun 16, 2024
1 parent 68b1089 commit 2a8c8f2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 20 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog of elbencho

## v3.0.13 (June 16, 2024)

### Fixes
* Fixed memory mamangement for various S3 requests. (Regression from v3.0.9)

## v3.0.11 (June 11, 2024)

### New Features & Enhancements
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
EXE_NAME ?= elbencho
EXE_VER_MAJOR ?= 3
EXE_VER_MINOR ?= 0
EXE_VER_PATCHLEVEL ?= 11
EXE_VER_PATCHLEVEL ?= 13
EXE_VERSION ?= $(EXE_VER_MAJOR).$(EXE_VER_MINOR)-$(EXE_VER_PATCHLEVEL)
EXE ?= $(BIN_PATH)/$(EXE_NAME)
EXE_UNSTRIPPED ?= $(EXE)-unstripped
Expand Down
38 changes: 19 additions & 19 deletions source/workers/LocalWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3982,7 +3982,7 @@ void LocalWorker::s3ModeThrowOnError(const OUTCOMETYPE& outcome, const std::stri
IF_LIKELY(outcome.IsSuccess() )
return;

const auto& s3Error = outcome.GetError();
const auto s3Error = outcome.GetError();

std::stringstream errStr;
errStr << failMessage << " " <<
Expand Down Expand Up @@ -4011,7 +4011,7 @@ void LocalWorker::s3ModeCreateBucket(std::string bucketName)

OPLOG_PRE_OP("S3CreateBucket", bucketName, 0, 0);

const auto& createOutcome = s3Client->CreateBucket(S3::CreateBucketRequest().WithBucket(bucketName));
const auto createOutcome = s3Client->CreateBucket(S3::CreateBucketRequest().WithBucket(bucketName));

OPLOG_POST_OP("S3CreateBucket", bucketName, 0, 0, !createOutcome.IsSuccess());

Expand Down Expand Up @@ -4047,7 +4047,7 @@ void LocalWorker::s3ModeHeadBucket(std::string bucketName)
#else
OPLOG_PRE_OP("HeadBucket", bucketName, 0, 0);

const auto& outcome = s3Client->HeadBucket(S3::HeadBucketRequest().WithBucket(bucketName));
const auto outcome = s3Client->HeadBucket(S3::HeadBucketRequest().WithBucket(bucketName));

OPLOG_POST_OP("HeadBucket", bucketName, 0, 0, !outcome.IsSuccess());

Expand Down Expand Up @@ -4077,7 +4077,7 @@ void LocalWorker::s3ModeCreateBucketTagging(const std::string& bucketName)

OPLOG_PRE_OP("PutBucketTagging", bucketName, 0, 0);

const auto& taggingOutcome = s3Client->PutBucketTagging(
const auto taggingOutcome = s3Client->PutBucketTagging(
S3::PutBucketTaggingRequest().WithBucket(bucketName).WithTagging(tagging)
);

Expand All @@ -4100,7 +4100,7 @@ void LocalWorker::s3ModeGetBucketTagging(const std::string& bucketName)
#else
OPLOG_PRE_OP("GetBucketTagging", bucketName, 0, 0);

const auto& outcome = s3Client->GetBucketTagging(S3::GetBucketTaggingRequest().WithBucket(bucketName));
const auto outcome = s3Client->GetBucketTagging(S3::GetBucketTaggingRequest().WithBucket(bucketName));

OPLOG_POST_OP("GetBucketTagging", bucketName, 0, 0, !outcome.IsSuccess());

Expand Down Expand Up @@ -4137,7 +4137,7 @@ void LocalWorker::s3ModeDeleteBucketTagging(const std::string& bucketName)

OPLOG_PRE_OP("DeleteBucketTagging", bucketName, 0, 0);

const auto& outcome = s3Client->DeleteBucketTagging(
const auto outcome = s3Client->DeleteBucketTagging(
S3::DeleteBucketTaggingRequest().WithBucket(bucketName)
);

Expand Down Expand Up @@ -4321,21 +4321,21 @@ void LocalWorker::s3ModeGetBucketVersioning(const std::string& bucketName)
#else
OPLOG_PRE_OP("GetBucketVersioning", bucketName, 0, 0);

const auto& bucketVersioningOutcome = s3Client->GetBucketVersioning(
const auto bucketVersioningOutcome = s3Client->GetBucketVersioning(
S3::GetBucketVersioningRequest().WithBucket(bucketName)
);

OPLOG_POST_OP("GetBucketVersioning", bucketName, 0, 0, !bucketVersioningOutcome.IsSuccess());

s3ModeThrowOnError(bucketVersioningOutcome, "Get bucket versioning failed.", bucketName);

const auto& bucketVersioningStatus = bucketVersioningOutcome.GetResult().GetStatus();
const auto bucketVersioningStatus = bucketVersioningOutcome.GetResult().GetStatus();

if (!progArgs->getDoS3BucketVersioningVerify())
return;

const auto statusNameMapper = Aws::S3::Model::BucketVersioningStatusMapper::GetNameForBucketVersioningStatus;
const auto& expectedStatus = S3::BucketVersioningStatus::Suspended;
const auto expectedStatus = S3::BucketVersioningStatus::Suspended;

IF_UNLIKELY(bucketVersioningStatus != expectedStatus)
{
Expand All @@ -4361,7 +4361,7 @@ void LocalWorker::s3ModePutBucketVersioning(const std::string& bucketName, bool

OPLOG_PRE_OP("PutBucketVersioning", bucketName, 0, 0);

const auto& putBucketVersioningOutcome = s3Client->PutBucketVersioning(
const auto putBucketVersioningOutcome = s3Client->PutBucketVersioning(
S3::PutBucketVersioningRequest()
.WithBucket(bucketName)
.WithVersioningConfiguration(versioningConfiguration)
Expand Down Expand Up @@ -5808,7 +5808,7 @@ void LocalWorker::s3ModeGetObjectTags(const std::string& bucketName, const std::
#else
OPLOG_PRE_OP("GetObjectTagging", bucketName + "/" + objectName, 0, 0);

const auto& getTagOutcome = s3Client->GetObjectTagging(
const auto getTagOutcome = s3Client->GetObjectTagging(
S3::GetObjectTaggingRequest()
.WithBucket(bucketName)
.WithKey(objectName)
Expand Down Expand Up @@ -5847,7 +5847,7 @@ void LocalWorker::s3ModePutObjectTags(const std::string& bucketName, const std::

OPLOG_PRE_OP("PutObjectTagging", bucketName + "/" + objectName, 0, TAG_VALUE_MEDIUM_LEN);

const auto& putTagOutcome = s3Client->PutObjectTagging(
const auto putTagOutcome = s3Client->PutObjectTagging(
S3::PutObjectTaggingRequest()
.WithBucket(bucketName)
.WithKey(objectName)
Expand All @@ -5870,7 +5870,7 @@ void LocalWorker::s3ModeDeleteObjectTags(const std::string& bucketName, const st

OPLOG_PRE_OP("DeleteObjectTagging", bucketName + "/" + objectName, 0, 0);

const auto& delTagOutcome = s3Client->DeleteObjectTagging(
const auto delTagOutcome = s3Client->DeleteObjectTagging(
S3::DeleteObjectTaggingRequest()
.WithBucket(bucketName)
.WithKey(objectName)
Expand All @@ -5890,7 +5890,7 @@ void LocalWorker::s3ModeGetObjectLockConfiguration(const std::string &bucketName
#else
OPLOG_PRE_OP("GetObjectLockConfiguration", bucketName, 0, 0);

const auto& getObjLockOutcome = s3Client->GetObjectLockConfiguration(
const auto getObjLockOutcome = s3Client->GetObjectLockConfiguration(
S3::GetObjectLockConfigurationRequest().WithBucket(bucketName)
);

Expand All @@ -5902,25 +5902,25 @@ void LocalWorker::s3ModeGetObjectLockConfiguration(const std::string &bucketName
if (!progArgs->getDoS3ObjectLockConfigurationVerify())
return;

const auto& objLockCfg = getObjLockOutcome.GetResult().GetObjectLockConfiguration();
const auto objLockCfg = getObjLockOutcome.GetResult().GetObjectLockConfiguration();

IF_UNLIKELY(!objLockCfg.ObjectLockEnabledHasBeenSet())
throw WorkerException("Object lock has not been enabled for bucket: " + bucketName);

IF_UNLIKELY(!objLockCfg.RuleHasBeenSet())
throw WorkerException("Object lock rule has not been set for bucket: " + bucketName);

const auto& objRetentionRule = objLockCfg.GetRule();
const auto objRetentionRule = objLockCfg.GetRule();

IF_UNLIKELY(!objRetentionRule.DefaultRetentionHasBeenSet())
throw WorkerException("Object lock default retention has not been set for bucket: " + bucketName);

const auto& objDefaultRetention = objRetentionRule.GetDefaultRetention();
const auto objDefaultRetention = objRetentionRule.GetDefaultRetention();

IF_UNLIKELY(!objDefaultRetention.DaysHasBeenSet())
throw WorkerException("Object lock retention days have not been set for bucket: " + bucketName);

const auto& retentionDays = objDefaultRetention.GetDays();
const auto retentionDays = objDefaultRetention.GetDays();

IF_UNLIKELY(retentionDays != RETENTION_PERIOD_DAYS)
{
Expand Down Expand Up @@ -5953,7 +5953,7 @@ void LocalWorker::s3ModePutObjectLockConfiguration(const std::string &bucketName

OPLOG_PRE_OP("PutObjectLockConfiguration", bucketName, 0, 0);

const auto& putObjLockOutcome = s3Client->PutObjectLockConfiguration(
const auto putObjLockOutcome = s3Client->PutObjectLockConfiguration(
S3::PutObjectLockConfigurationRequest()
.WithBucket(bucketName)
.WithObjectLockConfiguration(objectLockCfg));
Expand Down

0 comments on commit 2a8c8f2

Please sign in to comment.