Skip to content

Commit

Permalink
cleanup: clang-tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
umegane committed Oct 18, 2024
1 parent b1be94a commit 544b6ca
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions src/limestone/cursor_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,19 @@ void cursor_impl::validate_and_read_stream(std::optional<boost::filesystem::ifst
stream = std::nullopt;
log_entry = std::nullopt;
return;
} else {
// Check if the key_sid is in ascending order
// TODO: Key order violation is detected here and the process is aborted.
// However, this check should be moved to an earlier point, and if the key order is invalid,
// a different processing method should be considered instead of aborting immediately.
if (!previous_key_sid.empty() && log_entry->key_sid() < previous_key_sid) {
LOG(ERROR) << "Key order violation in " << stream_name << ": current key_sid (" << log_entry->key_sid()
<< ") is smaller than the previous key_sid (" << previous_key_sid << ")";
THROW_LIMESTONE_EXCEPTION("Key order violation detected in " + stream_name);
}

// Update the previous key_sid to the current one
previous_key_sid = log_entry->key_sid();
}
// Check if the key_sid is in ascending order
// TODO: Key order violation is detected here and the process is aborted.
// However, this check should be moved to an earlier point, and if the key order is invalid,
// a different processing method should be considered instead of aborting immediately.
if (!previous_key_sid.empty() && log_entry->key_sid() < previous_key_sid) {
LOG(ERROR) << "Key order violation in " << stream_name << ": current key_sid (" << log_entry->key_sid()
<< ") is smaller than the previous key_sid (" << previous_key_sid << ")";
THROW_LIMESTONE_EXCEPTION("Key order violation detected in " + stream_name);
}

// Update the previous key_sid to the current one
previous_key_sid = log_entry->key_sid();
}

// Check the validity of the entry using the lambda function
Expand Down

0 comments on commit 544b6ca

Please sign in to comment.