Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion sql/field.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8539,7 +8539,9 @@ void Field_blob::sort_string(uchar *to,uint length)
Store length of blob last in blob to shorter blobs before longer blobs
*/
length-= packlength;
store_bigendian(buf.length(), to + length, packlength);

uint key_length = MY_MIN(buf.length(), length);
store_bigendian(key_length, to + length, packlength);
}

#ifndef DBUG_OFF
Expand Down
9 changes: 9 additions & 0 deletions storage/rocksdb/mysql-test/rocksdb_rpl/r/rpl_blob_key.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
include/master-slave.inc
[connection master]
CREATE TABLE t1 (b BLOB, i INT, KEY(b(8))) ENGINE=RocksDB;
INSERT INTO t1 VALUES (REPEAT('a',9),1);
UPDATE t1 SET i = 2;
connection slave;
connection master;
DROP TABLE t1;
include/rpl_end.inc
15 changes: 15 additions & 0 deletions storage/rocksdb/mysql-test/rocksdb_rpl/t/rpl_blob_key.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
--source include/have_rocksdb.inc
--source include/have_binlog_format_row.inc
--source include/master-slave.inc

CREATE TABLE t1 (b BLOB, i INT, KEY(b(8))) ENGINE=RocksDB;
INSERT INTO t1 VALUES (REPEAT('a',9),1);

UPDATE t1 SET i = 2;

--sync_slave_with_master

# Cleanup
--connection master
DROP TABLE t1;
--source include/rpl_end.inc