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