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

Disable missing key warnings when expected #1379

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading