Skip to content

Commit

Permalink
Disables the missing key warnings when expected
Browse files Browse the repository at this point in the history
- Also adds a minor clarifying rename in s3 details
  • Loading branch information
IvoDD committed Feb 27, 2024
1 parent ff31f06 commit 3597716
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
10 changes: 5 additions & 5 deletions cpp/arcticdb/storage/s3/detail-inl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@ namespace s3 {
ReadKeyOpts opts) {
ARCTICDB_SAMPLE(S3StorageRead, 0)
auto fmt_db = [](auto &&k) { return variant_key_type(k); };
std::vector<VariantKey> failed_reads;
std::vector<VariantKey> keys_not_found;

(fg::from(ks.as_range()) | fg::move | fg::groupBy(fmt_db)).foreach(
[&s3_client, &bucket_name, &root_folder, b = std::move(bucketizer), &visitor, &failed_reads,
[&s3_client, &bucket_name, &root_folder, b = std::move(bucketizer), &visitor, &keys_not_found,
opts = opts](auto &&group) {

for (auto &k: group.values()) {
Expand Down Expand Up @@ -185,12 +185,12 @@ namespace s3 {
error.GetExceptionName().c_str(),
error.GetMessage().c_str());

failed_reads.push_back(k);
keys_not_found.push_back(k);
}
}
});
if (!failed_reads.empty())
throw KeyNotFoundException(Composite<VariantKey>{std::move(failed_reads)});
if (!keys_not_found.empty())
throw KeyNotFoundException(Composite<VariantKey>{std::move(keys_not_found)});
}

struct FailedDelete {
Expand Down
8 changes: 6 additions & 2 deletions cpp/arcticdb/version/version_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,15 @@ inline void check_is_version(const AtomKey &key) {

inline void read_symbol_ref(const std::shared_ptr<StreamSource>& store, const StreamId &stream_id, VersionMapEntry &entry) {
std::pair<entity::VariantKey, SegmentInMemory> key_seg_pair;
// Trying to read a missing ref key is expected e.g. when writing a previously missing symbol.
// If the ref key is missing we keep the entry empty and should not raise warnings.
auto read_opts = storage::ReadKeyOpts{};
read_opts.dont_warn_about_missing_key=true;
try {
key_seg_pair = store->read_sync(RefKey{stream_id, KeyType::VERSION_REF});
key_seg_pair = store->read_sync(RefKey{stream_id, KeyType::VERSION_REF}, read_opts);
} catch (const storage::KeyNotFoundException&) {
try {
key_seg_pair = store->read_sync(RefKey{stream_id, KeyType::VERSION, true});
key_seg_pair = store->read_sync(RefKey{stream_id, KeyType::VERSION, true}, read_opts);
} catch (const storage::KeyNotFoundException&) {
return;
}
Expand Down

0 comments on commit 3597716

Please sign in to comment.