Commit e9589315 authored by marko's avatar marko

branches/zip: Merge 2015:2093 from trunk.

parent 5cbf4e38
...@@ -85,16 +85,6 @@ innobase_convert_from_id( ...@@ -85,16 +85,6 @@ innobase_convert_from_id(
ulint len); /* in: length of 'to', in bytes; ulint len); /* in: length of 'to', in bytes;
should be at least 3 * strlen(to) + 1 */ should be at least 3 * strlen(to) + 1 */
/********************************************************************** /**********************************************************************
Removes the filename encoding of a table or database name.
NOTE: the prototype of this function is copied from ha_innodb.cc! If you change
this function, you MUST change also the prototype here! */
extern
void
innobase_convert_from_filename(
/*===========================*/
char* s); /* in: identifier; out: decoded identifier */
/**********************************************************************
Compares NUL-terminated UTF-8 strings case insensitively. Compares NUL-terminated UTF-8 strings case insensitively.
NOTE: the prototype of this function is copied from ha_innodb.cc! If you change NOTE: the prototype of this function is copied from ha_innodb.cc! If you change
......
...@@ -691,6 +691,8 @@ convert_error_code_to_mysql( ...@@ -691,6 +691,8 @@ convert_error_code_to_mysql(
#else #else
return(HA_ERR_RECORD_FILE_FULL); return(HA_ERR_RECORD_FILE_FULL);
#endif #endif
case DB_UNSUPPORTED:
return(HA_ERR_UNSUPPORTED);
} }
} }
...@@ -807,23 +809,6 @@ innobase_convert_from_id( ...@@ -807,23 +809,6 @@ innobase_convert_from_id(
system_charset_info, to, (uint) len, &errors); system_charset_info, to, (uint) len, &errors);
} }
/**********************************************************************
Removes the filename encoding of a table or database name.
NOTE that the exact prototype of this function has to be in
/innobase/dict/dict0dict.c! */
extern "C"
void
innobase_convert_from_filename(
/*===========================*/
char* s) /* in: identifier; out: decoded identifier */
{
uint errors;
strconvert(&my_charset_filename, s,
system_charset_info, s, strlen(s), &errors);
}
/********************************************************************** /**********************************************************************
Compares NUL-terminated UTF-8 strings case insensitively. Compares NUL-terminated UTF-8 strings case insensitively.
...@@ -1162,7 +1147,6 @@ innobase_query_caching_of_table_permitted( ...@@ -1162,7 +1147,6 @@ innobase_query_caching_of_table_permitted(
} }
if (trx->has_search_latch) { if (trx->has_search_latch) {
ut_print_timestamp(stderr);
sql_print_error("The calling thread is holding the adaptive " sql_print_error("The calling thread is holding the adaptive "
"search, latch though calling " "search, latch though calling "
"innobase_query_caching_of_table_permitted."); "innobase_query_caching_of_table_permitted.");
...@@ -2370,7 +2354,6 @@ ha_innobase::open( ...@@ -2370,7 +2354,6 @@ ha_innobase::open(
ib_table = dict_table_get(norm_name, TRUE); ib_table = dict_table_get(norm_name, TRUE);
if (NULL == ib_table) { if (NULL == ib_table) {
ut_print_timestamp(stderr);
sql_print_error("Cannot find or open table %s from\n" sql_print_error("Cannot find or open table %s from\n"
"the internal data dictionary of InnoDB " "the internal data dictionary of InnoDB "
"though the .frm file for the\n" "though the .frm file for the\n"
...@@ -2394,7 +2377,6 @@ ha_innobase::open( ...@@ -2394,7 +2377,6 @@ ha_innobase::open(
} }
if (ib_table->ibd_file_missing && !thd_tablespace_op(thd)) { if (ib_table->ibd_file_missing && !thd_tablespace_op(thd)) {
ut_print_timestamp(stderr);
sql_print_error("MySQL is trying to open a table handle but " sql_print_error("MySQL is trying to open a table handle but "
"the .ibd file for\ntable %s does not exist.\n" "the .ibd file for\ntable %s does not exist.\n"
"Have you deleted the .ibd file from the " "Have you deleted the .ibd file from the "
...@@ -3472,7 +3454,7 @@ no_commit: ...@@ -3472,7 +3454,7 @@ no_commit:
/* /*
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB error: ALTER TABLE is holding lock" " InnoDB: ALTER TABLE is holding lock"
" on %lu tables!\n", " on %lu tables!\n",
prebuilt->trx->mysql_n_tables_locked); prebuilt->trx->mysql_n_tables_locked);
*/ */
...@@ -4042,15 +4024,23 @@ convert_search_mode_to_innobase( ...@@ -4042,15 +4024,23 @@ convert_search_mode_to_innobase(
enum ha_rkey_function find_flag) enum ha_rkey_function find_flag)
{ {
switch (find_flag) { switch (find_flag) {
case HA_READ_KEY_EXACT: return(PAGE_CUR_GE); case HA_READ_KEY_EXACT:
/* the above does not require the index to be UNIQUE */ /* this does not require the index to be UNIQUE */
case HA_READ_KEY_OR_NEXT: return(PAGE_CUR_GE); return(PAGE_CUR_GE);
case HA_READ_KEY_OR_PREV: return(PAGE_CUR_LE); case HA_READ_KEY_OR_NEXT:
case HA_READ_AFTER_KEY: return(PAGE_CUR_G); return(PAGE_CUR_GE);
case HA_READ_BEFORE_KEY: return(PAGE_CUR_L); case HA_READ_KEY_OR_PREV:
case HA_READ_PREFIX: return(PAGE_CUR_GE); return(PAGE_CUR_LE);
case HA_READ_PREFIX_LAST: return(PAGE_CUR_LE); case HA_READ_AFTER_KEY:
case HA_READ_PREFIX_LAST_OR_PREV:return(PAGE_CUR_LE); return(PAGE_CUR_G);
case HA_READ_BEFORE_KEY:
return(PAGE_CUR_L);
case HA_READ_PREFIX:
return(PAGE_CUR_GE);
case HA_READ_PREFIX_LAST:
return(PAGE_CUR_LE);
case HA_READ_PREFIX_LAST_OR_PREV:
return(PAGE_CUR_LE);
/* In MySQL-4.0 HA_READ_PREFIX and HA_READ_PREFIX_LAST always /* In MySQL-4.0 HA_READ_PREFIX and HA_READ_PREFIX_LAST always
pass a complete-field prefix of a key value as the search pass a complete-field prefix of a key value as the search
tuple. I.e., it is not allowed that the last field would tuple. I.e., it is not allowed that the last field would
...@@ -4064,11 +4054,21 @@ convert_search_mode_to_innobase( ...@@ -4064,11 +4054,21 @@ convert_search_mode_to_innobase(
and comparison of non-latin1 char type fields in and comparison of non-latin1 char type fields in
innobase_mysql_cmp() to get PAGE_CUR_LE_OR_EXTENDS to innobase_mysql_cmp() to get PAGE_CUR_LE_OR_EXTENDS to
work correctly. */ work correctly. */
case HA_READ_MBR_CONTAIN:
default: ut_error; case HA_READ_MBR_INTERSECT:
case HA_READ_MBR_WITHIN:
case HA_READ_MBR_DISJOINT:
case HA_READ_MBR_EQUAL:
my_error(ER_TABLE_CANT_HANDLE_SPKEYS, MYF(0));
return(PAGE_CUR_UNSUPP);
/* do not use "default:" in order to produce a gcc warning:
enumeration value '...' not handled in switch
(if -Wswitch or -Wall is used) */
} }
return(0); my_error(ER_CHECK_NOT_IMPLEMENTED, MYF(0), "this functionality");
return(PAGE_CUR_UNSUPP);
} }
/* /*
...@@ -4199,11 +4199,18 @@ ha_innobase::index_read( ...@@ -4199,11 +4199,18 @@ ha_innobase::index_read(
last_match_mode = (uint) match_mode; last_match_mode = (uint) match_mode;
if (mode != PAGE_CUR_UNSUPP) {
innodb_srv_conc_enter_innodb(prebuilt->trx); innodb_srv_conc_enter_innodb(prebuilt->trx);
ret = row_search_for_mysql((byte*) buf, mode, prebuilt, match_mode, 0); ret = row_search_for_mysql((byte*) buf, mode, prebuilt,
match_mode, 0);
innodb_srv_conc_exit_innodb(prebuilt->trx); innodb_srv_conc_exit_innodb(prebuilt->trx);
} else {
ret = DB_UNSUPPORTED;
}
if (ret == DB_SUCCESS) { if (ret == DB_SUCCESS) {
error = 0; error = 0;
...@@ -5614,8 +5621,16 @@ ha_innobase::records_in_range( ...@@ -5614,8 +5621,16 @@ ha_innobase::records_in_range(
mode2 = convert_search_mode_to_innobase(max_key ? max_key->flag : mode2 = convert_search_mode_to_innobase(max_key ? max_key->flag :
HA_READ_KEY_EXACT); HA_READ_KEY_EXACT);
if (mode1 != PAGE_CUR_UNSUPP && mode2 != PAGE_CUR_UNSUPP) {
n_rows = btr_estimate_n_rows_in_range(index, range_start, n_rows = btr_estimate_n_rows_in_range(index, range_start,
mode1, range_end, mode2); mode1, range_end,
mode2);
} else {
n_rows = 0;
}
mem_heap_free(heap); mem_heap_free(heap);
my_free(key_val_buff2, MYF(0)); my_free(key_val_buff2, MYF(0));
...@@ -5866,7 +5881,6 @@ ha_innobase::info( ...@@ -5866,7 +5881,6 @@ ha_innobase::info(
for (i = 0; i < table->s->keys; i++) { for (i = 0; i < table->s->keys; i++) {
if (index == NULL) { if (index == NULL) {
ut_print_timestamp(stderr);
sql_print_error("Table %s contains fewer " sql_print_error("Table %s contains fewer "
"indexes inside InnoDB than " "indexes inside InnoDB than "
"are defined in the MySQL " "are defined in the MySQL "
...@@ -5882,7 +5896,6 @@ ha_innobase::info( ...@@ -5882,7 +5896,6 @@ ha_innobase::info(
for (j = 0; j < table->key_info[i].key_parts; j++) { for (j = 0; j < table->key_info[i].key_parts; j++) {
if (j + 1 > index->n_uniq) { if (j + 1 > index->n_uniq) {
ut_print_timestamp(stderr);
sql_print_error( sql_print_error(
"Index %s of %s has %lu columns unique inside InnoDB, but MySQL is asking " "Index %s of %s has %lu columns unique inside InnoDB, but MySQL is asking "
"statistics for %lu columns. Have you mixed up .frm files from different " "statistics for %lu columns. Have you mixed up .frm files from different "
...@@ -5955,7 +5968,6 @@ ha_innobase::info( ...@@ -5955,7 +5968,6 @@ ha_innobase::info(
ret = innobase_read_and_init_auto_inc(&auto_inc); ret = innobase_read_and_init_auto_inc(&auto_inc);
if (ret != 0) { if (ret != 0) {
ut_print_timestamp(stderr);
sql_print_error("Cannot get table %s auto-inc" sql_print_error("Cannot get table %s auto-inc"
"counter value in ::info\n", "counter value in ::info\n",
ib_table->name); ib_table->name);
...@@ -6729,13 +6741,16 @@ ha_innobase::transactional_table_lock( ...@@ -6729,13 +6741,16 @@ ha_innobase::transactional_table_lock(
if (prebuilt->table->ibd_file_missing && !thd_tablespace_op(thd)) { if (prebuilt->table->ibd_file_missing && !thd_tablespace_op(thd)) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB error:\n" fprintf(stderr,
"MySQL is trying to use a table handle but the .ibd file for\n" " InnoDB: MySQL is trying to use a table handle"
"table %s does not exist.\n" " but the .ibd file for\n"
"Have you deleted the .ibd file from the database directory under\n" "InnoDB: table %s does not exist.\n"
"the MySQL datadir?" "InnoDB: Have you deleted the .ibd file"
"See http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n" " from the database directory under\n"
"how you can resolve the problem.\n", "InnoDB: the MySQL datadir?"
"InnoDB: See"
" http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n"
"InnoDB: how you can resolve the problem.\n",
prebuilt->table->name); prebuilt->table->name);
DBUG_RETURN(HA_ERR_CRASHED); DBUG_RETURN(HA_ERR_CRASHED);
} }
...@@ -7348,7 +7363,8 @@ ha_innobase::innobase_read_and_init_auto_inc( ...@@ -7348,7 +7363,8 @@ ha_innobase::innobase_read_and_init_auto_inc(
++auto_inc; ++auto_inc;
dict_table_autoinc_initialize(innodb_table, auto_inc); dict_table_autoinc_initialize(innodb_table, auto_inc);
} else { } else {
fprintf(stderr, " InnoDB error (%lu): Couldn't read " ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB: Error: (%lu) Couldn't read "
"the max AUTOINC value from the index (%s).\n", "the max AUTOINC value from the index (%s).\n",
error, index->name); error, index->name);
...@@ -7438,8 +7454,7 @@ ha_innobase::innobase_get_auto_increment( ...@@ -7438,8 +7454,7 @@ ha_innobase::innobase_get_auto_increment(
and can be ignored. */ and can be ignored. */
} else if (error != DB_DEADLOCK) { } else if (error != DB_DEADLOCK) {
ut_print_timestamp(stderr); sql_print_error("InnoDB: Error: %lu in "
sql_print_error(" InnoDB Error %lu in "
"::innobase_get_auto_increment()", "::innobase_get_auto_increment()",
error); error);
} }
......
...@@ -22,6 +22,7 @@ Created 10/4/1994 Heikki Tuuri ...@@ -22,6 +22,7 @@ Created 10/4/1994 Heikki Tuuri
/* Page cursor search modes; the values must be in this order! */ /* Page cursor search modes; the values must be in this order! */
#define PAGE_CUR_UNSUPP 0
#define PAGE_CUR_G 1 #define PAGE_CUR_G 1
#define PAGE_CUR_GE 2 #define PAGE_CUR_GE 2
#define PAGE_CUR_L 3 #define PAGE_CUR_L 3
......
...@@ -3223,6 +3223,22 @@ c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255), ...@@ -3223,6 +3223,22 @@ c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255),
c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255) c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255)
) ENGINE = InnoDB; ) ENGINE = InnoDB;
ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
DROP TABLE IF EXISTS t1;
Warnings:
Note 1051 Unknown table 't1'
CREATE TABLE t1(
id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY
) ENGINE=InnoDB;
INSERT INTO t1 VALUES(-10);
SELECT * FROM t1;
id
-10
INSERT INTO t1 VALUES(NULL);
SELECT * FROM t1;
id
-10
1
DROP TABLE t1;
SET TX_ISOLATION='read-committed'; SET TX_ISOLATION='read-committed';
SET AUTOCOMMIT=0; SET AUTOCOMMIT=0;
DROP TABLE IF EXISTS t1, t2; DROP TABLE IF EXISTS t1, t2;
......
...@@ -2368,6 +2368,25 @@ CREATE TABLE t1 ( ...@@ -2368,6 +2368,25 @@ CREATE TABLE t1 (
c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255) c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255)
) ENGINE = InnoDB; ) ENGINE = InnoDB;
#
# Bug #31860 InnoDB assumes AUTOINC values can only be positive.
#
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(
id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY
) ENGINE=InnoDB;
INSERT INTO t1 VALUES(-10);
SELECT * FROM t1;
#
# NOTE: The server really needs to be restarted at this point
# for the test to be useful.
#
# Without the fix InnoDB would trip over an assertion here.
INSERT INTO t1 VALUES(NULL);
# The next value should be 1 and not -9 or a -ve number
SELECT * FROM t1;
DROP TABLE t1;
# #
# Bug #21409 Incorrect result returned when in READ-COMMITTED with # Bug #21409 Incorrect result returned when in READ-COMMITTED with
# query_cache ON # query_cache ON
......
...@@ -4601,7 +4601,8 @@ row_search_check_if_query_cache_permitted( ...@@ -4601,7 +4601,8 @@ row_search_check_if_query_cache_permitted(
} }
/*********************************************************************** /***********************************************************************
Read the AUTOINC column from the current row. */ Read the AUTOINC column from the current row. If the value is less than
0 and the type is not unsigned then we reset the value to 0. */
static static
ib_longlong ib_longlong
row_search_autoinc_read_column( row_search_autoinc_read_column(
...@@ -4640,7 +4641,9 @@ row_search_autoinc_read_column( ...@@ -4640,7 +4641,9 @@ row_search_autoinc_read_column(
mem_heap_free(heap); mem_heap_free(heap);
} }
ut_a(value >= 0); if (!unsigned_type && value < 0) {
value = 0;
}
return(value); return(value);
} }
......
#!/bin/bash #!/bin/sh
# #
# Prepare the MySQL source code tree for building # Prepare the MySQL source code tree for building
# with checked-out InnoDB Subversion directory. # with checked-out InnoDB Subversion directory.
...@@ -10,7 +10,10 @@ set -eu ...@@ -10,7 +10,10 @@ set -eu
TARGETDIR=../storage/innobase TARGETDIR=../storage/innobase
# link the build scripts # link the build scripts
ln -sf $TARGETDIR/compile-innodb{,-debug} ../../BUILD BUILDSCRIPTS="compile-innodb compile-innodb-debug"
for script in $BUILDSCRIPTS ; do
ln -sf $TARGETDIR/$script ../../BUILD/
done
cd ../../mysql-test/t cd ../../mysql-test/t
ln -sf ../$TARGETDIR/mysql-test/*.test ../$TARGETDIR/mysql-test/*.opt . ln -sf ../$TARGETDIR/mysql-test/*.test ../$TARGETDIR/mysql-test/*.opt .
......
...@@ -806,7 +806,7 @@ sync_thread_levels_g( ...@@ -806,7 +806,7 @@ sync_thread_levels_g(
mutex = slot->latch; mutex = slot->latch;
fprintf(stderr, fprintf(stderr,
"InnoDB error: sync levels should be" "InnoDB: sync levels should be"
" > %lu but a level is %lu\n", " > %lu but a level is %lu\n",
(ulong) limit, (ulong) slot->level); (ulong) limit, (ulong) slot->level);
......
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