Skip to content

Commit 35acf39

Browse files
author
Varun Gupta
committed
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.
1 parent 757e756 commit 35acf39

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

storage/rocksdb/mysql-test/rocksdb/r/rocksdb.result

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2633,4 +2633,11 @@ DELETE t2, t1 FROM t2 LEFT JOIN t1 ON t2.id2 = t1.id2 AND t2.id1 = t1.id1 WHERE
26332633
SET rocksdb_bulk_load_size= @save_rocksdb_bulk_load_size;
26342634
SET rocksdb_commit_in_the_middle=0;
26352635
DROP TABLE t1, t2;
2636+
#
2637+
# MDEV-21831: Assertion `length == pack_length()' failed in Field_inet6::sort_string upon
2638+
# INSERT into RocksDB table
2639+
#
2640+
CREATE TABLE t1 (a INET6 NOT NULL, KEY (a)) ENGINE=RocksDB;
2641+
INSERT INTO t1 VALUES ('41::1'),('61::1');
2642+
DROP TABLE t1;
26362643
SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = @ORIG_PAUSE_BACKGROUND_WORK;

storage/rocksdb/mysql-test/rocksdb/t/rocksdb.test

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1962,5 +1962,13 @@ SET rocksdb_bulk_load_size= @save_rocksdb_bulk_load_size;
19621962
SET rocksdb_commit_in_the_middle=0;
19631963
DROP TABLE t1, t2;
19641964

1965+
--echo #
1966+
--echo # MDEV-21831: Assertion `length == pack_length()' failed in Field_inet6::sort_string upon
1967+
--echo # INSERT into RocksDB table
1968+
--echo #
1969+
1970+
CREATE TABLE t1 (a INET6 NOT NULL, KEY (a)) ENGINE=RocksDB;
1971+
INSERT INTO t1 VALUES ('41::1'),('61::1');
1972+
DROP TABLE t1;
19651973

19661974
SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = @ORIG_PAUSE_BACKGROUND_WORK;

storage/rocksdb/rdb_datadic.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3317,7 +3317,9 @@ bool Rdb_field_packing::setup(const Rdb_key_def *const key_descr,
33173317
field->field_length = field->char_length() * cs->mbmaxlen.
33183318
*/
33193319
const CHARSET_INFO *cs = field->charset();
3320-
m_max_image_len = cs->strnxfrmlen(field->field_length);
3320+
m_max_image_len = cs->strnxfrmlen(type == MYSQL_TYPE_STRING ?
3321+
field->pack_length() :
3322+
field->field_length);
33213323
}
33223324
const bool is_varchar = (type == MYSQL_TYPE_VARCHAR);
33233325
const CHARSET_INFO *cs = field->charset();

0 commit comments

Comments
 (0)