Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix s3 crt checksum calc #3075

Merged
merged 2 commits into from
Aug 15, 2024
Merged

Fix s3 crt checksum calc #3075

merged 2 commits into from
Aug 15, 2024

Conversation

sbiscigl
Copy link
Contributor

@sbiscigl sbiscigl commented Aug 9, 2024

Description of changes:

right now we don't propagate flexsum configuration to S3Crt, this changes to propagate the configuraiton. Previously the following request would fail.

#include <aws/core/Aws.h>
#include <aws/core/utils/HashingUtils.h>
#include <aws/s3-crt/S3CrtClient.h>
#include <aws/s3-crt/model/PutObjectRequest.h>

using namespace Aws;
using namespace Aws::Client;
using namespace Aws::S3Crt;
using namespace Aws::S3Crt::Model;

static auto ALLOC_TAG = "sdk-example";
static auto BUCKET_NAME = "bucket-name";
static auto KEY_NAME = "test-key";

auto main() -> int
{
    SDKOptions options;
    options.loggingOptions.logLevel = Utils::Logging::LogLevel::Debug;
    InitAPI(options);
    {
        S3CrtClient client;
        auto putObjectRequest = PutObjectRequest().WithBucket(BUCKET_NAME)
                                                  .WithKey(KEY_NAME);

        std::shared_ptr<IOStream> data = Aws::MakeShared<StringStream>(ALLOC_TAG,
            "test string",
            std::ios_base::in | std::ios_base::binary);

        putObjectRequest.SetBody(data);
        putObjectRequest.SetChecksumAlgorithm(ChecksumAlgorithm::CRC32);
        const auto putObjectResult = client.PutObject(putObjectRequest);
        assert(putObjectResult.IsSuccess());
    }
    ShutdownAPI(options);
    return 0;
}

Additionally this fixes memory leaks that existed in the CRT client that were not being tested before that now exist. This PR additionally re-enables the CRT integration tests so that we don't accidentally miss these issues anymore either.

Check all that applies:

  • Did a review by yourself.
  • Added proper tests to cover this PR. (If tests are not applicable, explain.)
  • Checked if this PR is a breaking (APIs have been changed) change.
  • Checked if this PR will not introduce cross-platform inconsistent behavior.
  • Checked if this PR would require a ReadMe/Wiki update.

Check which platforms you have built SDK on to verify the correctness of this PR.

  • Linux
  • Windows
  • Android
  • MacOS
  • IOS
  • Other Platforms

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@sbiscigl sbiscigl force-pushed the fix-s3-crt-checksum-calc branch 3 times, most recently from 11bef0c to 76d1a4e Compare August 12, 2024 14:14
@sbiscigl sbiscigl force-pushed the fix-s3-crt-checksum-calc branch 7 times, most recently from faeafce to 9f066a5 Compare August 14, 2024 17:21
@SergeyRyabinin SergeyRyabinin self-requested a review August 14, 2024 19:39
@sbiscigl sbiscigl force-pushed the fix-s3-crt-checksum-calc branch 2 times, most recently from 66a7718 to 3a0dd70 Compare August 15, 2024 18:40
Aws::Testing::InitPlatformTest(options);
Aws::Testing::ParseArgs(argc, argv);

Aws::InitAPI(options);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Begin() goes here and End() right after "ShutdownAPI"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is copy and pasted more or less from what we already do and how we use it in the crt test already

@sbiscigl sbiscigl marked this pull request as ready for review August 15, 2024 20:52
@sbiscigl sbiscigl merged commit af521af into main Aug 15, 2024
3 of 4 checks passed
@sbiscigl sbiscigl deleted the fix-s3-crt-checksum-calc branch August 15, 2024 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants