You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kvrocks.apache.org by hu...@apache.org on 2022/09/01 04:16:08 UTC

[incubator-kvrocks] branch unstable updated: Fix transforming stream entry values to lowercase (#802)

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/incubator-kvrocks.git


The following commit(s) were added to refs/heads/unstable by this push:
     new 40989fc  Fix transforming stream entry values to lowercase (#802)
40989fc is described below

commit 40989fc26dc4229bd9f797c14eaa4df07574f47e
Author: Yaroslav <to...@gmail.com>
AuthorDate: Thu Sep 1 07:16:01 2022 +0300

    Fix transforming stream entry values to lowercase (#802)
---
 src/redis_cmd.cc                     | 2 +-
 tests/tcl/tests/unit/type/stream.tcl | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/redis_cmd.cc b/src/redis_cmd.cc
index ba11d20..52c381d 100644
--- a/src/redis_cmd.cc
+++ b/src/redis_cmd.cc
@@ -4793,7 +4793,7 @@ class CommandXAdd : public Commander {
     stream_name_ = args[1];
 
     for (size_t i = 2; i < args.size(); ) {
-      auto val = Util::ToLower(args[i]);
+      auto val = entry_id_found ? args[i] : Util::ToLower(args[i]);
 
       if (val == "nomkstream" && !entry_id_found) {
         nomkstream_ = true;
diff --git a/tests/tcl/tests/unit/type/stream.tcl b/tests/tcl/tests/unit/type/stream.tcl
index 48b02ce..ec6db5f 100644
--- a/tests/tcl/tests/unit/type/stream.tcl
+++ b/tests/tcl/tests/unit/type/stream.tcl
@@ -90,6 +90,15 @@ start_server {
         assert_equal [lindex $items 1 1] {item 2 value b}
     }
 
+    test {XADD stores entry value with respect to case sensitivity } {
+        r XADD myStream * iTeM 1 vAluE a
+        r XADD myStream * ItEm 2 VaLUe B
+        assert_equal 2 [r XLEN myStream]
+        set items [r XRANGE myStream - +]
+        assert_equal [lindex $items 0 1] {iTeM 1 vAluE a}
+        assert_equal [lindex $items 1 1] {ItEm 2 VaLUe B}
+    }
+
     test {XADD IDs are incremental} {
         set id1 [r XADD mystream * item 1 value a]
         set id2 [r XADD mystream * item 2 value b]