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

#447 S3 Storage Exceptions Handling #1304

Merged
merged 9 commits into from
Feb 13, 2024
Merged

Conversation

muhammadhamzasajjad
Copy link
Collaborator

This is a refactor of #584 for S3 Storage Exceptions. This PR also implements the tests for S3 storage exceptions. Note that in some cases S3 Storage Exceptions are different from other storages. For instance if you write a path that already exists, other storages throw DuplicateKeyException. In this case, S3 just over-writes the key without any errors, therefore no Exception is thrown.

The function handle_s3_error handles other S3 Storage specific exceptions as follows:

  • E_PERMISSION: raised when ACCESS_DENIED, INVALID_ACCESS_KEY_ID or SIGNATURE_DOES_NOT_MATCH errors are returned.
  • E_S3_RETRYABLE: raised for all the other S3 exceptions that are retry-able.
  • E_UNEXPECTED_S3_ERROR: raised for all the other S3 exceptions that are not retry-able.

These have been implemented following the PR #584.

Checklist

Checklist for code changes...
  • Have you updated the relevant docstrings, documentation and copyright notice?
  • Is this contribution tested against all ArcticDB's features?
  • Do all exceptions introduced raise appropriate error messages?
  • Are API changes highlighted in the PR description?
  • Is the PR labelled as enhancement or bug so it appears in autogenerated release notes?

cpp/arcticdb/storage/s3/s3_client_wrapper.hpp Show resolved Hide resolved
cpp/arcticdb/storage/storage.hpp Outdated Show resolved Hide resolved
cpp/arcticdb/storage/s3/detail-inl.hpp Show resolved Hide resolved
cpp/arcticdb/storage/s3/mock_s3_client.hpp Outdated Show resolved Hide resolved
cpp/arcticdb/util/error_code.hpp Show resolved Hide resolved
@muhammadhamzasajjad muhammadhamzasajjad marked this pull request as ready for review February 7, 2024 12:09
cpp/arcticdb/storage/memory/memory_storage.cpp Outdated Show resolved Hide resolved
cpp/arcticdb/storage/s3/detail-inl.hpp Outdated Show resolved Hide resolved
cpp/arcticdb/storage/s3/detail-inl.hpp Outdated Show resolved Hide resolved
cpp/arcticdb/storage/s3/detail-inl.hpp Outdated Show resolved Hide resolved
cpp/arcticdb/storage/s3/detail-inl.hpp Outdated Show resolved Hide resolved
cpp/arcticdb/storage/s3/detail-inl.hpp Outdated Show resolved Hide resolved
cpp/arcticdb/storage/s3/detail-inl.hpp Outdated Show resolved Hide resolved
@muhammadhamzasajjad muhammadhamzasajjad merged commit 92e6877 into master Feb 13, 2024
114 checks passed
@muhammadhamzasajjad muhammadhamzasajjad deleted the s3_storage_exceptions branch February 13, 2024 18:11
@muhammadhamzasajjad muhammadhamzasajjad self-assigned this Feb 27, 2024
muhammadhamzasajjad added a commit that referenced this pull request Mar 14, 2024
This is the final PR for exception normalization. Previous PRs are
#1411, #1360, #1344, #1304, #1297 and #1285
#### Reference Issues/PRs
Previously #1285 only normalized `KeyNotFoundException` and
`DuplicateKeyException` correctly. As mentioned in [this
comment](#1285 (comment)),
we need to normalize other lmdb specific errors too. This PR does that.
A mock client is also created to simulate the lmdb errors which aren't
easily produce-able with real lmdb but can occur.

The ErrorCode list has been updated in `error_code.hpp`. Previously, all
the storage error codes were just sequential. This required that each
time a new error was added for a specific storage, all the other error
codes needed to be changed as we want to assign sequential error codes
to the same storage. We now leave 10 error codes for each storage which
allows us to easily add new error codes for a storage without having to
change all the others.

`::lmdb::map_full_error` is now normalized. When this error occurs, lmdb
throws `LMDBMapFullException` which is child of `StorageException`

#### What does this implement or fix?

#### Any other comments?

#### Checklist

<details>
  <summary>
   Checklist for code changes...
  </summary>
 
- [ ] Have you updated the relevant docstrings, documentation and
copyright notice?
- [ ] Is this contribution tested against [all ArcticDB's
features](../docs/mkdocs/docs/technical/contributing.md)?
- [ ] Do all exceptions introduced raise appropriate [error
messages](https://docs.arcticdb.io/error_messages/)?
 - [ ] Are API changes highlighted in the PR description?
- [ ] Is the PR labelled as enhancement or bug so it appears in
autogenerated release notes?
</details>

<!--
Thanks for contributing a Pull Request to ArcticDB! Please ensure you
have taken a look at:
- ArcticDB's Code of Conduct:
https://github.com/man-group/ArcticDB/blob/master/CODE_OF_CONDUCT.md
- ArcticDB's Contribution Licensing:
https://github.com/man-group/ArcticDB/blob/master/docs/mkdocs/docs/technical/contributing.md#contribution-licensing
-->
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.

Use specific exception type for certain kinds of storage failures
3 participants