This is an automated email from the ASF dual-hosted git repository.
hulk pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/kvrocks.git
The following commit(s) were added to refs/heads/unstable by this push:
new 82cc0a24 Return an error when Stream::Range fails and remove some
debug server logs (#1556)
82cc0a24 is described below
commit 82cc0a242e51fb41871429517ff8c363b6c1d844
Author: Binbin <[email protected]>
AuthorDate: Tue Jul 18 12:08:11 2023 +0800
Return an error when Stream::Range fails and remove some debug server logs
(#1556)
This PR has two parts.
The first one, internally, both XREAD and XRANGE call the Stream::Range
function. When Range fails, we should return an error.
The second one is to remove the debug logs. These logs were there in the
earliest days, I guess they are for debugging, remove them now to avoid
polluting
the server logs.
The blpop one is easy to reproduce:
```
Failed to execute redis command: blpop, err: Invalid argument: WRONGTYPE
Operation against a key holding the wrong kind of value
```
---
src/cluster/replication.cc | 2 +-
src/commands/cmd_list.cc | 2 --
src/commands/cmd_stream.cc | 7 +++----
3 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/src/cluster/replication.cc b/src/cluster/replication.cc
index f5c3550a..39a2ade7 100644
--- a/src/cluster/replication.cc
+++ b/src/cluster/replication.cc
@@ -116,7 +116,7 @@ void FeedSlaveThread::loop() {
auto batch = iter_->GetBatch();
if (batch.sequence != curr_seq) {
LOG(ERROR) << "Fatal error encountered, WAL iterator is discrete, some
seq might be lost"
- << ", sequence " << curr_seq << " expectd, but got " <<
batch.sequence;
+ << ", sequence " << curr_seq << " expected, but got " <<
batch.sequence;
Stop();
return;
}
diff --git a/src/commands/cmd_list.cc b/src/commands/cmd_list.cc
index b428dda1..fd025ce5 100644
--- a/src/commands/cmd_list.cc
+++ b/src/commands/cmd_list.cc
@@ -234,8 +234,6 @@ class CommandBPop : public Commander,
}
} else if (!s.IsNotFound()) {
conn_->Reply(redis::Error("ERR " + s.ToString()));
- LOG(ERROR) << "Failed to execute redis command: " <<
conn_->current_cmd->GetAttributes()->name
- << ", err: " << s.ToString();
}
return s;
diff --git a/src/commands/cmd_stream.cc b/src/commands/cmd_stream.cc
index 9816548f..de9f7297 100644
--- a/src/commands/cmd_stream.cc
+++ b/src/commands/cmd_stream.cc
@@ -740,10 +740,9 @@ class CommandXRead : public Commander,
std::vector<StreamEntry> result;
auto s = stream_db.Range(streams_[i], options, &result);
- if (!s.ok()) {
- conn_->Reply(redis::MultiLen(-1));
- LOG(ERROR) << "ERR executing XRANGE for stream " << streams_[i] << "
from " << ids_[i].ToString() << " to "
- << options.end.ToString() << " with count " << count_ << ":
" << s.ToString();
+ if (!s.ok() && !s.IsNotFound()) {
+ conn_->Reply(redis::Error("ERR " + s.ToString()));
+ return;
}
if (result.size() > 0) {