Skip to content

Commit

Permalink
Fixing invalid shard index - bug
Browse files Browse the repository at this point in the history
  • Loading branch information
pratheep-kumar committed Oct 7, 2024
1 parent 69ece62 commit ebc76f6
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1311,7 +1311,13 @@ SplitRequestPtr ScanRequest::create(Router& router, Common::Redis::RespValuePtr&
if (cursor.length() > 4) {
std::string index = cursor.substr(cursor.length() - 4);
cursor = cursor.substr(0, cursor.length() - 4);
shard_idx = std::stoi(index);
try {
shard_idx = std::stoi(index);
} catch (const std::invalid_argument& e) {
ENVOY_LOG(error, "Invalid shard index: '{}'", e.what());
callbacks_.onResponse(Common::Redis::Utility::makeError(
fmt::format("unexpected or wrong shard index from cursor")));
}
}

// Completely reconstructing the request to add/modify count since we can't override the incoming array directly
Expand Down

0 comments on commit ebc76f6

Please sign in to comment.