File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 1616#include < boost/container/flat_map.hpp>
1717
1818#include < boost/system/system_error.hpp>
19+ #include < boost/system/generic_category.hpp>
1920
2021#include " include/fs_types.h"
2122#include " include/neorados/RADOS.hpp"
@@ -1091,7 +1092,12 @@ asio::awaitable<std::tuple<std::vector<rgw_data_change_log_entry>,
10911092RGWDataChangesLog::list_entries (const DoutPrefixProvider* dpp, int shard,
10921093 int max_entries, std::string marker)
10931094{
1094- assert (shard < num_shards);
1095+ if (shard >= num_shards) [[unlikely]] {
1096+ throw sys::system_error{
1097+ EINVAL, sys::generic_category (),
1098+ fmt::format (" {} is not a valid shard. Valid shards are integers in [0, {})" ,
1099+ shard, num_shards)};
1100+ }
10951101 if (max_entries <= 0 ) {
10961102 co_return std::make_tuple (std::vector<rgw_data_change_log_entry>{},
10971103 std::string{});
@@ -1109,7 +1115,6 @@ int RGWDataChangesLog::list_entries(
11091115 std::string_view marker, std::string* out_marker, bool * truncated,
11101116 optional_yield y)
11111117{
1112- assert (shard < num_shards);
11131118 std::exception_ptr eptr;
11141119 std::tuple<std::span<rgw_data_change_log_entry>,
11151120 std::string> out;
You can’t perform that action at this time.
0 commit comments