Skip to content

Commit

Permalink
MDEV-21831: Assertion `length == pack_length()' failed in Field_inet6…
Browse files Browse the repository at this point in the history
…::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.
  • Loading branch information
Varun Gupta committed Jun 11, 2020
1 parent 757e756 commit 35acf39
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
7 changes: 7 additions & 0 deletions storage/rocksdb/mysql-test/rocksdb/r/rocksdb.result
Original file line number Diff line number Diff line change
Expand Up @@ -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;
8 changes: 8 additions & 0 deletions storage/rocksdb/mysql-test/rocksdb/t/rocksdb.test
Original file line number Diff line number Diff line change
Expand Up @@ -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;
4 changes: 3 additions & 1 deletion storage/rocksdb/rdb_datadic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 35acf39

Please sign in to comment.