Commit 35acf39b authored by Varun Gupta's avatar Varun Gupta

MDEV-21831: Assertion `length == pack_length()' failed in...

MDEV-21831: Assertion `length == pack_length()' failed in Field_inet6::sort_string upon INSERT into RocksDB table

For INET6 columns the values are stored as BINARY columns and returned to the client in TEXT format.
For rocksdb the indexes store mem-comparable images for columns, so use the pack_length() to store
the mem-comparable form for INET6 columns. This would also remain consistent with CHAR columns.
parent 757e756d
......@@ -2633,4 +2633,11 @@ DELETE t2, t1 FROM t2 LEFT JOIN t1 ON t2.id2 = t1.id2 AND t2.id1 = t1.id1 WHERE
SET rocksdb_bulk_load_size= @save_rocksdb_bulk_load_size;
SET rocksdb_commit_in_the_middle=0;
DROP TABLE t1, t2;
#
# MDEV-21831: Assertion `length == pack_length()' failed in Field_inet6::sort_string upon
# INSERT into RocksDB table
#
CREATE TABLE t1 (a INET6 NOT NULL, KEY (a)) ENGINE=RocksDB;
INSERT INTO t1 VALUES ('41::1'),('61::1');
DROP TABLE t1;
SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = @ORIG_PAUSE_BACKGROUND_WORK;
......@@ -1962,5 +1962,13 @@ SET rocksdb_bulk_load_size= @save_rocksdb_bulk_load_size;
SET rocksdb_commit_in_the_middle=0;
DROP TABLE t1, t2;
--echo #
--echo # MDEV-21831: Assertion `length == pack_length()' failed in Field_inet6::sort_string upon
--echo # INSERT into RocksDB table
--echo #
CREATE TABLE t1 (a INET6 NOT NULL, KEY (a)) ENGINE=RocksDB;
INSERT INTO t1 VALUES ('41::1'),('61::1');
DROP TABLE t1;
SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = @ORIG_PAUSE_BACKGROUND_WORK;
......@@ -3317,7 +3317,9 @@ bool Rdb_field_packing::setup(const Rdb_key_def *const key_descr,
field->field_length = field->char_length() * cs->mbmaxlen.
*/
const CHARSET_INFO *cs = field->charset();
m_max_image_len = cs->strnxfrmlen(field->field_length);
m_max_image_len = cs->strnxfrmlen(type == MYSQL_TYPE_STRING ?
field->pack_length() :
field->field_length);
}
const bool is_varchar = (type == MYSQL_TYPE_VARCHAR);
const CHARSET_INFO *cs = field->charset();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment