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

Better error message for non-increasing index. #1858

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion cpp/arcticdb/util/error_code.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ inline std::unordered_map<ErrorCategory, const char*> get_error_category_names()
ERROR_CODE(5021, E_S3_RETRYABLE) \
ERROR_CODE(5030, E_UNEXPECTED_AZURE_ERROR) \
ERROR_CODE(5050, E_MONGO_BULK_OP_NO_REPLY) \
ERROR_CODE(5051, E_UNEXPECTED_MONGO_ERROR) \
ERROR_CODE(5051, E_UNEXPECTED_MONGO_ERROR) \
ERROR_CODE(5090, E_PARALLEL_WRITES_TO_SYMBOL) \
ERROR_CODE(6000, E_UNSORTED_DATA) \
ERROR_CODE(7000, E_INVALID_USER_ARGUMENT) \
ERROR_CODE(7001, E_INVALID_DECIMAL_STRING) \
Expand Down
8 changes: 4 additions & 4 deletions cpp/arcticdb/version/test/test_version_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ TEST(VersionMap, FixRefKey) {
EXPECT_THROW({
// We should raise if we try to write a non-increasing index key
version_map->write_version(store, key4, key3);
}, InternalException);
}, StorageException);

store->remove_key_sync(RefKey{id, KeyType::VERSION_REF}, storage::RemoveOpts{});
ASSERT_FALSE(version_map->check_ref_key(store, id));
Expand Down Expand Up @@ -414,15 +414,15 @@ TEST(VersionMap, FixRefKeyTombstones) {
auto key2 = atom_key_with_version(id, 0, 1696590624387628801);
EXPECT_THROW({
version_map->write_version(store, key2, key1);
}, InternalException);
}, StorageException);
auto key3 = atom_key_with_version(id, 0, 1696590624532320286);
EXPECT_THROW({
version_map->write_version(store, key3, key2);
}, InternalException);
}, StorageException);
auto key4 = atom_key_with_version(id, 0, 1696590624554476875);
EXPECT_THROW({
version_map->write_version(store, key4, key3);
}, InternalException);
}, StorageException);
auto key5 = atom_key_with_version(id, 1, 1696590624590123209);
version_map->write_version(store, key5, key4);
auto entry = version_map->check_reload(store, id, LoadStrategy{LoadType::LATEST, LoadObjective::INCLUDE_DELETED}, __FUNCTION__);
Expand Down
4 changes: 2 additions & 2 deletions cpp/arcticdb/version/version_map.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,8 +507,8 @@ class VersionMapImpl {
if (validate_)
entry->validate();

util::check(key.type() != KeyType::TABLE_INDEX || !entry->head_.has_value() || key.version_id() > entry->head_->version_id(),
"Trying to write a non-increasing TABLE_INDEX key. New version: {}, Last version: {}",
storage::check<ErrorCode::E_PARALLEL_WRITES_TO_SYMBOL>(key.type() != KeyType::TABLE_INDEX || !entry->head_.has_value() || key.version_id() > entry->head_->version_id(),
"Trying to write a non-increasing TABLE_INDEX key. New version: {}, Last version: {}. This is most likely due to parallel writes to the same symbol, which is not supported.",
key.version_id(), entry->head_ ? entry->head_->version_id() : VariantId{""});
auto journal_key = to_atom(std::move(journal_single_key(store, key, entry->head_)));
write_to_entry(entry, key, journal_key);
Expand Down
Loading