Commit e64b6211 authored by Rich Prohaska's avatar Rich Prohaska

DB-771 fix incorrect assert in update callback for varchar expansion

parent 3f3e058f
set default_storage_engine=tokudb;
drop table if exists t1;
CREATE TABLE t1 (a int key, b varchar(32), c varchar(32));
REPLACE t1 SET a = 4;
ALTER TABLE t1 CHANGE COLUMN c c VARCHAR(500);
update t1 set b='hi';
update t1 set c='there';
select * from t1;
a b c
4 hi there
drop table t1;
# test case for DB-771
source include/have_tokudb.inc;
set default_storage_engine=tokudb;
disable_warnings;
drop table if exists t1;
enable_warnings;
CREATE TABLE t1 (a int key, b varchar(32), c varchar(32));
REPLACE t1 SET a = 4;
ALTER TABLE t1 CHANGE COLUMN c c VARCHAR(500);
update t1 set b='hi';
update t1 set c='there';
select * from t1;
drop table t1;
......@@ -6,6 +6,7 @@ Table Create Table
t CREATE TABLE `t` (
`a` varchar(1) DEFAULT NULL
) ENGINE=TokuDB DEFAULT CHARSET=latin1
INSERT INTO t VALUES (null);
ALTER TABLE t CHANGE COLUMN a a VARCHAR(2);
ALTER TABLE t CHANGE COLUMN a a VARCHAR(2);
ALTER TABLE t CHANGE COLUMN a a VARCHAR(3);
......
......@@ -9,6 +9,7 @@ SET SESSION TOKUDB_DISABLE_SLOW_ALTER=ON;
CREATE TABLE t (a VARCHAR(1)) ENGINE=TokuDB;
SHOW CREATE TABLE t;
INSERT INTO t VALUES (null);
# 1->1
let $i=1
......
......@@ -851,7 +851,7 @@ static int tokudb_expand_variable_offsets(
DBT new_val; memset(&new_val, 0, sizeof new_val);
if (old_val != NULL) {
assert(offset_start + number_of_offsets < old_val->size);
assert(offset_start + number_of_offsets <= old_val->size);
// compute the new val from the old val
uchar *old_val_ptr = (uchar *)old_val->data;
......
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