From 8f594309582849c0e0455989320e6504259a1eb8 Mon Sep 17 00:00:00 2001 From: Ivo Dilov Date: Thu, 11 Jul 2024 17:24:55 +0300 Subject: [PATCH] Better naming of version map LoadType and LoadObjective enum values This commit is just a rename addressing some code review comments. --- .../version/local_versioned_engine.cpp | 6 +- .../version/test/test_stream_version_data.cpp | 28 +-- .../version/test/test_version_map.cpp | 164 +++++++++--------- .../version/test/test_version_store.cpp | 4 +- .../version/test/version_backwards_compat.hpp | 4 +- cpp/arcticdb/version/version_functions.hpp | 18 +- cpp/arcticdb/version/version_map.hpp | 58 +++---- .../version/version_map_batch_methods.cpp | 6 +- .../version/version_map_batch_methods.hpp | 16 +- cpp/arcticdb/version/version_map_entry.hpp | 86 ++++----- cpp/arcticdb/version/version_store_api.cpp | 2 +- .../version/version_store_objects.hpp | 4 +- cpp/arcticdb/version/version_utils.hpp | 10 +- 13 files changed, 203 insertions(+), 203 deletions(-) diff --git a/cpp/arcticdb/version/local_versioned_engine.cpp b/cpp/arcticdb/version/local_versioned_engine.cpp index 30153c4a8fc..de9c7b7772b 100644 --- a/cpp/arcticdb/version/local_versioned_engine.cpp +++ b/cpp/arcticdb/version/local_versioned_engine.cpp @@ -864,9 +864,9 @@ folly::Future delete_trees_responsibly( { auto min_versions = min_versions_for_each_stream(orig_keys_to_delete); for (const auto& min : min_versions) { - auto load_strategy = load_type == LoadType::LOAD_DOWNTO - ? LoadStrategy{load_type, LoadObjective::ANY, static_cast(min.second)} - : LoadStrategy{load_type, LoadObjective::ANY}; + auto load_strategy = load_type == LoadType::DOWNTO + ? LoadStrategy{load_type, LoadObjective::INCLUDE_DELETED, static_cast(min.second)} + : LoadStrategy{load_type, LoadObjective::INCLUDE_DELETED}; const auto entry = version_map->check_reload(store, min.first, load_strategy, __FUNCTION__); entry_map.try_emplace(std::move(min.first), entry); } diff --git a/cpp/arcticdb/version/test/test_stream_version_data.cpp b/cpp/arcticdb/version/test/test_stream_version_data.cpp index b397f9c655b..6419104a1ac 100644 --- a/cpp/arcticdb/version/test/test_stream_version_data.cpp +++ b/cpp/arcticdb/version/test/test_stream_version_data.cpp @@ -12,8 +12,8 @@ TEST(StreamVersionData, SpecificVersion) { VersionQuery query_2{SpecificVersionQuery{VersionId(4)}}; stream_version_data.react(query_2); ASSERT_EQ(stream_version_data.count_, 2); - ASSERT_EQ(stream_version_data.load_strategy_.load_type_, LoadType::LOAD_DOWNTO); - ASSERT_EQ(stream_version_data.load_strategy_.load_objective_, LoadObjective::UNDELETED); + ASSERT_EQ(stream_version_data.load_strategy_.load_type_, LoadType::DOWNTO); + ASSERT_EQ(stream_version_data.load_strategy_.load_objective_, LoadObjective::UNDELETED_ONLY); ASSERT_EQ(stream_version_data.load_strategy_.load_until_version_, 4); } @@ -25,8 +25,8 @@ TEST(StreamVersionData, SpecificVersionReversed) { VersionQuery query_2{SpecificVersionQuery{VersionId(12)}}; stream_version_data.react(query_2); ASSERT_EQ(stream_version_data.count_, 2); - ASSERT_EQ(stream_version_data.load_strategy_.load_type_, LoadType::LOAD_DOWNTO); - ASSERT_EQ(stream_version_data.load_strategy_.load_objective_, LoadObjective::UNDELETED); + ASSERT_EQ(stream_version_data.load_strategy_.load_type_, LoadType::DOWNTO); + ASSERT_EQ(stream_version_data.load_strategy_.load_objective_, LoadObjective::UNDELETED_ONLY); ASSERT_EQ(stream_version_data.load_strategy_.load_until_version_, 4); } @@ -40,8 +40,8 @@ TEST(StreamVersionData, Timestamp) { VersionQuery query_2{TimestampVersionQuery{timestamp(4)}}; stream_version_data.react(query_2); ASSERT_EQ(stream_version_data.count_, 2); - ASSERT_EQ(stream_version_data.load_strategy_.load_type_, LoadType::LOAD_FROM_TIME); - ASSERT_EQ(stream_version_data.load_strategy_.load_objective_, LoadObjective::UNDELETED); + ASSERT_EQ(stream_version_data.load_strategy_.load_type_, LoadType::FROM_TIME); + ASSERT_EQ(stream_version_data.load_strategy_.load_objective_, LoadObjective::UNDELETED_ONLY); ASSERT_EQ(stream_version_data.load_strategy_.load_from_time_, 4); } @@ -57,8 +57,8 @@ TEST(StreamVersionData, TimestampUnordered) { VersionQuery query_3{TimestampVersionQuery{timestamp(4)}}; stream_version_data.react(query_3); ASSERT_EQ(stream_version_data.count_, 3); - ASSERT_EQ(stream_version_data.load_strategy_.load_type_, LoadType::LOAD_FROM_TIME); - ASSERT_EQ(stream_version_data.load_strategy_.load_objective_, LoadObjective::UNDELETED); + ASSERT_EQ(stream_version_data.load_strategy_.load_type_, LoadType::FROM_TIME); + ASSERT_EQ(stream_version_data.load_strategy_.load_objective_, LoadObjective::UNDELETED_ONLY); ASSERT_EQ(stream_version_data.load_strategy_.load_from_time_, 3); } @@ -70,8 +70,8 @@ TEST(StreamVersionData, Latest) { VersionQuery query_1{std::monostate{}}; stream_version_data.react(query_1); ASSERT_EQ(stream_version_data.count_, 1); - ASSERT_EQ(stream_version_data.load_strategy_.load_type_, LoadType::LOAD_LATEST); - ASSERT_EQ(stream_version_data.load_strategy_.load_objective_, LoadObjective::UNDELETED); + ASSERT_EQ(stream_version_data.load_strategy_.load_type_, LoadType::LATEST); + ASSERT_EQ(stream_version_data.load_strategy_.load_objective_, LoadObjective::UNDELETED_ONLY); ASSERT_EQ(stream_version_data.load_strategy_.load_until_version_.has_value(), false); } @@ -85,8 +85,8 @@ TEST(StreamVersionData, SpecificToTimestamp) { VersionQuery query_2{TimestampVersionQuery{timestamp(3)}}; stream_version_data.react(query_2); ASSERT_EQ(stream_version_data.count_, 2); - ASSERT_EQ(stream_version_data.load_strategy_.load_type_, LoadType::LOAD_ALL); - ASSERT_EQ(stream_version_data.load_strategy_.load_objective_, LoadObjective::UNDELETED); + ASSERT_EQ(stream_version_data.load_strategy_.load_type_, LoadType::ALL); + ASSERT_EQ(stream_version_data.load_strategy_.load_objective_, LoadObjective::UNDELETED_ONLY); ASSERT_EQ(stream_version_data.load_strategy_.load_until_version_.has_value(), false); ASSERT_EQ(stream_version_data.load_strategy_.load_from_time_.has_value(), false); } @@ -101,8 +101,8 @@ TEST(StreamVersionData, TimestampToSpecific) { VersionQuery query_2{SpecificVersionQuery{VersionId(12)}}; stream_version_data.react(query_2); ASSERT_EQ(stream_version_data.count_, 2); - ASSERT_EQ(stream_version_data.load_strategy_.load_type_, LoadType::LOAD_ALL); - ASSERT_EQ(stream_version_data.load_strategy_.load_objective_, LoadObjective::UNDELETED); + ASSERT_EQ(stream_version_data.load_strategy_.load_type_, LoadType::ALL); + ASSERT_EQ(stream_version_data.load_strategy_.load_objective_, LoadObjective::UNDELETED_ONLY); ASSERT_EQ(stream_version_data.load_strategy_.load_until_version_.has_value(), false); ASSERT_EQ(stream_version_data.load_strategy_.load_from_time_.has_value(), false); } \ No newline at end of file diff --git a/cpp/arcticdb/version/test/test_version_map.cpp b/cpp/arcticdb/version/test/test_version_map.cpp index 3b0944a1a76..cbad577f2cb 100644 --- a/cpp/arcticdb/version/test/test_version_map.cpp +++ b/cpp/arcticdb/version/test/test_version_map.cpp @@ -204,7 +204,7 @@ TEST(VersionMap, TestLoadsRefAndIteration) { version_map->load_via_iteration(store, id, entry_iteration); auto entry_ref = std::make_shared(); - version_map->load_via_ref_key(store, id, LoadStrategy{LoadType::LOAD_ALL, LoadObjective::ANY}, entry_ref); + version_map->load_via_ref_key(store, id, LoadStrategy{LoadType::ALL, LoadObjective::INCLUDE_DELETED}, entry_ref); ASSERT_EQ(entry_iteration->head_, entry_ref->head_); ASSERT_EQ(entry_iteration->keys_.size(), entry_ref->keys_.size()); @@ -418,7 +418,7 @@ TEST(VersionMap, FixRefKeyTombstones) { auto key5 = atom_key_with_version(id, 1, 1696590624590123209); version_map->write_version(store, key5, key4); auto key6 = atom_key_with_version(id, 0, 1696590624612743245); - auto entry = version_map->check_reload(store, id, LoadStrategy{LoadType::LOAD_LATEST, LoadObjective::ANY}, __FUNCTION__); + auto entry = version_map->check_reload(store, id, LoadStrategy{LoadType::LATEST, LoadObjective::INCLUDE_DELETED}, __FUNCTION__); version_map->journal_single_key(store, key5, entry->head_.value()); auto valid = version_map->check_ref_key(store, id); @@ -544,7 +544,7 @@ std::shared_ptr write_two_versions(std::shared_ptrcheck_reload( store, id, - LoadStrategy{LoadType::NOT_LOADED, LoadObjective::ANY}, + LoadStrategy{LoadType::NOT_LOADED, LoadObjective::INCLUDE_DELETED}, __FUNCTION__); auto key1 = atom_key_with_version(id, 0, 0); @@ -563,7 +563,7 @@ void write_alternating_deleted_undeleted(std::shared_ptr store, s auto entry = version_map->check_reload( store, id, - LoadStrategy{LoadType::NOT_LOADED, LoadObjective::ANY}, + LoadStrategy{LoadType::NOT_LOADED, LoadObjective::INCLUDE_DELETED}, __FUNCTION__); auto key1 = atom_key_with_version(id, 0, 0); @@ -602,26 +602,26 @@ TEST(VersionMap, FollowingVersionChain){ auto follow_result = std::make_shared(); version_map->follow_version_chain(store, ref_entry, follow_result, load_strategy); - EXPECT_EQ(follow_result->loaded_with_progress_.oldest_loaded_index_version_, VersionId{should_load_to}); + EXPECT_EQ(follow_result->load_progress_.oldest_loaded_index_version_, VersionId{should_load_to}); }; - check_strategy_loads_to(LoadStrategy{LoadType::LOAD_DOWNTO, LoadObjective::ANY, static_cast(0)}, 0); - check_strategy_loads_to(LoadStrategy{LoadType::LOAD_DOWNTO, LoadObjective::ANY, static_cast(-2)}, 1); + check_strategy_loads_to(LoadStrategy{LoadType::DOWNTO, LoadObjective::INCLUDE_DELETED, static_cast(0)}, 0); + check_strategy_loads_to(LoadStrategy{LoadType::DOWNTO, LoadObjective::INCLUDE_DELETED, static_cast(-2)}, 1); // DOWN_TO will not skip through tombstoned versions even when include_deleted=false - check_strategy_loads_to(LoadStrategy{LoadType::LOAD_DOWNTO, LoadObjective::UNDELETED, static_cast(-1)}, 2); - check_strategy_loads_to(LoadStrategy{LoadType::LOAD_DOWNTO, LoadObjective::UNDELETED, static_cast(0)}, 0); + check_strategy_loads_to(LoadStrategy{LoadType::DOWNTO, LoadObjective::UNDELETED_ONLY, static_cast(-1)}, 2); + check_strategy_loads_to(LoadStrategy{LoadType::DOWNTO, LoadObjective::UNDELETED_ONLY, static_cast(0)}, 0); // FROM_TIME when include_deleted=false will skip through deleted versions to go to the latest undeleted version before the timestamp. - check_strategy_loads_to(LoadStrategy{LoadType::LOAD_FROM_TIME, LoadObjective::UNDELETED, static_cast(10)}, 1); - check_strategy_loads_to(LoadStrategy{LoadType::LOAD_FROM_TIME, LoadObjective::UNDELETED, static_cast(0)}, 0); - check_strategy_loads_to(LoadStrategy{LoadType::LOAD_FROM_TIME, LoadObjective::ANY, static_cast(2)}, 2); - check_strategy_loads_to(LoadStrategy{LoadType::LOAD_FROM_TIME, LoadObjective::ANY, static_cast(0)}, 0); + check_strategy_loads_to(LoadStrategy{LoadType::FROM_TIME, LoadObjective::UNDELETED_ONLY, static_cast(10)}, 1); + check_strategy_loads_to(LoadStrategy{LoadType::FROM_TIME, LoadObjective::UNDELETED_ONLY, static_cast(0)}, 0); + check_strategy_loads_to(LoadStrategy{LoadType::FROM_TIME, LoadObjective::INCLUDE_DELETED, static_cast(2)}, 2); + check_strategy_loads_to(LoadStrategy{LoadType::FROM_TIME, LoadObjective::INCLUDE_DELETED, static_cast(0)}, 0); - check_strategy_loads_to(LoadStrategy{LoadType::LOAD_LATEST, LoadObjective::ANY}, 2); - check_strategy_loads_to(LoadStrategy{LoadType::LOAD_LATEST, LoadObjective::UNDELETED}, 1); + check_strategy_loads_to(LoadStrategy{LoadType::LATEST, LoadObjective::INCLUDE_DELETED}, 2); + check_strategy_loads_to(LoadStrategy{LoadType::LATEST, LoadObjective::UNDELETED_ONLY}, 1); - check_strategy_loads_to(LoadStrategy{LoadType::LOAD_ALL, LoadObjective::ANY}, 0); - check_strategy_loads_to(LoadStrategy{LoadType::LOAD_ALL, LoadObjective::UNDELETED}, 0); + check_strategy_loads_to(LoadStrategy{LoadType::ALL, LoadObjective::INCLUDE_DELETED}, 0); + check_strategy_loads_to(LoadStrategy{LoadType::ALL, LoadObjective::UNDELETED_ONLY}, 0); } TEST(VersionMap, FollowingVersionChainWithCaching){ @@ -640,41 +640,41 @@ TEST(VersionMap, FollowingVersionChainWithCaching){ EXPECT_EQ(loaded->get_indexes(false).size(), should_load_undeleted); }; - check_loads_versions(LoadStrategy{LoadType::LOAD_DOWNTO, LoadObjective::ANY, static_cast(-1)}, 1, 0); - // LOAD_FROM_TIME should not be cached by the LOAD_DOWNTO and should reload from storage up to the latest undeleted version, hence loading 2 versions, 1 of which is undeleted. - check_loads_versions(LoadStrategy{LoadType::LOAD_FROM_TIME, LoadObjective::UNDELETED, static_cast(10)}, 2, 1); - // LOAD_LATEST should be cached by the LOAD_FROM_TIME, so we still have the same 2 loaded versions - check_loads_versions(LoadStrategy{LoadType::LOAD_LATEST, LoadObjective::ANY}, 2, 1); - // This LOAD_FROM_TIME should still use the cached 2 versions - check_loads_versions(LoadStrategy{LoadType::LOAD_FROM_TIME, LoadObjective::ANY, static_cast(1)}, 2, 1); + check_loads_versions(LoadStrategy{LoadType::DOWNTO, LoadObjective::INCLUDE_DELETED, static_cast(-1)}, 1, 0); + // FROM_TIME should not be cached by the DOWNTO and should reload from storage up to the latest undeleted version, hence loading 2 versions, 1 of which is undeleted. + check_loads_versions(LoadStrategy{LoadType::FROM_TIME, LoadObjective::UNDELETED_ONLY, static_cast(10)}, 2, 1); + // LATEST should be cached by the FROM_TIME, so we still have the same 2 loaded versions + check_loads_versions(LoadStrategy{LoadType::LATEST, LoadObjective::INCLUDE_DELETED}, 2, 1); + // This FROM_TIME should still use the cached 2 versions + check_loads_versions(LoadStrategy{LoadType::FROM_TIME, LoadObjective::INCLUDE_DELETED, static_cast(1)}, 2, 1); // We just get the entry to use for the tombstone and the write auto entry = version_map->check_reload( store, id, - LoadStrategy{LoadType::NOT_LOADED, LoadObjective::ANY}, + LoadStrategy{LoadType::NOT_LOADED, LoadObjective::INCLUDE_DELETED}, __FUNCTION__); // We delete the only undeleted key version_map->write_tombstone(store, VersionId{1}, id, entry, timestamp{4}); - // LOAD_LATEST should still be cached, but the cached entry now needs to have no undeleted keys - check_loads_versions(LoadStrategy{LoadType::LOAD_LATEST, LoadObjective::ANY}, 2, 0); - // LOAD_FROM_TIME UNDELETED should no longer be cached even though we used the same request before because the undeleted key it went to got deleted. So it will load the entire version chain - check_loads_versions(LoadStrategy{LoadType::LOAD_FROM_TIME, LoadObjective::UNDELETED, static_cast(10)}, 3, 0); + // LATEST should still be cached, but the cached entry now needs to have no undeleted keys + check_loads_versions(LoadStrategy{LoadType::LATEST, LoadObjective::INCLUDE_DELETED}, 2, 0); + // FROM_TIME UNDELETED_ONLY should no longer be cached even though we used the same request before because the undeleted key it went to got deleted. So it will load the entire version chain + check_loads_versions(LoadStrategy{LoadType::FROM_TIME, LoadObjective::UNDELETED_ONLY, static_cast(10)}, 3, 0); // We add a new undeleted key auto key4 = atom_key_with_version(id, 3, 5); version_map->do_write(store, key4, entry); write_symbol_ref(store, key4, std::nullopt, entry->head_.value()); - // LOAD_LATEST should still be cached, but the cached entry now needs to have one more undeleted version - check_loads_versions(LoadStrategy{LoadType::LOAD_LATEST, LoadObjective::ANY}, 4, 1); + // LATEST should still be cached, but the cached entry now needs to have one more undeleted version + check_loads_versions(LoadStrategy{LoadType::LATEST, LoadObjective::INCLUDE_DELETED}, 4, 1); // We delete everything with a tombstone_all version_map->delete_all_versions(store, id); - // LOAD_LATEST should still be cached, but now have no undeleted versions - check_loads_versions(LoadStrategy{LoadType::LOAD_LATEST, LoadObjective::ANY}, 4, 0); + // LATEST should still be cached, but now have no undeleted versions + check_loads_versions(LoadStrategy{LoadType::LATEST, LoadObjective::INCLUDE_DELETED}, 4, 0); } TEST(VersionMap, FollowingVersionChainEndEarlyOnTombstoneAll) { @@ -691,28 +691,28 @@ TEST(VersionMap, FollowingVersionChainEndEarlyOnTombstoneAll) { auto follow_result = std::make_shared(); for (auto load_strategy: { - LoadStrategy{LoadType::LOAD_DOWNTO, LoadObjective::UNDELETED, static_cast(0)}, - LoadStrategy{LoadType::LOAD_FROM_TIME, LoadObjective::UNDELETED, static_cast(0)}, - LoadStrategy{LoadType::LOAD_ALL, LoadObjective::UNDELETED}, - LoadStrategy{LoadType::LOAD_LATEST, LoadObjective::UNDELETED} + LoadStrategy{LoadType::DOWNTO, LoadObjective::UNDELETED_ONLY, static_cast(0)}, + LoadStrategy{LoadType::FROM_TIME, LoadObjective::UNDELETED_ONLY, static_cast(0)}, + LoadStrategy{LoadType::ALL, LoadObjective::UNDELETED_ONLY}, + LoadStrategy{LoadType::LATEST, LoadObjective::UNDELETED_ONLY} }) { follow_result->clear(); version_map->follow_version_chain(store, ref_entry, follow_result, load_strategy); // When loading with any of the specified load strategies with include_deleted=false we should end following the version chain early // at version 1 because that's when we encounter the TOMBSTONE_ALL. - EXPECT_EQ(follow_result->loaded_with_progress_.oldest_loaded_index_version_, VersionId{1}); + EXPECT_EQ(follow_result->load_progress_.oldest_loaded_index_version_, VersionId{1}); } for (auto load_strategy: { - LoadStrategy{LoadType::LOAD_DOWNTO, LoadObjective::ANY, static_cast(0)}, - LoadStrategy{LoadType::LOAD_FROM_TIME, LoadObjective::ANY, static_cast(0)}, - LoadStrategy{LoadType::LOAD_ALL, LoadObjective::ANY} + LoadStrategy{LoadType::DOWNTO, LoadObjective::INCLUDE_DELETED, static_cast(0)}, + LoadStrategy{LoadType::FROM_TIME, LoadObjective::INCLUDE_DELETED, static_cast(0)}, + LoadStrategy{LoadType::ALL, LoadObjective::INCLUDE_DELETED} }) { follow_result->clear(); version_map->follow_version_chain(store, ref_entry, follow_result, load_strategy); // When loading with any of the specified load strategies with include_deleted=true we should continue to the beginning // at version 0 even though it was deleted. - EXPECT_EQ(follow_result->loaded_with_progress_.oldest_loaded_index_version_, VersionId{0}); + EXPECT_EQ(follow_result->load_progress_.oldest_loaded_index_version_, VersionId{0}); } } @@ -740,8 +740,8 @@ TEST(VersionMap, CacheInvalidation) { } }; - auto load_all_param = LoadStrategy{LoadType::LOAD_ALL, LoadObjective::ANY}; - auto load_all_undeleted_param = LoadStrategy{LoadType::LOAD_ALL, LoadObjective::UNDELETED}; + auto load_all_param = LoadStrategy{LoadType::ALL, LoadObjective::INCLUDE_DELETED}; + auto load_all_undeleted_param = LoadStrategy{LoadType::ALL, LoadObjective::UNDELETED_ONLY}; check_caching(load_all_param, load_all_undeleted_param, true); check_caching(load_all_undeleted_param, load_all_param, false); @@ -749,27 +749,27 @@ TEST(VersionMap, CacheInvalidation) { std::vector should_load_to_v[num_versions] = { // Different parameters which should all load to v0 std::vector{ - LoadStrategy{LoadType::LOAD_DOWNTO, LoadObjective::ANY, static_cast(0)}, - LoadStrategy{LoadType::LOAD_DOWNTO, LoadObjective::ANY, static_cast(-3)}, - LoadStrategy{LoadType::LOAD_FROM_TIME, LoadObjective::ANY, static_cast(0)}, + LoadStrategy{LoadType::DOWNTO, LoadObjective::INCLUDE_DELETED, static_cast(0)}, + LoadStrategy{LoadType::DOWNTO, LoadObjective::INCLUDE_DELETED, static_cast(-3)}, + LoadStrategy{LoadType::FROM_TIME, LoadObjective::INCLUDE_DELETED, static_cast(0)}, }, // Different parameters which should all load to v1 std::vector{ - LoadStrategy{LoadType::LOAD_DOWNTO, LoadObjective::ANY, static_cast(1)}, - LoadStrategy{LoadType::LOAD_DOWNTO, LoadObjective::ANY, static_cast(-2)}, - LoadStrategy{LoadType::LOAD_FROM_TIME, LoadObjective::ANY, static_cast(1)}, - LoadStrategy{LoadType::LOAD_FROM_TIME, LoadObjective::UNDELETED, - static_cast(2)}, // when include_deleted=false LOAD_FROM_TIME searches for an undeleted version - LoadStrategy{LoadType::LOAD_LATEST, LoadObjective::UNDELETED}, + LoadStrategy{LoadType::DOWNTO, LoadObjective::INCLUDE_DELETED, static_cast(1)}, + LoadStrategy{LoadType::DOWNTO, LoadObjective::INCLUDE_DELETED, static_cast(-2)}, + LoadStrategy{LoadType::FROM_TIME, LoadObjective::INCLUDE_DELETED, static_cast(1)}, + LoadStrategy{LoadType::FROM_TIME, LoadObjective::UNDELETED_ONLY, + static_cast(2)}, // when include_deleted=false FROM_TIME searches for an undeleted version + LoadStrategy{LoadType::LATEST, LoadObjective::UNDELETED_ONLY}, }, // Different parameters which should all load to v2 std::vector{ - LoadStrategy{LoadType::LOAD_DOWNTO, LoadObjective::ANY, static_cast(2)}, - LoadStrategy{LoadType::LOAD_DOWNTO, LoadObjective::ANY, static_cast(-1)}, - LoadStrategy{LoadType::LOAD_FROM_TIME, LoadObjective::ANY, static_cast(2)}, - LoadStrategy{LoadType::LOAD_LATEST, LoadObjective::ANY}, + LoadStrategy{LoadType::DOWNTO, LoadObjective::INCLUDE_DELETED, static_cast(2)}, + LoadStrategy{LoadType::DOWNTO, LoadObjective::INCLUDE_DELETED, static_cast(-1)}, + LoadStrategy{LoadType::FROM_TIME, LoadObjective::INCLUDE_DELETED, static_cast(2)}, + LoadStrategy{LoadType::LATEST, LoadObjective::INCLUDE_DELETED}, } }; @@ -779,7 +779,7 @@ TEST(VersionMap, CacheInvalidation) { check_all_caching(should_load_to_v[i], should_load_to_v[j], i<=j); } - // LOAD_ALL and LOAD_UNDELETED because they both load to v0 (UNDELETED will load v0 because only there it will load + // ALL and LOAD_UNDELETED because they both load to v0 (UNDELETED_ONLY will load v0 because only there it will load check_all_caching({load_all_param, load_all_undeleted_param}, should_load_to_v[i], true); check_all_caching(should_load_to_v[i], {load_all_param, load_all_undeleted_param}, false); } @@ -803,26 +803,26 @@ TEST(VersionMap, CacheInvalidationWithTombstoneAfterLoad) { auto entry = version_map->check_reload( store, id, - LoadStrategy{LoadType::LOAD_DOWNTO, LoadObjective::ANY, static_cast(1)}, + LoadStrategy{LoadType::DOWNTO, LoadObjective::INCLUDE_DELETED, static_cast(1)}, __FUNCTION__); - ASSERT_TRUE(version_map->has_cached_entry(id, LoadStrategy{LoadType::LOAD_LATEST, LoadObjective::UNDELETED})); - ASSERT_TRUE(version_map->has_cached_entry(id, LoadStrategy{LoadType::LOAD_FROM_TIME, LoadObjective::UNDELETED, static_cast(1)})); - ASSERT_FALSE(version_map->has_cached_entry(id, LoadStrategy{LoadType::LOAD_FROM_TIME, LoadObjective::UNDELETED, static_cast(0)})); - ASSERT_TRUE(version_map->has_cached_entry(id, LoadStrategy{LoadType::LOAD_DOWNTO, LoadObjective::UNDELETED, static_cast(-1)})); - ASSERT_FALSE(version_map->has_cached_entry(id, LoadStrategy{LoadType::LOAD_DOWNTO, LoadObjective::UNDELETED, static_cast(-2)})); + ASSERT_TRUE(version_map->has_cached_entry(id, LoadStrategy{LoadType::LATEST, LoadObjective::UNDELETED_ONLY})); + ASSERT_TRUE(version_map->has_cached_entry(id, LoadStrategy{LoadType::FROM_TIME, LoadObjective::UNDELETED_ONLY, static_cast(1)})); + ASSERT_FALSE(version_map->has_cached_entry(id, LoadStrategy{LoadType::FROM_TIME, LoadObjective::UNDELETED_ONLY, static_cast(0)})); + ASSERT_TRUE(version_map->has_cached_entry(id, LoadStrategy{LoadType::DOWNTO, LoadObjective::UNDELETED_ONLY, static_cast(-1)})); + ASSERT_FALSE(version_map->has_cached_entry(id, LoadStrategy{LoadType::DOWNTO, LoadObjective::UNDELETED_ONLY, static_cast(-2)})); // When - we delete version 1 and reload version_map->write_tombstone(store, VersionId{1}, id, entry); // Now when the cached version is deleted, we should invalidate the cache for load parameters which look for undeleted. - ASSERT_FALSE(version_map->has_cached_entry(id, LoadStrategy{LoadType::LOAD_LATEST, LoadObjective::UNDELETED})); - ASSERT_FALSE(version_map->has_cached_entry(id, LoadStrategy{LoadType::LOAD_FROM_TIME, LoadObjective::UNDELETED, static_cast(1)})); - ASSERT_TRUE(version_map->has_cached_entry(id, LoadStrategy{LoadType::LOAD_LATEST, LoadObjective::ANY})); - ASSERT_TRUE(version_map->has_cached_entry(id, LoadStrategy{LoadType::LOAD_FROM_TIME, LoadObjective::ANY, static_cast(1)})); - ASSERT_TRUE(version_map->has_cached_entry(id, LoadStrategy{LoadType::LOAD_DOWNTO, LoadObjective::UNDELETED, static_cast(-1)})); + ASSERT_FALSE(version_map->has_cached_entry(id, LoadStrategy{LoadType::LATEST, LoadObjective::UNDELETED_ONLY})); + ASSERT_FALSE(version_map->has_cached_entry(id, LoadStrategy{LoadType::FROM_TIME, LoadObjective::UNDELETED_ONLY, static_cast(1)})); + ASSERT_TRUE(version_map->has_cached_entry(id, LoadStrategy{LoadType::LATEST, LoadObjective::INCLUDE_DELETED})); + ASSERT_TRUE(version_map->has_cached_entry(id, LoadStrategy{LoadType::FROM_TIME, LoadObjective::INCLUDE_DELETED, static_cast(1)})); + ASSERT_TRUE(version_map->has_cached_entry(id, LoadStrategy{LoadType::DOWNTO, LoadObjective::UNDELETED_ONLY, static_cast(-1)})); - LoadStrategy load_strategy{LoadType::LOAD_LATEST, LoadObjective::UNDELETED}; + LoadStrategy load_strategy{LoadType::LATEST, LoadObjective::UNDELETED_ONLY}; const auto latest_undeleted_entry = version_map->check_reload(store, id, load_strategy, __FUNCTION__); // Then - version 0 should be returned @@ -846,30 +846,30 @@ TEST(VersionMap, CacheInvalidationWithTombstoneAllAfterLoad) { auto entry = version_map->check_reload( store, id, - LoadStrategy{LoadType::LOAD_DOWNTO, LoadObjective::ANY, static_cast(0)}, + LoadStrategy{LoadType::DOWNTO, LoadObjective::INCLUDE_DELETED, static_cast(0)}, __FUNCTION__); - ASSERT_TRUE(version_map->has_cached_entry(id, LoadStrategy{LoadType::LOAD_LATEST, LoadObjective::UNDELETED})); - ASSERT_TRUE(version_map->has_cached_entry(id, LoadStrategy{LoadType::LOAD_FROM_TIME, LoadObjective::UNDELETED, static_cast(1)})); - ASSERT_TRUE(version_map->has_cached_entry(id, LoadStrategy{LoadType::LOAD_FROM_TIME, LoadObjective::UNDELETED, static_cast(0)})); - ASSERT_TRUE(version_map->has_cached_entry(id, LoadStrategy{LoadType::LOAD_DOWNTO, LoadObjective::UNDELETED, static_cast(-1)})); - ASSERT_TRUE(version_map->has_cached_entry(id, LoadStrategy{LoadType::LOAD_DOWNTO, LoadObjective::UNDELETED, static_cast(-2)})); + ASSERT_TRUE(version_map->has_cached_entry(id, LoadStrategy{LoadType::LATEST, LoadObjective::UNDELETED_ONLY})); + ASSERT_TRUE(version_map->has_cached_entry(id, LoadStrategy{LoadType::FROM_TIME, LoadObjective::UNDELETED_ONLY, static_cast(1)})); + ASSERT_TRUE(version_map->has_cached_entry(id, LoadStrategy{LoadType::FROM_TIME, LoadObjective::UNDELETED_ONLY, static_cast(0)})); + ASSERT_TRUE(version_map->has_cached_entry(id, LoadStrategy{LoadType::DOWNTO, LoadObjective::UNDELETED_ONLY, static_cast(-1)})); + ASSERT_TRUE(version_map->has_cached_entry(id, LoadStrategy{LoadType::DOWNTO, LoadObjective::UNDELETED_ONLY, static_cast(-2)})); // When - we delete version 1 auto tombstone_key = version_map->write_tombstone(store, VersionId{1}, id, entry); // We should not invalidate the cache because the version we loaded to is still undeleted - ASSERT_TRUE(version_map->has_cached_entry(id, LoadStrategy{LoadType::LOAD_LATEST, LoadObjective::UNDELETED})); - ASSERT_TRUE(version_map->has_cached_entry(id, LoadStrategy{LoadType::LOAD_FROM_TIME, LoadObjective::UNDELETED, static_cast(1)})); - ASSERT_TRUE(version_map->has_cached_entry(id, LoadStrategy{LoadType::LOAD_FROM_TIME, LoadObjective::UNDELETED, static_cast(0)})); + ASSERT_TRUE(version_map->has_cached_entry(id, LoadStrategy{LoadType::LATEST, LoadObjective::UNDELETED_ONLY})); + ASSERT_TRUE(version_map->has_cached_entry(id, LoadStrategy{LoadType::FROM_TIME, LoadObjective::UNDELETED_ONLY, static_cast(1)})); + ASSERT_TRUE(version_map->has_cached_entry(id, LoadStrategy{LoadType::FROM_TIME, LoadObjective::UNDELETED_ONLY, static_cast(0)})); // When - we delete all versions without reloading version_map->write_tombstone_all_key_internal(store, tombstone_key, entry); // We should invalidate cached undeleted checks - ASSERT_FALSE(version_map->has_cached_entry(id, LoadStrategy{LoadType::LOAD_LATEST, LoadObjective::UNDELETED})); - ASSERT_FALSE(version_map->has_cached_entry(id, LoadStrategy{LoadType::LOAD_FROM_TIME, LoadObjective::UNDELETED, static_cast(1)})); - ASSERT_FALSE(version_map->has_cached_entry(id, LoadStrategy{LoadType::LOAD_FROM_TIME, LoadObjective::UNDELETED, static_cast(0)})); + ASSERT_FALSE(version_map->has_cached_entry(id, LoadStrategy{LoadType::LATEST, LoadObjective::UNDELETED_ONLY})); + ASSERT_FALSE(version_map->has_cached_entry(id, LoadStrategy{LoadType::FROM_TIME, LoadObjective::UNDELETED_ONLY, static_cast(1)})); + ASSERT_FALSE(version_map->has_cached_entry(id, LoadStrategy{LoadType::FROM_TIME, LoadObjective::UNDELETED_ONLY, static_cast(0)})); } #define GTEST_COUT std::cerr << "[ ] [ INFO ]" diff --git a/cpp/arcticdb/version/test/test_version_store.cpp b/cpp/arcticdb/version/test/test_version_store.cpp index b0c32ad1b55..8f7a19ab8c9 100644 --- a/cpp/arcticdb/version/test/test_version_store.cpp +++ b/cpp/arcticdb/version/test/test_version_store.cpp @@ -136,7 +136,7 @@ TEST(PythonVersionStore, IterationVsRefWrite) { auto ref_entry = std::make_shared(); version_map->load_via_iteration(mock_store, stream_id, iter_entry); - version_map->load_via_ref_key(mock_store, stream_id, LoadStrategy{LoadType::LOAD_ALL, LoadObjective::ANY}, ref_entry); + version_map->load_via_ref_key(mock_store, stream_id, LoadStrategy{LoadType::ALL, LoadObjective::INCLUDE_DELETED}, ref_entry); EXPECT_EQ(std::string(iter_entry->head_.value().view()), std::string(ref_entry->head_.value().view())); ASSERT_EQ(iter_entry->keys_.size(), ref_entry->keys_.size()); @@ -151,7 +151,7 @@ TEST(PythonVersionStore, IterationVsRefWrite) { auto ref_entry_compact = std::make_shared(); version_map->load_via_iteration(mock_store, stream_id, iter_entry_compact); - version_map->load_via_ref_key(mock_store, stream_id, LoadStrategy{LoadType::LOAD_ALL, arcticdb::LoadObjective::ANY}, ref_entry_compact); + version_map->load_via_ref_key(mock_store, stream_id, LoadStrategy{LoadType::ALL, arcticdb::LoadObjective::INCLUDE_DELETED}, ref_entry_compact); EXPECT_EQ(std::string(iter_entry_compact->head_.value().view()), std::string(ref_entry_compact->head_.value().view())); ASSERT_EQ(iter_entry_compact->keys_.size(), ref_entry_compact->keys_.size()); diff --git a/cpp/arcticdb/version/test/version_backwards_compat.hpp b/cpp/arcticdb/version/test/version_backwards_compat.hpp index 51f6c014baf..41c63b7adbd 100644 --- a/cpp/arcticdb/version/test/version_backwards_compat.hpp +++ b/cpp/arcticdb/version/test/version_backwards_compat.hpp @@ -33,7 +33,7 @@ std::deque backwards_compat_delete_all_versions( const StreamId& stream_id ) { std::deque output; - auto entry = version_map->check_reload(store, stream_id, LoadStrategy{LoadType::LOAD_ALL, LoadObjective::ANY}, __FUNCTION__); + auto entry = version_map->check_reload(store, stream_id, LoadStrategy{LoadType::ALL, LoadObjective::INCLUDE_DELETED}, __FUNCTION__); auto indexes = entry->get_indexes(false); output.assign(std::begin(indexes), std::end(indexes)); @@ -49,7 +49,7 @@ std::vector backwards_compat_write_and_prune_previous(std::shared_ptr output; - auto entry = version_map->check_reload(store, key.id(), LoadStrategy{LoadType::LOAD_ALL, LoadObjective::ANY}, __FUNCTION__); + auto entry = version_map->check_reload(store, key.id(), LoadStrategy{LoadType::ALL, LoadObjective::INCLUDE_DELETED}, __FUNCTION__); auto old_entry = *entry; entry->clear(); diff --git a/cpp/arcticdb/version/version_functions.hpp b/cpp/arcticdb/version/version_functions.hpp index 5954b8e4859..46dda3969ec 100644 --- a/cpp/arcticdb/version/version_functions.hpp +++ b/cpp/arcticdb/version/version_functions.hpp @@ -19,7 +19,7 @@ inline std::optional get_latest_undeleted_version( const std::shared_ptr &version_map, const StreamId &stream_id) { ARCTICDB_RUNTIME_SAMPLE(GetLatestUndeletedVersion, 0) - LoadStrategy load_strategy{LoadType::LOAD_LATEST, LoadObjective::UNDELETED}; + LoadStrategy load_strategy{LoadType::LATEST, LoadObjective::UNDELETED_ONLY}; const auto entry = version_map->check_reload(store, stream_id, load_strategy, __FUNCTION__); return entry->get_first_index(false).first; } @@ -29,7 +29,7 @@ inline std::pair, bool> get_latest_version( const std::shared_ptr &version_map, const StreamId &stream_id) { ARCTICDB_SAMPLE(GetLatestVersion, 0) - LoadStrategy load_strategy{LoadType::LOAD_LATEST, LoadObjective::ANY}; + LoadStrategy load_strategy{LoadType::LATEST, LoadObjective::INCLUDE_DELETED}; auto entry = version_map->check_reload(store, stream_id, load_strategy, __FUNCTION__); return entry->get_first_index(true); } @@ -40,7 +40,7 @@ inline version_store::UpdateInfo get_latest_undeleted_version_and_next_version_i const std::shared_ptr &version_map, const StreamId &stream_id) { ARCTICDB_SAMPLE(GetLatestUndeletedVersionAndHighestVersionId, 0) - LoadStrategy load_strategy{LoadType::LOAD_LATEST, LoadObjective::UNDELETED}; + LoadStrategy load_strategy{LoadType::LATEST, LoadObjective::UNDELETED_ONLY}; auto entry = version_map->check_reload(store, stream_id, load_strategy, __FUNCTION__); auto latest_version = entry->get_first_index(true).first; auto latest_undeleted_version = entry->get_first_index(false).first; @@ -54,7 +54,7 @@ inline std::vector get_all_versions( const StreamId &stream_id ) { ARCTICDB_SAMPLE(GetAllVersions, 0) - LoadStrategy load_strategy{LoadType::LOAD_ALL, LoadObjective::UNDELETED}; + LoadStrategy load_strategy{LoadType::ALL, LoadObjective::UNDELETED_ONLY}; auto entry = version_map->check_reload(store, stream_id, load_strategy, __FUNCTION__); return entry->get_indexes(false); } @@ -65,7 +65,7 @@ inline std::optional get_specific_version( const StreamId &stream_id, SignedVersionId signed_version_id, bool include_deleted = false) { - LoadStrategy load_strategy{LoadType::LOAD_DOWNTO, LoadObjective::UNDELETED, signed_version_id}; + LoadStrategy load_strategy{LoadType::DOWNTO, LoadObjective::UNDELETED_ONLY, signed_version_id}; auto entry = version_map->check_reload(store, stream_id, load_strategy, __FUNCTION__); VersionId version_id; if (signed_version_id >= 0) { @@ -138,7 +138,7 @@ inline std::unordered_map get_all_tombstoned_versions( const std::shared_ptr &store, const std::shared_ptr &version_map, const StreamId &stream_id) { - LoadStrategy load_strategy{LoadType::LOAD_ALL, LoadObjective::ANY}; + LoadStrategy load_strategy{LoadType::ALL, LoadObjective::INCLUDE_DELETED}; auto entry = version_map->check_reload(store, stream_id, load_strategy, __FUNCTION__); std::unordered_map result; for (auto key: entry->get_tombstoned_indexes()) @@ -155,7 +155,7 @@ inline version_store::TombstoneVersionResult tombstone_version( bool allow_tombstoning_beyond_latest_version=false, const std::optional& creation_ts=std::nullopt) { ARCTICDB_DEBUG(log::version(), "Tombstoning version {} for stream {}", version_id, stream_id); - LoadStrategy load_strategy{LoadType::LOAD_ALL, LoadObjective::UNDELETED}; + LoadStrategy load_strategy{LoadType::ALL, LoadObjective::UNDELETED_ONLY}; auto entry = version_map->check_reload(store, stream_id, load_strategy, __FUNCTION__); // Might as well do the previous/next version check while we find the required version_id. // But if entry is empty, it's possible the load failed (since iterate_on_failure=false above), so set the flag @@ -217,7 +217,7 @@ inline std::optional load_index_key_from_time( const std::shared_ptr &version_map, const StreamId &stream_id, timestamp from_time) { - LoadStrategy load_strategy{LoadType::LOAD_FROM_TIME, LoadObjective::UNDELETED, from_time}; + LoadStrategy load_strategy{LoadType::FROM_TIME, LoadObjective::UNDELETED_ONLY, from_time}; auto entry = version_map->check_reload(store, stream_id, load_strategy, __FUNCTION__); auto indexes = entry->get_indexes(false); return get_index_key_from_time(from_time, indexes); @@ -227,7 +227,7 @@ inline std::vector get_index_and_tombstone_keys( const std::shared_ptr &store, const std::shared_ptr &version_map, const StreamId &stream_id) { - LoadStrategy load_strategy{LoadType::LOAD_ALL, LoadObjective::ANY}; + LoadStrategy load_strategy{LoadType::ALL, LoadObjective::INCLUDE_DELETED}; const auto entry = version_map->check_reload(store, stream_id, load_strategy, __FUNCTION__); std::vector res; std::copy_if(std::begin(entry->keys_), std::end(entry->keys_), std::back_inserter(res), diff --git a/cpp/arcticdb/version/version_map.hpp b/cpp/arcticdb/version/version_map.hpp index 926d5e9faf9..975af22ee44 100644 --- a/cpp/arcticdb/version/version_map.hpp +++ b/cpp/arcticdb/version/version_map.hpp @@ -160,7 +160,7 @@ class VersionMapImpl { } if (key_exists_in_ref_entry(load_strategy, ref_entry, cached_penultimate_index)) { - load_progress = ref_entry.loaded_with_progress_; + load_progress = ref_entry.load_progress_; entry->keys_.push_back(ref_entry.keys_[0]); if(cached_penultimate_index) entry->keys_.push_back(*cached_penultimate_index); @@ -176,7 +176,7 @@ class VersionMapImpl { && continue_when_loading_latest(load_strategy, entry) && continue_when_loading_undeleted(load_strategy, entry, load_progress)); } - entry->loaded_with_progress_ = load_progress; + entry->load_progress_ = load_progress; } void load_via_ref_key( @@ -235,7 +235,7 @@ class VersionMapImpl { } void write_version(std::shared_ptr store, const AtomKey &key, const std::optional& previous_key) { - LoadStrategy load_param{LoadType::LOAD_LATEST, LoadObjective::ANY}; + LoadStrategy load_param{LoadType::LATEST, LoadObjective::INCLUDE_DELETED}; auto entry = check_reload(store, key.id(), load_param, __FUNCTION__); do_write(store, key, entry); @@ -259,7 +259,7 @@ class VersionMapImpl { auto entry = check_reload( store, stream_id, - LoadStrategy{LoadType::LOAD_ALL, LoadObjective::UNDELETED}, + LoadStrategy{LoadType::ALL, LoadObjective::UNDELETED_ONLY}, __FUNCTION__); auto output = tombstone_from_key_or_all_internal(store, stream_id, first_key_to_tombstone, entry); @@ -273,7 +273,7 @@ class VersionMapImpl { } std::string dump_entry(const std::shared_ptr& store, const StreamId& stream_id) { - const auto entry = check_reload(store, stream_id, LoadStrategy{LoadType::LOAD_ALL, LoadObjective::ANY}, __FUNCTION__); + const auto entry = check_reload(store, stream_id, LoadStrategy{LoadType::ALL, LoadObjective::INCLUDE_DELETED}, __FUNCTION__); return entry->dump(); } @@ -285,7 +285,7 @@ class VersionMapImpl { auto entry = check_reload( store, key.id(), - LoadStrategy{LoadType::LOAD_ALL, LoadObjective::UNDELETED}, + LoadStrategy{LoadType::ALL, LoadObjective::UNDELETED_ONLY}, __FUNCTION__); auto [_, result] = tombstone_from_key_or_all_internal(store, key.id(), previous_key, entry); @@ -324,7 +324,7 @@ class VersionMapImpl { // This method has no API, and is not tested in the rapidcheck tests, but could easily be enabled there. // It compacts the version map but skips any keys which have been deleted (to free up space). ARCTICDB_DEBUG(log::version(), "Version map compacting versions for stream {}", stream_id); - auto entry = check_reload(store, stream_id, LoadStrategy{LoadType::LOAD_ALL, LoadObjective::ANY}, __FUNCTION__); + auto entry = check_reload(store, stream_id, LoadStrategy{LoadType::ALL, LoadObjective::INCLUDE_DELETED}, __FUNCTION__); if (!requires_compaction(entry)) return; @@ -439,7 +439,7 @@ class VersionMapImpl { void compact(std::shared_ptr store, const StreamId& stream_id) { ARCTICDB_DEBUG(log::version(), "Version map compacting versions for stream {}", stream_id); - auto entry = check_reload(store, stream_id, LoadStrategy{LoadType::LOAD_ALL, LoadObjective::ANY}, __FUNCTION__); + auto entry = check_reload(store, stream_id, LoadStrategy{LoadType::ALL, LoadObjective::INCLUDE_DELETED}, __FUNCTION__); if (entry->empty()) { log::version().warn("Entry is empty in compact"); return; @@ -461,7 +461,7 @@ class VersionMapImpl { void overwrite_symbol_tree( std::shared_ptr store, const StreamId& stream_id, const std::vector& index_keys) { - auto entry = check_reload(store, stream_id, LoadStrategy{LoadType::LOAD_ALL, LoadObjective::ANY}, __FUNCTION__); + auto entry = check_reload(store, stream_id, LoadStrategy{LoadType::ALL, LoadObjective::INCLUDE_DELETED}, __FUNCTION__); auto old_entry = *entry; if (!index_keys.empty()) { entry->keys_.assign(std::begin(index_keys), std::end(index_keys)); @@ -577,7 +577,7 @@ class VersionMapImpl { switch (requested_load_type) { case LoadType::NOT_LOADED: return true; - case LoadType::LOAD_LATEST: { + case LoadType::LATEST: { // If entry has at least one (maybe undeleted) index we have the latest value cached // This check can be slow if we have thousands of deleted versions before the first undeleted and we're @@ -586,20 +586,20 @@ class VersionMapImpl { auto opt_latest = entry->get_first_index(requested_load_strategy.should_include_deleted()).first; return opt_latest.has_value(); } - case LoadType::LOAD_DOWNTO: + case LoadType::DOWNTO: // We check whether the oldest loaded version is before or at the requested one return loaded_as_far_as_version_id(*entry, requested_load_strategy.load_until_version_.value()); - case LoadType::LOAD_FROM_TIME: { + case LoadType::FROM_TIME: { // We check whether the cached (deleted or undeleted) timestamp is before or at the requested one auto cached_timestamp = requested_load_strategy.should_include_deleted() ? - entry->loaded_with_progress_.earliest_loaded_timestamp_ : - entry->loaded_with_progress_.earliest_loaded_undeleted_timestamp_; + entry->load_progress_.earliest_loaded_timestamp_ : + entry->load_progress_.earliest_loaded_undeleted_timestamp_; return cached_timestamp <= requested_load_strategy.load_from_time_.value(); } - case LoadType::LOAD_ALL: - // We can use cache when it was populated by a LOAD_ALL call, in which case it is only unsafe to use + case LoadType::ALL: + // We can use cache when it was populated by a ALL call, in which case it is only unsafe to use // when the cache is of undeleted versions and the request is for all versions - if (cached_load_type==LoadType::LOAD_ALL){ + if (cached_load_type==LoadType::ALL){ return entry->load_strategy_.should_include_deleted() || !requested_load_strategy.should_include_deleted(); } return false; @@ -682,9 +682,9 @@ class VersionMapImpl { */ bool loaded_as_far_as_version_id(const VersionMapEntry& entry, SignedVersionId requested_version_id) const { if (requested_version_id >= 0) { - if (entry.loaded_with_progress_.oldest_loaded_index_version_ <= static_cast(requested_version_id)) { + if (entry.load_progress_.oldest_loaded_index_version_ <= static_cast(requested_version_id)) { ARCTICDB_DEBUG(log::version(), "Loaded as far as required value {}, have {}", - requested_version_id, entry.loaded_with_progress_.oldest_loaded_index_version_); + requested_version_id, entry.load_progress_.oldest_loaded_index_version_); return true; } } else { @@ -692,9 +692,9 @@ class VersionMapImpl { if (opt_latest.has_value()) { auto opt_version_id = get_version_id_negative_index(opt_latest->version_id(), requested_version_id); - if (opt_version_id.has_value() && entry.loaded_with_progress_.oldest_loaded_index_version_ <= *opt_version_id) { + if (opt_version_id.has_value() && entry.load_progress_.oldest_loaded_index_version_ <= *opt_version_id) { ARCTICDB_DEBUG(log::version(), "Loaded as far as required value {}, have {} and there are {} total versions", - requested_version_id, entry.loaded_with_progress_.oldest_loaded_index_version_, opt_latest->version_id()); + requested_version_id, entry.load_progress_.oldest_loaded_index_version_, opt_latest->version_id()); return true; } } @@ -754,7 +754,7 @@ class VersionMapImpl { const auto clock_unsync_tolerance = ConfigsMap::instance()->get_int("VersionMap.UnsyncTolerance", DEFAULT_CLOCK_UNSYNC_TOLERANCE); entry->last_reload_time_ = Clock::nanos_since_epoch() - clock_unsync_tolerance; - entry->load_strategy_ = LoadStrategy{LoadType::NOT_LOADED, LoadObjective::ANY}; // FUTURE: to make more thread-safe with #368 + entry->load_strategy_ = LoadStrategy{LoadType::NOT_LOADED, LoadObjective::INCLUDE_DELETED}; // FUTURE: to make more thread-safe with #368 auto temp = std::make_shared(*entry); load_via_ref_key(store, stream_id, load_strategy, temp); @@ -799,7 +799,7 @@ class VersionMapImpl { load_via_iteration(store, stream_id, entry_iteration); auto maybe_latest_pair = get_latest_key_pair(entry_iteration); if (!maybe_latest_pair) { - log::version().warn("Latest version not found for {}", stream_id); + log::version().warn("LATEST version not found for {}", stream_id); return false; } @@ -824,7 +824,7 @@ class VersionMapImpl { try { auto entry_ref = std::make_shared(); - load_via_ref_key(store, stream_id, LoadStrategy{LoadType::LOAD_ALL, LoadObjective::ANY}, entry_ref); + load_via_ref_key(store, stream_id, LoadStrategy{LoadType::ALL, LoadObjective::INCLUDE_DELETED}, entry_ref); entry_ref->validate(); } catch (const std::exception& err) { log::version().warn( @@ -837,7 +837,7 @@ class VersionMapImpl { bool indexes_sorted(const std::shared_ptr& store, const StreamId& stream_id) { auto entry_ref = std::make_shared(); - load_via_ref_key(store, stream_id, LoadStrategy{LoadType::LOAD_ALL, LoadObjective::ANY}, entry_ref); + load_via_ref_key(store, stream_id, LoadStrategy{LoadType::ALL, LoadObjective::INCLUDE_DELETED}, entry_ref); auto indexes = entry_ref->get_indexes(true); return std::is_sorted(std::cbegin(indexes), std::cend(indexes), [] (const auto& l, const auto& r) { return l > r; @@ -928,7 +928,7 @@ class VersionMapImpl { entry = check_reload( store, stream_id, - LoadStrategy{LoadType::LOAD_ALL, LoadObjective::UNDELETED}, + LoadStrategy{LoadType::ALL, LoadObjective::UNDELETED_ONLY}, __FUNCTION__); } @@ -958,9 +958,9 @@ class VersionMapImpl { // Invalidates the cached undeleted entry if it got tombstoned either by a tombstone or by a tombstone_all void maybe_invalidate_cached_undeleted(VersionMapEntry& entry){ - if (entry.is_tombstoned(entry.loaded_with_progress_.oldest_loaded_undeleted_index_version_)){ - entry.loaded_with_progress_.oldest_loaded_undeleted_index_version_ = std::numeric_limits::max(); - entry.loaded_with_progress_.earliest_loaded_undeleted_timestamp_ = std::numeric_limits::max(); + if (entry.is_tombstoned(entry.load_progress_.oldest_loaded_undeleted_index_version_)){ + entry.load_progress_.oldest_loaded_undeleted_index_version_ = std::numeric_limits::max(); + entry.load_progress_.earliest_loaded_undeleted_timestamp_ = std::numeric_limits::max(); } } diff --git a/cpp/arcticdb/version/version_map_batch_methods.cpp b/cpp/arcticdb/version/version_map_batch_methods.cpp index 1221f2190e6..1818e3ea26d 100644 --- a/cpp/arcticdb/version/version_map_batch_methods.cpp +++ b/cpp/arcticdb/version/version_map_batch_methods.cpp @@ -21,17 +21,17 @@ void StreamVersionData::react(const pipelines::VersionQuery &version_query) { void StreamVersionData::do_react(std::monostate) { ++count_; - load_strategy_ = union_of_undeleted_strategies(load_strategy_, LoadStrategy{LoadType::LOAD_LATEST, LoadObjective::UNDELETED}); + load_strategy_ = union_of_undeleted_strategies(load_strategy_, LoadStrategy{LoadType::LATEST, LoadObjective::UNDELETED_ONLY}); } void StreamVersionData::do_react(const pipelines::SpecificVersionQuery &specific_version) { ++count_; - load_strategy_ = union_of_undeleted_strategies(load_strategy_, LoadStrategy{LoadType::LOAD_DOWNTO, LoadObjective::UNDELETED, specific_version.version_id_}); + load_strategy_ = union_of_undeleted_strategies(load_strategy_, LoadStrategy{LoadType::DOWNTO, LoadObjective::UNDELETED_ONLY, specific_version.version_id_}); } void StreamVersionData::do_react(const pipelines::TimestampVersionQuery ×tamp_query) { ++count_; - load_strategy_ = union_of_undeleted_strategies(load_strategy_, LoadStrategy{LoadType::LOAD_FROM_TIME, LoadObjective::UNDELETED, timestamp_query.timestamp_}); + load_strategy_ = union_of_undeleted_strategies(load_strategy_, LoadStrategy{LoadType::FROM_TIME, LoadObjective::UNDELETED_ONLY, timestamp_query.timestamp_}); } void StreamVersionData::do_react(const pipelines::SnapshotVersionQuery &snapshot_query) { diff --git a/cpp/arcticdb/version/version_map_batch_methods.hpp b/cpp/arcticdb/version/version_map_batch_methods.hpp index 92d04d1a737..fe1425c90c0 100644 --- a/cpp/arcticdb/version/version_map_batch_methods.hpp +++ b/cpp/arcticdb/version/version_map_batch_methods.hpp @@ -69,7 +69,7 @@ inline std::shared_ptr> batch_check_l const std::shared_ptr &version_map, const std::shared_ptr> &symbols) { ARCTICDB_SAMPLE(BatchGetLatestVersion, 0) - const LoadStrategy load_strategy{LoadType::LOAD_LATEST, LoadObjective::UNDELETED}; + const LoadStrategy load_strategy{LoadType::LATEST, LoadObjective::UNDELETED_ONLY}; auto output = std::make_shared>(); auto mutex = std::make_shared(); @@ -105,7 +105,7 @@ inline std::shared_ptr> batch_get_latest_v const std::vector &stream_ids, bool include_deleted) { ARCTICDB_SAMPLE(BatchGetLatestVersion, 0) - const LoadStrategy load_strategy{LoadType::LOAD_LATEST, include_deleted ? LoadObjective::ANY : LoadObjective::UNDELETED}; + const LoadStrategy load_strategy{LoadType::LATEST, include_deleted ? LoadObjective::INCLUDE_DELETED : LoadObjective::UNDELETED_ONLY}; auto output = std::make_shared>(); auto mutex = std::make_shared(); @@ -134,7 +134,7 @@ inline std::vector, std::optional vector_fut.push_back(async::submit_io_task(CheckReloadTask{store, version_map, stream_id, - LoadStrategy{LoadType::LOAD_LATEST, LoadObjective::UNDELETED}}) + LoadStrategy{LoadType::LATEST, LoadObjective::UNDELETED_ONLY}}) .thenValue([](const std::shared_ptr& entry){ return std::make_pair(entry->get_first_index(false).first, entry->get_first_index(true).first); })); @@ -152,7 +152,7 @@ inline std::vector> batch_get_latest_un vector_fut.push_back(async::submit_io_task(CheckReloadTask{store, version_map, stream_id, - LoadStrategy{LoadType::LOAD_LATEST, LoadObjective::UNDELETED}}) + LoadStrategy{LoadType::LATEST, LoadObjective::UNDELETED_ONLY}}) .thenValue([](auto entry){ auto latest_version = entry->get_first_index(true).first; auto latest_undeleted_version = entry->get_first_index(false).first; @@ -199,7 +199,7 @@ inline std::shared_ptr> batch_get_specific MapRandomAccessWrapper wrapper{sym_versions}; submit_tasks_for_range(wrapper, [store, version_map](auto& sym_version) { - LoadStrategy load_strategy{LoadType::LOAD_DOWNTO, LoadObjective::UNDELETED, static_cast(sym_version.second)}; + LoadStrategy load_strategy{LoadType::DOWNTO, LoadObjective::UNDELETED_ONLY, static_cast(sym_version.second)}; return async::submit_io_task(CheckReloadTask{store, version_map, sym_version.first, load_strategy}); }, [output, option, output_mutex, store, tombstoned_vers, tombstoned_vers_mutex] @@ -252,7 +252,7 @@ inline std::shared_ptr, AtomKe submit_tasks_for_range(wrapper, [store, version_map](auto sym_version) { auto first_version = *std::min_element(std::begin(sym_version.second), std::end(sym_version.second)); - LoadStrategy load_strategy{LoadType::LOAD_DOWNTO, LoadObjective::UNDELETED, static_cast(first_version)}; + LoadStrategy load_strategy{LoadType::DOWNTO, LoadObjective::UNDELETED_ONLY, static_cast(first_version)}; return async::submit_io_task(CheckReloadTask{store, version_map, sym_version.first, load_strategy}); }, @@ -274,10 +274,10 @@ inline std::shared_ptr, AtomKe // [StreamVersionData] is used to combine different [VersionQuery]s for a stream_id into a list of needed snapshots and // a single [LoadStrategy] which will query the union of all version queries. -// It only ever produces load parameters where to_load=UNDELETED. +// It only ever produces load parameters where to_load=UNDELETED_ONLY. struct StreamVersionData { size_t count_ = 0; - LoadStrategy load_strategy_ = LoadStrategy{LoadType::NOT_LOADED, LoadObjective::UNDELETED}; + LoadStrategy load_strategy_ = LoadStrategy{LoadType::NOT_LOADED, LoadObjective::UNDELETED_ONLY}; boost::container::small_vector snapshots_; explicit StreamVersionData(const pipelines::VersionQuery& version_query); diff --git a/cpp/arcticdb/version/version_map_entry.hpp b/cpp/arcticdb/version/version_map_entry.hpp index 2f7e7c55a73..8545227b399 100644 --- a/cpp/arcticdb/version/version_map_entry.hpp +++ b/cpp/arcticdb/version/version_map_entry.hpp @@ -22,21 +22,21 @@ using namespace arcticdb::stream; enum class LoadType : uint32_t { NOT_LOADED = 0, - LOAD_LATEST, - LOAD_DOWNTO, - LOAD_FROM_TIME, - LOAD_ALL, + LATEST, + DOWNTO, + FROM_TIME, + ALL, UNKNOWN }; inline constexpr bool is_partial_load_type(LoadType load_type) { - return load_type == LoadType::LOAD_DOWNTO || load_type == LoadType::LOAD_FROM_TIME; + return load_type == LoadType::DOWNTO || load_type == LoadType::FROM_TIME; } // Used to specify whether we want to load all or only undeleted versions enum class LoadObjective : uint32_t { - ANY, - UNDELETED + INCLUDE_DELETED, + UNDELETED_ONLY }; enum class VersionStatus { @@ -61,10 +61,10 @@ struct LoadStrategy { LoadStrategy(LoadType load_type, LoadObjective load_objective, int64_t load_from_time_or_until) : load_type_(load_type), load_objective_(load_objective) { switch(load_type_) { - case LoadType::LOAD_FROM_TIME: + case LoadType::FROM_TIME: load_from_time_ = load_from_time_or_until; break; - case LoadType::LOAD_DOWNTO: + case LoadType::DOWNTO: load_until_version_ = load_from_time_or_until; break; default: @@ -74,15 +74,15 @@ struct LoadStrategy { } LoadType load_type_ = LoadType::NOT_LOADED; - LoadObjective load_objective_ = LoadObjective::ANY; + LoadObjective load_objective_ = LoadObjective::INCLUDE_DELETED; std::optional load_until_version_ = std::nullopt; std::optional load_from_time_ = std::nullopt; bool should_include_deleted() const { switch (load_objective_) { - case LoadObjective::ANY: + case LoadObjective::INCLUDE_DELETED: return true; - case LoadObjective::UNDELETED: + case LoadObjective::UNDELETED_ONLY: return false; default: util::raise_rte("Invalid load_objective: {}", load_objective_); @@ -90,9 +90,9 @@ struct LoadStrategy { } void validate() const { - internal::check((load_type_ == LoadType::LOAD_DOWNTO) == load_until_version_.has_value(), + internal::check((load_type_ == LoadType::DOWNTO) == load_until_version_.has_value(), "Invalid load parameter: load_type {} with load_util {}", int(load_type_), load_until_version_.value_or(VersionId{})); - internal::check((load_type_ == LoadType::LOAD_FROM_TIME) == load_from_time_.has_value(), + internal::check((load_type_ == LoadType::FROM_TIME) == load_from_time_.has_value(), "Invalid load parameter: load_type {} with load_from_time_ {}", int(load_type_), load_from_time_.value_or(timestamp{})); } }; @@ -102,28 +102,28 @@ inline bool is_undeleted_strategy_subset(const LoadStrategy& left, const LoadStr switch (left.load_type_) { case LoadType::NOT_LOADED: return true; - case LoadType::LOAD_LATEST: - // LOAD_LATEST is not a subset of LOAD_DOWNTO because LOAD_DOWNTO may not reach the latest undeleted version. - return right.load_type_ != LoadType::NOT_LOADED && right.load_type_ != LoadType::LOAD_DOWNTO; - case LoadType::LOAD_DOWNTO: - if (right.load_type_ == LoadType::LOAD_ALL) { + case LoadType::LATEST: + // LATEST is not a subset of DOWNTO because DOWNTO may not reach the latest undeleted version. + return right.load_type_ != LoadType::NOT_LOADED && right.load_type_ != LoadType::DOWNTO; + case LoadType::DOWNTO: + if (right.load_type_ == LoadType::ALL) { return true; } - if (right.load_type_ == LoadType::LOAD_DOWNTO && ((left.load_until_version_.value()>=0) == (right.load_until_version_.value()>=0))) { + if (right.load_type_ == LoadType::DOWNTO && ((left.load_until_version_.value() >= 0) == (right.load_until_version_.value() >= 0))) { // Left is subset of right only when the [load_until]s have same sign and left's version is >= right's version return left.load_until_version_.value() >= right.load_until_version_.value(); } break; - case LoadType::LOAD_FROM_TIME: - if (right.load_type_ == LoadType::LOAD_ALL){ + case LoadType::FROM_TIME: + if (right.load_type_ == LoadType::ALL){ return true; } - if (right.load_type_ == LoadType::LOAD_FROM_TIME){ + if (right.load_type_ == LoadType::FROM_TIME){ return left.load_from_time_.value() >= right.load_from_time_.value(); } break; - case LoadType::LOAD_ALL: - return right.load_type_ == LoadType::LOAD_ALL; + case LoadType::ALL: + return right.load_type_ == LoadType::ALL; default: util::raise_rte("Invalid load type: {}", left.load_type_); } @@ -142,11 +142,11 @@ inline LoadStrategy union_of_undeleted_strategies(const LoadStrategy& left, cons return left; } // If none is subset of the other, then we should load all versions. We can't be less conservative because we can't - // know where to load to with strategies which have a different load type. E.g. for LOAD_FROM_TIME and LOAD_DOWNTO + // know where to load to with strategies which have a different load type. E.g. for FROM_TIME and DOWNTO // we can't know where to read to unless we know the version chain. // A possible workaround for this is to restructure loading the version chain to get a set of LoadStrategies and stop // searching only when all of them are satisfied. - return LoadStrategy{LoadType::LOAD_ALL, LoadObjective::UNDELETED}; + return LoadStrategy{LoadType::ALL, LoadObjective::UNDELETED_ONLY}; } template @@ -212,8 +212,8 @@ struct VersionMapEntry { storage, where the head_ points to the latest version and keys_ are basically all the index/version keys loaded in memory in a deque - based on the load_strategy. - load_strategy signifies the current state of the in memory structure vs the state on disk, where LOAD_LATEST will - just load the latest version, and LOAD_ALL loads everything in memory by going through the linked list on disk. + load_strategy signifies the current state of the in memory structure vs the state on disk, where LATEST will + just load the latest version, and ALL loads everything in memory by going through the linked list on disk. It also contains a map of version_ids and the tombstone key corresponding to it iff it has been pruned or explicitly deleted. @@ -240,8 +240,8 @@ struct VersionMapEntry { tombstones_.clear(); tombstone_all_.reset(); keys_.clear(); - loaded_with_progress_ = LoadProgress{}; - load_strategy_ = LoadStrategy{LoadType::NOT_LOADED, LoadObjective::ANY}; + load_progress_ = LoadProgress{}; + load_strategy_ = LoadStrategy{LoadType::NOT_LOADED, LoadObjective::INCLUDE_DELETED}; } bool empty() const { @@ -259,7 +259,7 @@ struct VersionMapEntry { swap(left.tombstone_all_, right.tombstone_all_); swap(left.head_, right.head_); swap(left.load_strategy_, right.load_strategy_); - swap(left.loaded_with_progress_, right.loaded_with_progress_); + swap(left.load_progress_, right.load_progress_); } // Below four functions used to return optional of the tombstone, but copying keys is expensive and only @@ -432,9 +432,9 @@ struct VersionMapEntry { } std::optional head_; - LoadStrategy load_strategy_ = LoadStrategy{LoadType::NOT_LOADED, LoadObjective::ANY}; + LoadStrategy load_strategy_ = LoadStrategy{LoadType::NOT_LOADED, LoadObjective::INCLUDE_DELETED}; timestamp last_reload_time_ = 0; - LoadProgress loaded_with_progress_; + LoadProgress load_progress_; std::deque keys_; std::unordered_map tombstones_; std::optional tombstone_all_; @@ -524,12 +524,12 @@ namespace fmt { switch (l) { case arcticdb::LoadType::NOT_LOADED: return fmt::format_to(ctx.out(), "NOT_LOADED"); - case arcticdb::LoadType::LOAD_LATEST: - return fmt::format_to(ctx.out(), "LOAD_LATEST"); - case arcticdb::LoadType::LOAD_DOWNTO: - return fmt::format_to(ctx.out(), "LOAD_DOWNTO"); - case arcticdb::LoadType::LOAD_ALL: - return fmt::format_to(ctx.out(), "LOAD_ALL"); + case arcticdb::LoadType::LATEST: + return fmt::format_to(ctx.out(), "LATEST"); + case arcticdb::LoadType::DOWNTO: + return fmt::format_to(ctx.out(), "DOWNTO"); + case arcticdb::LoadType::ALL: + return fmt::format_to(ctx.out(), "ALL"); default: arcticdb::util::raise_rte("Unrecognized load type {}", int(l)); } @@ -544,10 +544,10 @@ namespace fmt { template auto format(arcticdb::LoadObjective l, FormatContext &ctx) const { switch (l) { - case arcticdb::LoadObjective::ANY: + case arcticdb::LoadObjective::INCLUDE_DELETED: return fmt::format_to(ctx.out(), "ANY"); - case arcticdb::LoadObjective::UNDELETED: - return fmt::format_to(ctx.out(), "UNDELETED"); + case arcticdb::LoadObjective::UNDELETED_ONLY: + return fmt::format_to(ctx.out(), "UNDELETED_ONLY"); default: arcticdb::util::raise_rte("Unrecognized to load {}", int(l)); } diff --git a/cpp/arcticdb/version/version_store_api.cpp b/cpp/arcticdb/version/version_store_api.cpp index 9800d8b2d58..8bea7db980a 100644 --- a/cpp/arcticdb/version/version_store_api.cpp +++ b/cpp/arcticdb/version/version_store_api.cpp @@ -944,7 +944,7 @@ void PythonVersionStore::prune_previous_versions(const StreamId& stream_id) { const std::shared_ptr& entry = version_map()->check_reload( store(), stream_id, - LoadStrategy{LoadType::LOAD_ALL, LoadObjective::UNDELETED}, + LoadStrategy{LoadType::ALL, LoadObjective::UNDELETED_ONLY}, __FUNCTION__); storage::check(!entry->empty(), "Symbol {} is not found", stream_id); auto [latest, deleted] = entry->get_first_index(false); diff --git a/cpp/arcticdb/version/version_store_objects.hpp b/cpp/arcticdb/version/version_store_objects.hpp index 2272861974f..2fb85534c5c 100644 --- a/cpp/arcticdb/version/version_store_objects.hpp +++ b/cpp/arcticdb/version/version_store_objects.hpp @@ -43,8 +43,8 @@ struct PreDeleteChecks { std::unordered_set could_share_data {}; LoadType calc_load_type() const { - if (prev_version) return LoadType::LOAD_ALL; - if (version_visible | next_version) return LoadType::LOAD_DOWNTO; + if (prev_version) return LoadType::ALL; + if (version_visible | next_version) return LoadType::DOWNTO; return LoadType::NOT_LOADED; } }; diff --git a/cpp/arcticdb/version/version_utils.hpp b/cpp/arcticdb/version/version_utils.hpp index db26c8d577c..c79cd479f49 100644 --- a/cpp/arcticdb/version/version_utils.hpp +++ b/cpp/arcticdb/version/version_utils.hpp @@ -190,7 +190,7 @@ inline void read_symbol_ref(const std::shared_ptr& store, const St LoadProgress load_progress; entry.head_ = read_segment_with_keys(key_seg_pair.second, entry, load_progress); - entry.loaded_with_progress_ = load_progress; + entry.load_progress_ = load_progress; } inline void write_symbol_ref(std::shared_ptr store, @@ -292,7 +292,7 @@ inline bool continue_when_loading_from_time(const LoadStrategy &load_strategy, c } inline bool continue_when_loading_latest(const LoadStrategy& load_strategy, const std::shared_ptr &entry) { - if (!(load_strategy.load_type_ == LoadType::LOAD_LATEST && entry->get_first_index(load_strategy.should_include_deleted()).first)) + if (!(load_strategy.load_type_ == LoadType::LATEST && entry->get_first_index(load_strategy.should_include_deleted()).first)) return true; ARCTICDB_DEBUG(log::version(), "Exiting because we found the latest version with include_deleted: {}", load_strategy.should_include_deleted()); @@ -333,16 +333,16 @@ inline bool penultimate_key_contains_required_version_id(const AtomKey& key, con } inline bool key_exists_in_ref_entry(const LoadStrategy& load_strategy, const VersionMapEntry& ref_entry, std::optional& cached_penultimate_key) { - if (load_strategy.load_type_ == LoadType::LOAD_LATEST && is_index_key_type(ref_entry.keys_[0].type())) + if (load_strategy.load_type_ == LoadType::LATEST && is_index_key_type(ref_entry.keys_[0].type())) return true; if(cached_penultimate_key && is_partial_load_type(load_strategy.load_type_)) { load_strategy.validate(); - if(load_strategy.load_type_ == LoadType::LOAD_DOWNTO && penultimate_key_contains_required_version_id(*cached_penultimate_key, load_strategy)) { + if(load_strategy.load_type_ == LoadType::DOWNTO && penultimate_key_contains_required_version_id(*cached_penultimate_key, load_strategy)) { return true; } - if(load_strategy.load_type_ == LoadType::LOAD_FROM_TIME && cached_penultimate_key->creation_ts() <= load_strategy.load_from_time_.value()) { + if(load_strategy.load_type_ == LoadType::FROM_TIME && cached_penultimate_key->creation_ts() <= load_strategy.load_from_time_.value()) { return true; } }