Skip to content

Commit

Permalink
Fix issue #9: HA_ERR_INTERNAL_ERROR when running linkbench
Browse files Browse the repository at this point in the history
Char length is stored as an unsigned n-byte value. Attempt to read
it as signed could cause read errors.
  • Loading branch information
spetrunia authored and Herman Lee committed Sep 11, 2015
1 parent 06f994e commit e7a9950
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
17 changes: 17 additions & 0 deletions mysql-test/r/rocksdb.result
Original file line number Diff line number Diff line change
Expand Up @@ -819,10 +819,12 @@ ERROR 42S02: Unknown table 'test.t45'
#
show variables like 'rocksdb%';
Variable_name Value
rocksdb_block_cache_size 8388608
rocksdb_bulk_load OFF
rocksdb_bulk_load_size 1000
rocksdb_lock_wait_timeout 1
rocksdb_max_row_locks 1073741824
rocksdb_write_buffer_size 4194304
create table t47 (pk int primary key, col1 varchar(12)) engine=rocksdb;
insert into t47 values (1, 'row1');
insert into t47 values (2, 'row2');
Expand Down Expand Up @@ -1308,3 +1310,18 @@ ROCKSDB_BYTES_READ
ROCKSDB_NUMBER_KEYS_WRITTEN
ROCKSDB_NUMBER_KEYS_READ
ROCKSDB_NUMBER_KEYS_UPDATED
#
# Fix issue #9: HA_ERR_INTERNAL_ERROR when running linkbench
#
create table t0 (a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1 (
pk int primary key,
col1 varchar(255),
key(col1)
) engine=rocksdb;
insert into t1 select a, repeat('123456789ABCDEF-', 15) from t0;
select * from t1 where pk=3;
pk col1
3 123456789ABCDEF-123456789ABCDEF-123456789ABCDEF-123456789ABCDEF-123456789ABCDEF-123456789ABCDEF-123456789ABCDEF-123456789ABCDEF-123456789ABCDEF-123456789ABCDEF-123456789ABCDEF-123456789ABCDEF-123456789ABCDEF-123456789ABCDEF-123456789ABCDEF-
drop table t0, t1;
15 changes: 15 additions & 0 deletions mysql-test/t/rocksdb.test
Original file line number Diff line number Diff line change
Expand Up @@ -1150,3 +1150,18 @@ select VARIABLE_NAME from INFORMATION_SCHEMA.global_status where VARIABLE_NAME L
--echo # but they are shown as both session and global, like InnoDB's status vars.
select VARIABLE_NAME from INFORMATION_SCHEMA.session_status where VARIABLE_NAME LIKE 'rocksdb%';


--echo #
--echo # Fix issue #9: HA_ERR_INTERNAL_ERROR when running linkbench
--echo #
create table t0 (a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);

create table t1 (
pk int primary key,
col1 varchar(255),
key(col1)
) engine=rocksdb;
insert into t1 select a, repeat('123456789ABCDEF-', 15) from t0;
select * from t1 where pk=3;
drop table t0, t1;
2 changes: 1 addition & 1 deletion storage/rocksdb/ha_rocksdb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,7 @@ int ha_rocksdb::convert_record_from_storage_format(uchar * buf)
/* field_var->length_bytes is 1 or 2 */
if (field_var->length_bytes == 1)
{
data_len= data_len_str[0];
data_len= (uchar)data_len_str[0];
}
else
{
Expand Down

0 comments on commit e7a9950

Please sign in to comment.