summaryrefslogtreecommitdiff
path: root/innobase
diff options
context:
space:
mode:
authormonty@mysql.com <>2004-10-06 19:14:33 +0300
committermonty@mysql.com <>2004-10-06 19:14:33 +0300
commit62f3cd6a31d3c1ffe7ad17d9de862a3c0859f56a (patch)
tree4e2cfa6a6a8032773454e22aa802b2798b2935b8 /innobase
parent96458f8f64641d5b974a17733af8c709b513bfe0 (diff)
parent0944bed7fcb59fb38230a750bd820a22b3b6b476 (diff)
downloadmariadb-git-62f3cd6a31d3c1ffe7ad17d9de862a3c0859f56a.tar.gz
Merge with 4.0 for 4.1 release
Noteworthy: - New HANDLER code - New multi-update-grant-check code - Table lock code in ha_innodb.cc was not applied
Diffstat (limited to 'innobase')
-rw-r--r--innobase/btr/btr0btr.c4
-rw-r--r--innobase/buf/buf0buf.c6
-rw-r--r--innobase/dict/dict0dict.c41
-rw-r--r--innobase/fsp/fsp0fsp.c6
-rw-r--r--innobase/include/dict0dict.h6
-rw-r--r--innobase/include/row0mysql.h8
-rw-r--r--innobase/log/log0log.c5
-rw-r--r--innobase/log/log0recv.c6
-rw-r--r--innobase/os/os0file.c44
-rw-r--r--innobase/pars/pars0opt.c13
-rw-r--r--innobase/row/row0mysql.c26
-rw-r--r--innobase/row/row0row.c34
-rw-r--r--innobase/sync/sync0arr.c5
-rw-r--r--innobase/ut/ut0dbg.c5
14 files changed, 151 insertions, 58 deletions
diff --git a/innobase/btr/btr0btr.c b/innobase/btr/btr0btr.c
index ff389ede06e..ae967e0525e 100644
--- a/innobase/btr/btr0btr.c
+++ b/innobase/btr/btr0btr.c
@@ -610,8 +610,8 @@ btr_page_get_father_for_rec(
fputs(
"InnoDB: You should dump + drop + reimport the table to fix the\n"
"InnoDB: corruption. If the crash happens at the database startup, see\n"
-"InnoDB: section 6.1 of http://www.innodb.com/ibman.php about forcing\n"
-"InnoDB: recovery. Then dump + drop + reimport.\n", stderr);
+"InnoDB: http://dev.mysql.com/doc/mysql/en/Forcing_recovery.html about\n"
+"InnoDB: forcing recovery. Then dump + drop + reimport.\n", stderr);
}
ut_a(btr_node_ptr_get_child_page_no(node_ptr) ==
diff --git a/innobase/buf/buf0buf.c b/innobase/buf/buf0buf.c
index e039ff4f81f..adb69f3c3a7 100644
--- a/innobase/buf/buf0buf.c
+++ b/innobase/buf/buf0buf.c
@@ -1835,9 +1835,9 @@ buf_page_io_complete(
"InnoDB: by dumping, dropping, and reimporting\n"
"InnoDB: the corrupt table. You can use CHECK\n"
"InnoDB: TABLE to scan your table for corruption.\n"
- "InnoDB: Look also at section 6.1 of\n"
- "InnoDB: http://www.innodb.com/ibman.php about\n"
- "InnoDB: forcing recovery.\n", stderr);
+ "InnoDB: See also "
+ "http://dev.mysql.com/doc/mysql/en/Forcing_recovery.html\n"
+ "InnoDB: about forcing recovery.\n", stderr);
if (srv_force_recovery < SRV_FORCE_IGNORE_CORRUPT) {
fputs(
diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c
index b5dd06b1bf1..aa7e90700f8 100644
--- a/innobase/dict/dict0dict.c
+++ b/innobase/dict/dict0dict.c
@@ -527,8 +527,10 @@ dict_index_contains_col_or_prefix(
}
/************************************************************************
-Looks for a matching field in an index. The column and the prefix len have
-to be the same. */
+Looks for a matching field in an index. The column has to be the same. The
+column in index must be complete, or must contain a prefix longer than the
+column in index2. That is, we must be able to construct the prefix in index2
+from the prefix in index. */
ulint
dict_index_get_nth_field_pos(
@@ -556,7 +558,9 @@ dict_index_get_nth_field_pos(
field = dict_index_get_nth_field(index, pos);
if (field->col == field2->col
- && field->prefix_len == field2->prefix_len) {
+ && (field->prefix_len == 0
+ || (field->prefix_len >= field2->prefix_len
+ && field2->prefix_len != 0))) {
return(pos);
}
@@ -2114,7 +2118,8 @@ dict_foreign_error_report(
fputs("\nThe index in the foreign key in table is ", file);
ut_print_name(file, NULL, fk->foreign_index->name);
fputs(
-"See http://www.innodb.com/ibman.php for correct foreign key definition.\n",
+"\nSee http://dev.mysql.com/doc/mysql/en/InnoDB_foreign_key_constraints.html\n"
+"for correct foreign key definition.\n",
file);
}
mutex_exit(&dict_foreign_err_mutex);
@@ -2589,7 +2594,9 @@ dict_strip_comments(
char* str;
const char* sptr;
char* ptr;
-
+ /* unclosed quote character (0 if none) */
+ char quote = 0;
+
str = mem_alloc(strlen(sql_string) + 1);
sptr = sql_string;
@@ -2604,8 +2611,18 @@ scan_more:
return(str);
}
-
- if (*sptr == '#'
+
+ if (*sptr == quote) {
+ /* Closing quote character: do not look for
+ starting quote or comments. */
+ quote = 0;
+ } else if (quote) {
+ /* Within quotes: do not look for
+ starting quotes or comments. */
+ } else if (*sptr == '"' || *sptr == '`') {
+ /* Starting quote: remember the quote character. */
+ quote = *sptr;
+ } else if (*sptr == '#'
|| (0 == memcmp("-- ", sptr, 3))) {
for (;;) {
/* In Unix a newline is 0x0A while in Windows
@@ -2620,9 +2637,7 @@ scan_more:
sptr++;
}
- }
-
- if (*sptr == '/' && *(sptr + 1) == '*') {
+ } else if (!quote && *sptr == '/' && *(sptr + 1) == '*') {
for (;;) {
if (*sptr == '*' && *(sptr + 1) == '/') {
@@ -2950,7 +2965,8 @@ col_loop1:
ut_print_name(ef, NULL, name);
fprintf(ef, " where the columns appear\n"
"as the first columns. Constraint:\n%s\n"
-"See http://www.innodb.com/ibman.php for correct foreign key definition.\n",
+"See http://dev.mysql.com/doc/mysql/en/InnoDB_foreign_key_constraints.html\n"
+"for correct foreign key definition.\n",
start_of_latest_foreign);
mutex_exit(&dict_foreign_err_mutex);
@@ -3215,7 +3231,8 @@ try_find_index:
"Cannot find an index in the referenced table where the\n"
"referenced columns appear as the first columns, or column types\n"
"in the table and the referenced table do not match for constraint.\n"
-"See http://www.innodb.com/ibman.php for correct foreign key definition.\n",
+"See http://dev.mysql.com/doc/mysql/en/InnoDB_foreign_key_constraints.html\n"
+"for correct foreign key definition.\n",
start_of_latest_foreign);
mutex_exit(&dict_foreign_err_mutex);
diff --git a/innobase/fsp/fsp0fsp.c b/innobase/fsp/fsp0fsp.c
index 34b6de76ff4..e1621cc2765 100644
--- a/innobase/fsp/fsp0fsp.c
+++ b/innobase/fsp/fsp0fsp.c
@@ -2972,9 +2972,9 @@ fseg_free_page_low(
"InnoDB: database!\n", (ulong) page);
crash:
fputs(
-"InnoDB: If the InnoDB recovery crashes here, see section 6.1\n"
-"InnoDB: of http://www.innodb.com/ibman.php about forcing recovery.\n",
- stderr);
+"InnoDB: Please refer to\n"
+"InnoDB: http://dev.mysql.com/doc/mysql/en/Forcing_recovery.html\n"
+"InnoDB: about forcing recovery.\n", stderr);
ut_error;
}
diff --git a/innobase/include/dict0dict.h b/innobase/include/dict0dict.h
index a1a1ebdfe08..4dbbd5b4886 100644
--- a/innobase/include/dict0dict.h
+++ b/innobase/include/dict0dict.h
@@ -604,8 +604,10 @@ dict_index_contains_col_or_prefix(
dict_index_t* index, /* in: index */
ulint n); /* in: column number */
/************************************************************************
-Looks for a matching field in an index. The column and the prefix len has
-to be the same. */
+Looks for a matching field in an index. The column has to be the same. The
+column in index must be complete, or must contain a prefix longer than the
+column in index2. That is, we must be able to construct the prefix in index2
+from the prefix in index. */
ulint
dict_index_get_nth_field_pos(
diff --git a/innobase/include/row0mysql.h b/innobase/include/row0mysql.h
index 8f6264944ce..9437ed4b6ee 100644
--- a/innobase/include/row0mysql.h
+++ b/innobase/include/row0mysql.h
@@ -559,9 +559,11 @@ struct row_prebuilt_struct {
dtuple_t* clust_ref; /* prebuilt dtuple used in
sel/upd/del */
ulint select_lock_type;/* LOCK_NONE, LOCK_S, or LOCK_X */
- ulint stored_select_lock_type;/* inside LOCK TABLES, either
- LOCK_S or LOCK_X depending on the lock
- type */
+ ulint stored_select_lock_type;/* this field is used to
+ remember the original select_lock_type
+ that was decided in ha_innodb.cc,
+ ::store_lock(), ::external_lock(),
+ etc. */
ulint mysql_row_len; /* length in bytes of a row in the
MySQL format */
ulint n_rows_fetched; /* number of rows fetched after
diff --git a/innobase/log/log0log.c b/innobase/log/log0log.c
index 923ab448e07..b6357fa2c76 100644
--- a/innobase/log/log0log.c
+++ b/innobase/log/log0log.c
@@ -689,10 +689,9 @@ failure:
"InnoDB: To get mysqld to start up, set innodb_thread_concurrency in my.cnf\n"
"InnoDB: to a lower value, for example, to 8. After an ERROR-FREE shutdown\n"
"InnoDB: of mysqld you can adjust the size of ib_logfiles, as explained in\n"
-"InnoDB: section 5 of http://www.innodb.com/ibman.php",
+"InnoDB: http://dev.mysql.com/doc/mysql/en/Adding_and_removing.html\n"
+"InnoDB: Cannot continue operation. Calling exit(1).\n",
(ulong)srv_thread_concurrency);
- fprintf(stderr,
-"InnoDB: Cannot continue operation. Calling exit(1).\n");
exit(1);
}
diff --git a/innobase/log/log0recv.c b/innobase/log/log0recv.c
index e5b0300239a..10f921bb1f0 100644
--- a/innobase/log/log0recv.c
+++ b/innobase/log/log0recv.c
@@ -538,8 +538,8 @@ recv_find_max_checkpoint(
"InnoDB: If this error appears when you are creating an InnoDB database,\n"
"InnoDB: the problem may be that during an earlier attempt you managed\n"
"InnoDB: to create the InnoDB data files, but log file creation failed.\n"
-"InnoDB: If that is the case, please refer to section 3.1 of\n"
-"InnoDB: http://www.innodb.com/ibman.php\n");
+"InnoDB: If that is the case, please refer to\n"
+"InnoDB: http://dev.mysql.com/doc/mysql/en/Error_creating_InnoDB.html\n");
return(DB_ERROR);
}
@@ -1884,7 +1884,7 @@ recv_report_corrupt_log(
"InnoDB: far enough in recovery! Please run CHECK TABLE\n"
"InnoDB: on your InnoDB tables to check that they are ok!\n"
"InnoDB: If mysqld crashes after this recovery, look at\n"
- "InnoDB: section 6.1 of http://www.innodb.com/ibman.php\n"
+ "InnoDB: http://dev.mysql.com/doc/mysql/en/Forcing_recovery.html\n"
"InnoDB: about forcing recovery.\n", stderr);
fflush(stderr);
diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c
index 392580eb570..1040283f85e 100644
--- a/innobase/os/os0file.c
+++ b/innobase/os/os0file.c
@@ -234,8 +234,9 @@ os_file_get_last_error(
"InnoDB: of the same name as a data file.\n");
} else {
fprintf(stderr,
- "InnoDB: See section 13.2 at http://www.innodb.com/ibman.php\n"
- "InnoDB: about operating system error numbers.\n");
+ "InnoDB: Some operating system error numbers are described at\n"
+ "InnoDB: "
+ "http://dev.mysql.com/doc/mysql/en/Operating_System_error_codes.html\n");
}
}
@@ -280,8 +281,9 @@ os_file_get_last_error(
}
fprintf(stderr,
- "InnoDB: See also section 13.2 at http://www.innodb.com/ibman.php\n"
- "InnoDB: about operating system error numbers.\n");
+ "InnoDB: Some operating system error numbers are described at\n"
+ "InnoDB: "
+ "http://dev.mysql.com/doc/mysql/en/Operating_System_error_codes.html\n");
}
}
@@ -2174,8 +2176,9 @@ retry:
fprintf(stderr,
" InnoDB: Error: File pointer positioning to file %s failed at\n"
"InnoDB: offset %lu %lu. Operating system error number %lu.\n"
-"InnoDB: Look from section 13.2 at http://www.innodb.com/ibman.php\n"
-"InnoDB: what the error number means.\n",
+"InnoDB: Some operating system error numbers are described at\n"
+"InnoDB: "
+"http://dev.mysql.com/doc/mysql/en/Operating_System_error_codes.html\n",
name, (ulong) offset_high, (ulong) offset,
(ulong) GetLastError());
@@ -2232,8 +2235,9 @@ retry:
}
fprintf(stderr,
-"InnoDB: See also section 13.2 at http://www.innodb.com/ibman.php\n"
-"InnoDB: about operating system error numbers.\n");
+"InnoDB: Some operating system error numbers are described at\n"
+"InnoDB: "
+"http://dev.mysql.com/doc/mysql/en/Operating_System_error_codes.html\n");
os_has_said_disk_full = TRUE;
}
@@ -2267,8 +2271,9 @@ retry:
}
fprintf(stderr,
-"InnoDB: See also section 13.2 at http://www.innodb.com/ibman.php\n"
-"InnoDB: about operating system error numbers.\n");
+"InnoDB: Some operating system error numbers are described at\n"
+"InnoDB: "
+"http://dev.mysql.com/doc/mysql/en/Operating_System_error_codes.html\n");
os_has_said_disk_full = TRUE;
}
@@ -3466,6 +3471,8 @@ restart:
/* NOTE! We only access constant fields in os_aio_array. Therefore
we do not have to acquire the protecting mutex yet */
+ srv_set_io_thread_op_info(global_segment,
+ "looking for i/o requests (a)");
ut_ad(os_aio_validate());
ut_ad(segment < array->n_segments);
@@ -3484,6 +3491,9 @@ restart:
os_mutex_enter(array->mutex);
+ srv_set_io_thread_op_info(global_segment,
+ "looking for i/o requests (b)");
+
/* Check if there is a slot for which the i/o has already been
done */
@@ -3596,6 +3606,8 @@ consecutive_loop:
}
}
+ srv_set_io_thread_op_info(global_segment, "consecutive i/o requests");
+
/* We have now collected n_consecutive i/o requests in the array;
allocate a single buffer which can hold all data, and perform the
i/o */
@@ -3741,6 +3753,8 @@ slot_io_done:
return(ret);
wait_for_io:
+ srv_set_io_thread_op_info(global_segment, "resetting wait event");
+
/* We wait here until there again can be i/os in the segment
of this thread */
@@ -3832,9 +3846,17 @@ os_aio_print(
ulint i;
for (i = 0; i < srv_n_file_io_threads; i++) {
- fprintf(file, "I/O thread %lu state: %s (%s)\n", (ulong) i,
+ fprintf(file, "I/O thread %lu state: %s (%s)", (ulong) i,
srv_io_thread_op_info[i],
srv_io_thread_function[i]);
+
+#ifndef __WIN__
+ if (os_aio_segment_wait_events[i]->is_set) {
+ fprintf(file, " ev set");
+ }
+#endif
+
+ fprintf(file, "\n");
}
fputs("Pending normal aio reads:", file);
diff --git a/innobase/pars/pars0opt.c b/innobase/pars/pars0opt.c
index 0d487f6e54a..88022e2efe1 100644
--- a/innobase/pars/pars0opt.c
+++ b/innobase/pars/pars0opt.c
@@ -1094,6 +1094,19 @@ opt_clust_access(
for (i = 0; i < n_fields; i++) {
pos = dict_index_get_nth_field_pos(index, clust_index, i);
+ ut_a(pos != ULINT_UNDEFINED);
+
+ /* We optimize here only queries to InnoDB's internal system
+ tables, and they should not contain column prefix indexes. */
+
+ if (dict_index_get_nth_field(index, pos)->prefix_len != 0
+ || dict_index_get_nth_field(clust_index, i)
+ ->prefix_len != 0) {
+ fprintf(stderr,
+"InnoDB: Error in pars0opt.c: table %s has prefix_len != 0\n",
+ index->table_name);
+ }
+
*(plan->clust_map + i) = pos;
ut_ad((pos != ULINT_UNDEFINED)
diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c
index 152bb0291c3..88227d61f1d 100644
--- a/innobase/row/row0mysql.c
+++ b/innobase/row/row0mysql.c
@@ -339,8 +339,9 @@ handle_new_error:
"InnoDB: a case of widespread corruption, dump all InnoDB\n"
"InnoDB: tables and recreate the whole InnoDB tablespace.\n"
"InnoDB: If the mysqld server crashes after the startup or when\n"
- "InnoDB: you dump the tables, look at section 6.1 of\n"
- "InnoDB: http://www.innodb.com/ibman.html for help.\n", stderr);
+ "InnoDB: you dump the tables, look at\n"
+ "InnoDB: http://dev.mysql.com/doc/mysql/en/Forcing_recovery.html"
+ " for help.\n", stderr);
} else {
fprintf(stderr, "InnoDB: unknown error code %lu\n",
@@ -1587,8 +1588,9 @@ row_create_table_for_mysql(
"InnoDB: database and moving the .frm file to the current database.\n"
"InnoDB: Then MySQL thinks the table exists, and DROP TABLE will\n"
"InnoDB: succeed.\n"
- "InnoDB: You can look for further help from section 15.1 of\n"
- "InnoDB: http://www.innodb.com/ibman.php\n", stderr);
+ "InnoDB: You can look for further help from\n"
+ "InnoDB: http://dev.mysql.com/doc/mysql/en/"
+ "InnoDB_troubleshooting_datadict.html\n", stderr);
}
/* We may also get err == DB_ERROR if the .ibd file for the
@@ -2369,6 +2371,7 @@ row_drop_table_for_mysql(
memcpy(sql, str1, (sizeof str1) - 1);
memcpy(sql + (sizeof str1) - 1, quoted_name, namelen);
memcpy(sql + (sizeof str1) - 1 + namelen, str2, sizeof str2);
+ mem_free(quoted_name);
/* Serialize data dictionary operations with dictionary mutex:
no deadlocks can occur then in these operations */
@@ -2409,8 +2412,9 @@ row_drop_table_for_mysql(
"InnoDB: data dictionary though MySQL is trying to drop it.\n"
"InnoDB: Have you copied the .frm file of the table to the\n"
"InnoDB: MySQL database directory from another database?\n"
- "InnoDB: You can look for further help from section 15.1 of\n"
- "InnoDB: http://www.innodb.com/ibman.php\n", stderr);
+ "InnoDB: You can look for further help from\n"
+ "InnoDB: http://dev.mysql.com/doc/mysql/en/"
+ "InnoDB_troubleshooting_datadict.html\n", stderr);
goto funct_exit;
}
@@ -2955,11 +2959,13 @@ row_rename_table_for_mysql(
ut_print_name(stderr, trx, old_name);
fputs(" to it.\n"
"InnoDB: Have you deleted the .frm file and not used DROP TABLE?\n"
- "InnoDB: You can look for further help from section 15.1 of\n"
- "InnoDB: http://www.innodb.com/ibman.php\n"
+ "InnoDB: You can look for further help from\n"
+ "InnoDB: http://dev.mysql.com/doc/mysql/en/"
+ "InnoDB_troubleshooting_datadict.html\n"
"InnoDB: If table ", stderr);
- ut_print_name(stderr, trx, new_name);
- fputs(" is a temporary table #sql..., then it can be that\n"
+ ut_print_name(stderr, trx, new_name);
+ fputs(
+ " is a temporary table #sql..., then it can be that\n"
"InnoDB: there are still queries running on the table, and it will be\n"
"InnoDB: dropped automatically when the queries end.\n"
"InnoDB: You can drop the orphaned table inside InnoDB by\n"
diff --git a/innobase/row/row0row.c b/innobase/row/row0row.c
index e7b39f0fe52..2de7ffc79c0 100644
--- a/innobase/row/row0row.c
+++ b/innobase/row/row0row.c
@@ -343,6 +343,7 @@ row_build_row_ref(
ulint ref_len;
ulint pos;
byte* buf;
+ ulint clust_col_prefix_len;
ulint i;
ut_ad(index && rec && heap);
@@ -375,6 +376,22 @@ row_build_row_ref(
field = rec_get_nth_field(rec, pos, &len);
dfield_set_data(dfield, field, len);
+
+ /* If the primary key contains a column prefix, then the
+ secondary index may contain a longer prefix of the same
+ column, or the full column, and we must adjust the length
+ accordingly. */
+
+ clust_col_prefix_len =
+ dict_index_get_nth_field(clust_index, i)->prefix_len;
+
+ if (clust_col_prefix_len > 0) {
+ if (len != UNIV_SQL_NULL
+ && len > clust_col_prefix_len) {
+
+ dfield_set_len(dfield, clust_col_prefix_len);
+ }
+ }
}
ut_ad(dtuple_check_typed(ref));
@@ -406,6 +423,7 @@ row_build_row_ref_in_tuple(
ulint len;
ulint ref_len;
ulint pos;
+ ulint clust_col_prefix_len;
ulint i;
ut_a(ref && index && rec);
@@ -443,6 +461,22 @@ row_build_row_ref_in_tuple(
field = rec_get_nth_field(rec, pos, &len);
dfield_set_data(dfield, field, len);
+
+ /* If the primary key contains a column prefix, then the
+ secondary index may contain a longer prefix of the same
+ column, or the full column, and we must adjust the length
+ accordingly. */
+
+ clust_col_prefix_len =
+ dict_index_get_nth_field(clust_index, i)->prefix_len;
+
+ if (clust_col_prefix_len > 0) {
+ if (len != UNIV_SQL_NULL
+ && len > clust_col_prefix_len) {
+
+ dfield_set_len(dfield, clust_col_prefix_len);
+ }
+ }
}
ut_ad(dtuple_check_typed(ref));
diff --git a/innobase/sync/sync0arr.c b/innobase/sync/sync0arr.c
index 7cd221df6a5..e5285cb7ebf 100644
--- a/innobase/sync/sync0arr.c
+++ b/innobase/sync/sync0arr.c
@@ -61,10 +61,7 @@ struct sync_cell_struct {
thread */
ibool waiting; /* TRUE if the thread has already
called sync_array_event_wait
- on this cell but not yet
- sync_array_free_cell (which
- actually resets wait_object and thus
- whole cell) */
+ on this cell */
ibool event_set; /* TRUE if the event is set */
os_event_t event; /* operating system event
semaphore handle */
diff --git a/innobase/ut/ut0dbg.c b/innobase/ut/ut0dbg.c
index 2a0cfe1f13a..0f6a27d35d9 100644
--- a/innobase/ut/ut0dbg.c
+++ b/innobase/ut/ut0dbg.c
@@ -31,8 +31,9 @@ const char* ut_dbg_msg_trap =
"InnoDB: Submit a detailed bug report to http://bugs.mysql.com.\n"
"InnoDB: If you get repeated assertion failures or crashes, even\n"
"InnoDB: immediately after the mysqld startup, there may be\n"
-"InnoDB: corruption in the InnoDB tablespace. See section 6.1 of\n"
-"InnoDB: http://www.innodb.com/ibman.php about forcing recovery.\n";
+"InnoDB: corruption in the InnoDB tablespace. Please refer to\n"
+"InnoDB: http://dev.mysql.com/doc/mysql/en/Forcing_recovery.html\n"
+"InnoDB: about forcing recovery.\n";
const char* ut_dbg_msg_stop =
"InnoDB: Thread %lu stopped in file %s line %lu\n";