Commit 62eee934 authored by unknown's avatar unknown

Apply to XtraDB MySQL/build-in innodb patches for Bug#49032 and Bug#47720.

parent ea328df5
......@@ -2,6 +2,8 @@
# embedded server ignores 'delayed', so skip this
-- source include/not_embedded.inc
let $file_format_check=`select @@innodb_file_format_check`;
--disable_warnings
drop table if exists t1;
--enable_warnings
......@@ -655,3 +657,7 @@ REPLACE INTO t1 VALUES (-1);
SELECT * FROM t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
--disable_query_log
EVAL SET GLOBAL innodb_file_format_check=$file_format_check;
--enable_query_log
......@@ -4742,9 +4742,11 @@ no_commit:
update the table upper limit. Note: last_value
will be 0 if get_auto_increment() was not called.*/
if (auto_inc <= col_max_value
&& auto_inc >= prebuilt->autoinc_last_value) {
if (auto_inc >= prebuilt->autoinc_last_value) {
set_max_autoinc:
/* This should filter out the negative
values set explicitly by the user. */
if (auto_inc <= col_max_value) {
ut_a(prebuilt->autoinc_increment > 0);
ulonglong need;
......@@ -4754,14 +4756,17 @@ set_max_autoinc:
need = prebuilt->autoinc_increment;
auto_inc = innobase_next_autoinc(
auto_inc, need, offset, col_max_value);
auto_inc,
need, offset, col_max_value);
err = innobase_set_max_autoinc(auto_inc);
err = innobase_set_max_autoinc(
auto_inc);
if (err != DB_SUCCESS) {
error = err;
}
}
}
break;
}
}
......
......@@ -4616,6 +4616,7 @@ row_search_autoinc_read_column(
dict_index_t* index, /*!< in: index to read from */
const rec_t* rec, /*!< in: current rec */
ulint col_no, /*!< in: column number */
ulint mtype, /*!< in: column main type */
ibool unsigned_type) /*!< in: signed or unsigned flag */
{
ulint len;
......@@ -4632,10 +4633,27 @@ row_search_autoinc_read_column(
data = rec_get_nth_field(rec, offsets, col_no, &len);
ut_a(len != UNIV_SQL_NULL);
ut_a(len <= sizeof value);
/* we assume AUTOINC value cannot be negative */
switch (mtype) {
case DATA_INT:
ut_a(len <= sizeof value);
value = mach_read_int_type(data, len, unsigned_type);
break;
case DATA_FLOAT:
ut_a(len == sizeof(float));
value = mach_float_read(data);
break;
case DATA_DOUBLE:
ut_a(len == sizeof(double));
value = mach_double_read(data);
break;
default:
ut_error;
}
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
......@@ -4721,7 +4739,8 @@ row_search_max_autoinc(
dfield->col->prtype & DATA_UNSIGNED);
*value = row_search_autoinc_read_column(
index, rec, i, unsigned_type);
index, rec, i,
dfield->col->mtype, unsigned_type);
}
}
......
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