30 #include "row0mysql.ic"
79 UNIV_INTERN mysql_pfs_key_t row_drop_list_mutex_key;
93 static ibool row_mysql_drop_list_inited = FALSE;
97 static const
char S_innodb_monitor[] = "innodb_monitor";
98 static const
char S_innodb_lock_monitor[] = "innodb_lock_monitor";
99 static const
char S_innodb_tablespace_monitor[] = "innodb_tablespace_monitor";
100 static const
char S_innodb_table_monitor[] = "innodb_table_monitor";
101 #ifdef UNIV_MEM_DEBUG
102 static const char S_innodb_mem_validate[] =
"innodb_mem_validate";
112 #define STR_EQ(str1, str1_len, str2_onstack) \
113 ((str1_len) == sizeof(str2_onstack) \
114 && memcmp(str1, str2_onstack, sizeof(str2_onstack)) == 0)
121 row_mysql_is_system_table(
125 if (strncmp(name,
"mysql/", 6) != 0) {
130 return(0 == strcmp(name + 6,
"host")
131 || 0 == strcmp(name + 6,
"user")
132 || 0 == strcmp(name + 6,
"db"));
144 row_add_table_to_background_drop_list(
152 row_mysql_delay_if_needed(
void)
155 if (srv_dml_needed_delay) {
187 ut_a(len < 256 * 256);
250 memset(dest,
'\0', col_len);
257 ut_a(col_len - 8 > 1 || len < 256);
258 ut_a(col_len - 8 > 2 || len < 256 * 256);
259 ut_a(col_len - 8 > 3 || len < 256 * 256 * 256);
263 memcpy(dest + col_len - 8, &data,
sizeof data);
283 memcpy(&data, ref + col_len - 8,
sizeof data);
301 switch (UNIV_EXPECT(mbminlen, 1)) {
306 memset(pad, 0x20, len);
312 while (pad < pad_end) {
321 while (pad < pad_end) {
349 ibool row_format_col,
356 const byte* mysql_data,
369 const byte* ptr = mysql_data;
374 dtype = dfield_get_type(dfield);
378 if (type == DATA_INT) {
383 byte* p = buf + col_len;
394 if (!(dtype->
prtype & DATA_UNSIGNED)) {
401 }
else if ((type == DATA_VARCHAR
402 || type == DATA_VARMYSQL
403 || type == DATA_BINARY)) {
409 if (row_format_col) {
410 if (dtype->
prtype & DATA_LONG_TRUE_VARCHAR) {
440 && ptr[col_len - 4] == 0x00
441 && ptr[col_len - 3] == 0x00
442 && ptr[col_len - 2] == 0x00
443 && ptr[col_len - 1] == 0x20) {
452 while (col_len >= 2 && ptr[col_len - 2] == 0x00
453 && ptr[col_len - 1] == 0x20) {
460 && ptr[col_len - 1] == 0x20) {
465 }
else if (comp && type == DATA_MYSQL
498 while (col_len > n_chars && ptr[col_len - 1] == 0x20) {
501 }
else if (type == DATA_BLOB && row_format_col) {
517 row_mysql_convert_row_to_innobase(
539 dfield = dtuple_get_nth_field(row, i);
568 if (prebuilt->
table->fts) {
597 ut_a(err != DB_SUCCESS);
608 case DB_DUPLICATE_KEY:
616 case DB_OUT_OF_FILE_SPACE:
618 case DB_FTS_INVALID_DOCID:
635 goto handle_new_error;
651 fputs(
"InnoDB: The database cannot continue"
652 " operation because of\n"
653 "InnoDB: lack of space. You must add"
654 " a new data file to\n"
655 "InnoDB: my.cnf and restart the database.\n", stderr);
661 fputs(
"InnoDB: We detected index corruption"
662 " in an InnoDB type table.\n"
663 "InnoDB: You have to dump + drop + reimport"
664 " the table or, in\n"
665 "InnoDB: a case of widespread corruption,"
667 "InnoDB: tables and recreate the"
668 " whole InnoDB tablespace.\n"
669 "InnoDB: If the mysqld server crashes"
670 " after the startup or when\n"
671 "InnoDB: you dump the tables, look at\n"
672 "InnoDB: " REFMAN
"forcing-innodb-recovery.html"
673 " for help.\n", stderr);
676 fprintf(stderr,
"InnoDB: Cannot delete/update rows with"
677 " cascading foreign key constraints that exceed max"
679 "Please drop excessive foreign constraints"
683 fprintf(stderr,
"InnoDB: unknown error code %lu\n",
715 ulint search_tuple_n_fields;
719 clust_index = dict_table_get_first_index(table);
726 #define PREBUILT_HEAP_INITIAL_SIZE \
730 + DTUPLE_EST_ALLOC(search_tuple_n_fields) \
731 + DTUPLE_EST_ALLOC(ref_len) \
733 + sizeof(sel_node_t) \
734 + sizeof(que_fork_t) \
735 + sizeof(que_thr_t) \
737 + sizeof(upd_node_t) \
739 + sizeof(upd_field_t) \
740 * dict_table_get_n_cols(table) \
741 + sizeof(que_fork_t) \
742 + sizeof(que_thr_t) \
744 + sizeof(ins_node_t) \
748 + (mysql_row_len < 256 ? mysql_row_len : 0) \
749 + DTUPLE_EST_ALLOC(dict_table_get_n_cols(table)) \
750 + sizeof(que_fork_t) \
751 + sizeof(que_thr_t) \
762 prebuilt->
magic_n = ROW_PREBUILT_ALLOCATED;
763 prebuilt->
magic_n2 = ROW_PREBUILT_ALLOCATED;
794 prebuilt->fts_doc_id = 0;
813 (prebuilt->
magic_n != ROW_PREBUILT_ALLOCATED
814 || prebuilt->
magic_n2 != ROW_PREBUILT_ALLOCATED)) {
817 "InnoDB: Error: trying to free a corrupt\n"
818 "InnoDB: table handle. Magic n %lu,"
819 " magic n2 %lu, table name ",
830 prebuilt->
magic_n = ROW_PREBUILT_FREED;
831 prebuilt->
magic_n2 = ROW_PREBUILT_FREED;
864 for (i = 0; i < MYSQL_FETCH_CACHE_SIZE; i++) {
878 if (ROW_PREBUILT_FETCH_MAGIC_N != magic1
880 || ROW_PREBUILT_FETCH_MAGIC_N != magic2) {
882 fputs(
"InnoDB: Error: trying to free"
883 " a corrupt fetch buffer.\n", stderr);
909 if (trx->magic_n != TRX_MAGIC_N) {
911 "InnoDB: Error: trying to use a corrupt\n"
912 "InnoDB: trx handle. Magic n %lu\n",
913 (ulong) trx->magic_n);
920 if (prebuilt->
magic_n != ROW_PREBUILT_ALLOCATED) {
922 "InnoDB: Error: trying to use a corrupt\n"
923 "InnoDB: table handle. Magic n %lu, table name ",
955 row_get_prebuilt_insert_row(
962 ut_ad(prebuilt && table && prebuilt->
trx);
1010 prebuilt->
trx, prebuilt->
heap)));
1028 ib_uint64_t counter;
1033 "test_upd_stats_if_needed_not_inited",
1034 fprintf(stderr,
"test_upd_stats_if_needed_not_inited "
1044 if (counter > n_rows / 10
1058 if (counter > 16 + n_rows / 16 ) {
1085 ibool was_lock_wait;
1097 trx->
op_info =
"setting auto-inc lock";
1099 row_get_prebuilt_insert_row(prebuilt);
1116 trx_start_if_not_started_xa(trx);
1122 if (err != DB_SUCCESS) {
1127 if (was_lock_wait) {
1162 ibool was_lock_wait;
1166 trx->
op_info =
"setting table lock";
1187 trx_start_if_not_started_xa(trx);
1192 static_cast<enum lock_mode>(mode), thr);
1196 static_cast<enum lock_mode>(
1203 if (err != DB_SUCCESS) {
1208 if (was_lock_wait) {
1238 ibool was_lock_wait;
1247 "The table %s doesn't have a corresponding "
1248 "tablespace, it was discarded.",
1256 ".ibd file is missing for table %s",
1259 return(DB_TABLESPACE_NOT_FOUND);
1261 }
else if (prebuilt->
magic_n != ROW_PREBUILT_ALLOCATED) {
1263 "InnoDB: Error: trying to free a corrupt\n"
1264 "InnoDB: table handle. Magic n %lu, table name ",
1273 fputs(
"InnoDB: A new raw disk partition was initialized or\n"
1274 "InnoDB: innodb_force_recovery is on: we do not allow\n"
1275 "InnoDB: database modifications by the user. Shut down\n"
1276 "InnoDB: mysqld and edit my.cnf so that"
1277 " newraw is replaced\n"
1278 "InnoDB: with raw, and innodb_force_... is removed.\n",
1286 row_mysql_delay_if_needed();
1288 trx_start_if_not_started_xa(trx);
1290 row_get_prebuilt_insert_row(prebuilt);
1293 row_mysql_convert_row_to_innobase(node->
row, prebuilt, mysql_rec);
1300 node->
state = INS_NODE_SET_IX_LOCK;
1303 node->
state = INS_NODE_ALLOC_ROW_ID;
1316 if (err != DB_SUCCESS) {
1324 &err, trx, thr, &savept);
1328 if (was_lock_wait) {
1330 || node->
state == INS_NODE_ALLOC_ROW_ID);
1347 "InnoDB: FTS Doc ID must be large than 0 \n");
1348 err = DB_FTS_INVALID_DOCID;
1357 if (doc_id < next_doc_id) {
1359 "InnoDB: FTS Doc ID must be large than"
1360 " "UINT64PF
" for table",
1365 err = DB_FTS_INVALID_DOCID;
1373 if (doc_id - next_doc_id >= FTS_DOC_ID_MAX_STEP) {
1375 "InnoDB: Doc ID "UINT64PF
" is too"
1376 " big. Its difference with largest"
1377 " used Doc ID "UINT64PF
" cannot"
1378 " exceed or equal to %d\n",
1379 doc_id, next_doc_id - 1,
1380 FTS_DOC_ID_MAX_STEP);
1381 err = DB_FTS_INVALID_DOCID;
1428 static_cast<sel_node_t*>(node),
1429 prebuilt->
trx, prebuilt->
heap)));
1450 node->in_mysql_interface = TRUE;
1451 node->is_delete = FALSE;
1452 node->searched_update = FALSE;
1462 node->has_clust_rec_x_lock = TRUE;
1463 node->cmpl_info = 0;
1465 node->table_sym = NULL;
1466 node->col_assign_list = NULL;
1486 ut_ad(prebuilt && table && prebuilt->
trx);
1500 static_cast<upd_node_t*>(node),
1501 prebuilt->
trx, prebuilt->
heap)));
1520 if (trx->fts_next_doc_id) {
1531 row_fts_update_or_delete(
1539 doc_id_t old_doc_id = prebuilt->fts_doc_id;
1544 if (node->is_delete) {
1552 if (new_doc_id == 0) {
1553 fprintf(stderr,
" InnoDB FTS: Doc ID cannot be 0 \n");
1554 return(DB_FTS_INVALID_DOCID);
1557 row_fts_do_update(trx, table, old_doc_id, new_doc_id);
1567 init_fts_doc_id_for_ref(
1616 ibool was_lock_wait;
1624 ut_ad(prebuilt && trx);
1629 fprintf(stderr,
" InnoDB: Error:\n"
1630 "InnoDB: MySQL is trying to use a table handle"
1631 " but the .ibd file for\n"
1632 "InnoDB: table %s does not exist.\n"
1633 "InnoDB: Have you deleted the .ibd file"
1634 " from the database directory under\n"
1635 "InnoDB: the MySQL datadir, or have you"
1636 " used DISCARD TABLESPACE?\n"
1637 "InnoDB: Look from\n"
1638 "InnoDB: " REFMAN
"innodb-troubleshooting.html\n"
1639 "InnoDB: how you can resolve the problem.\n",
1644 if (UNIV_UNLIKELY(prebuilt->
magic_n != ROW_PREBUILT_ALLOCATED)) {
1646 "InnoDB: Error: trying to free a corrupt\n"
1647 "InnoDB: table handle. Magic n %lu, table name ",
1658 fputs(
"InnoDB: A new raw disk partition was initialized or\n"
1659 "InnoDB: innodb_force_recovery is on: we do not allow\n"
1660 "InnoDB: database modifications by the user. Shut down\n"
1661 "InnoDB: mysqld and edit my.cnf so that newraw"
1663 "InnoDB: with raw, and innodb_force_... is removed.\n",
1669 DEBUG_SYNC_C(
"innodb_row_update_for_mysql_begin");
1671 trx->
op_info =
"updating or deleting";
1673 row_mysql_delay_if_needed();
1675 trx_start_if_not_started_xa(trx);
1684 row_mysql_freeze_data_dictionary(trx);
1685 init_fts_doc_id_for_ref(table, &fk_depth);
1691 clust_index = dict_table_get_first_index(table);
1713 node->
state = UPD_NODE_UPDATE_CLUSTERED;
1731 if (err != DB_SUCCESS) {
1734 if (err == DB_RECORD_NOT_FOUND) {
1743 DEBUG_SYNC(trx->
mysql_thd,
"row_update_for_mysql_error");
1749 if (was_lock_wait) {
1761 && trx->fts_next_doc_id != UINT64_UNDEFINED) {
1762 err = row_fts_update_or_delete(prebuilt);
1763 if (err != DB_SUCCESS) {
1769 if (node->is_delete) {
1784 if (node->is_delete || !(node->cmpl_info & UPD_NODE_NO_ORD_CHANGE)) {
1809 ibool has_latches_on_recs)
1819 ut_ad(prebuilt && trx);
1826 "InnoDB: Error: calling row_unlock_for_mysql though\n"
1827 "InnoDB: innodb_locks_unsafe_for_binlog is FALSE and\n"
1828 "InnoDB: this session is not using"
1829 " READ COMMITTED isolation level.\n");
1846 if (!has_latches_on_recs) {
1850 rec = btr_pcur_get_rec(pcur);
1851 index = btr_pcur_get_btr_cur(pcur)->index;
1857 if (!has_latches_on_recs) {
1862 rec = btr_pcur_get_rec(clust_pcur);
1863 index = btr_pcur_get_btr_cur(clust_pcur)->index;
1880 ulint offsets_[REC_OFFS_NORMAL_SIZE];
1883 rec_offs_init(offsets_);
1884 offsets = rec_get_offsets(rec, index, offsets,
1885 ULINT_UNDEFINED, &heap);
1889 if (UNIV_LIKELY_NULL(heap)) {
1894 if (rec_trx_id != trx->
id) {
1897 rec = btr_pcur_get_rec(pcur);
1901 btr_pcur_get_block(pcur),
1903 static_cast<enum lock_mode>(
1907 rec = btr_pcur_get_rec(clust_pcur);
1911 btr_pcur_get_block(clust_pcur),
1913 static_cast<enum lock_mode>(
1953 DEBUG_SYNC_C(
"foreign_constraint_update_cascade");
1969 if (err == DB_LOCK_WAIT) {
1990 if (err != DB_SUCCESS) {
1995 if (node->is_delete) {
2024 clust_index = dict_table_get_first_index(table);
2055 ut_ad(lock_trx_has_sys_table_locks(trx) == NULL);
2095 ut_ad(lock_trx_has_sys_table_locks(trx) == NULL);
2130 ulint table_name_len;
2133 #ifdef UNIV_SYNC_DEBUG
2140 "ib_create_table_fail_at_start_of_row_create_table_for_mysql",
2144 if (srv_created_new_raw) {
2145 fputs(
"InnoDB: A new raw disk partition was initialized:\n"
2146 "InnoDB: we do not allow database modifications"
2148 "InnoDB: Shut down mysqld and edit my.cnf so that newraw"
2149 " is replaced with raw.\n", stderr);
2160 trx->
op_info =
"creating table";
2162 if (row_mysql_is_system_table(table->
name)) {
2165 "InnoDB: Error: trying to create a MySQL system"
2166 " table %s of type InnoDB.\n"
2167 "InnoDB: MySQL system tables must be"
2168 " of the MyISAM type!\n",
2173 trx_start_if_not_started_xa(trx);
2180 table_name_len = strlen(table_name) + 1;
2182 if (
STR_EQ(table_name, table_name_len, S_innodb_monitor)) {
2187 srv_print_innodb_monitor = TRUE;
2193 }
else if (
STR_EQ(table_name, table_name_len,
2194 S_innodb_lock_monitor)) {
2196 srv_print_innodb_monitor = TRUE;
2197 srv_print_innodb_lock_monitor = TRUE;
2199 }
else if (
STR_EQ(table_name, table_name_len,
2200 S_innodb_tablespace_monitor)) {
2202 srv_print_innodb_tablespace_monitor = TRUE;
2204 }
else if (
STR_EQ(table_name, table_name_len,
2205 S_innodb_table_monitor)) {
2207 srv_print_innodb_table_monitor = TRUE;
2209 #ifdef UNIV_MEM_DEBUG
2210 }
else if (
STR_EQ(table_name, table_name_len,
2211 S_innodb_mem_validate)) {
2215 fputs(
"Validating InnoDB memory:\n"
2216 "to use this feature you must compile InnoDB with\n"
2217 "UNIV_MEM_DEBUG defined in univ.i and"
2218 " the server must be\n"
2219 "quiet because allocation from a mem heap"
2220 " is not protected\n"
2221 "by any semaphore.\n", stderr);
2222 ut_a(mem_validate());
2223 fputs(
"Memory validated\n", stderr);
2238 ut_ad(strstr(table->
name,
"/FTS_") != NULL);
2252 if (table->
space != TRX_SYS_SPACE) {
2257 if (err == DB_SUCCESS) {
2269 if (err != DB_SUCCESS) {
2278 case DB_OUT_OF_FILE_SPACE:
2283 fputs(
" InnoDB: Warning: cannot create table ",
2286 fputs(
" because tablespace full\n", stderr);
2321 " InnoDB: Error: not able to"
2322 " delete tablespace %lu of table ",
2323 (ulong) table->
space);
2325 fputs(
"!\n", stderr);
2329 case DB_DUPLICATE_KEY:
2357 const ulint* field_lengths)
2375 #ifdef UNIV_SYNC_DEBUG
2380 trx->
op_info =
"creating index";
2388 is_fts = (index->
type == DICT_FTS);
2393 trx_start_if_not_started_xa(trx);
2395 for (i = 0; i < index->
n_def; i++) {
2399 len = dict_index_get_nth_field(index, i)->prefix_len;
2401 if (field_lengths && field_lengths[i]) {
2402 len =
ut_max(len, field_lengths[i]);
2406 "ib_create_table_fail_at_create_index",
2415 goto error_handling;
2440 if (err == DB_SUCCESS && is_fts) {
2452 if (err != DB_SUCCESS) {
2488 const char* sql_string,
2504 #ifdef UNIV_SYNC_DEBUG
2509 trx->
op_info =
"adding foreign keys";
2511 trx_start_if_not_started_xa(trx);
2518 DBUG_EXECUTE_IF(
"ib_table_add_foreign_fail",
2519 err = DB_DUPLICATE_KEY;);
2521 DEBUG_SYNC_C(
"table_add_foreign_constraints");
2523 if (err == DB_SUCCESS) {
2529 if (err != DB_SUCCESS) {
2556 row_drop_table_for_mysql_in_background(
2605 ulint n_tables_dropped = 0;
2607 mutex_enter(&row_drop_list_mutex);
2609 ut_a(row_mysql_drop_list_inited);
2615 mutex_exit(&row_drop_list_mutex);
2620 return(n_tables + n_tables_dropped);
2626 if (table == NULL) {
2630 goto already_dropped;
2637 if (DB_SUCCESS != row_drop_table_for_mysql_in_background(
2642 return(n_tables + n_tables_dropped);
2648 mutex_enter(&row_drop_list_mutex);
2652 MONITOR_DEC(MONITOR_BACKGROUND_DROP_TABLE);
2655 fputs(
" InnoDB: Dropped table ", stderr);
2657 fputs(
" in background drop queue.\n", stderr);
2663 mutex_exit(&row_drop_list_mutex);
2679 mutex_enter(&row_drop_list_mutex);
2681 ut_a(row_mysql_drop_list_inited);
2685 mutex_exit(&row_drop_list_mutex);
2699 row_add_table_to_background_drop_list(
2705 mutex_enter(&row_drop_list_mutex);
2707 ut_a(row_mysql_drop_list_inited);
2717 mutex_exit(&row_drop_list_mutex);
2736 mutex_exit(&row_drop_list_mutex);
2765 "PROCEDURE RENUMBER_TABLE_PROC () IS\n"
2767 "UPDATE SYS_TABLES SET ID = :new_id\n"
2768 " WHERE ID = :old_id;\n"
2769 "UPDATE SYS_COLUMNS SET TABLE_ID = :new_id\n"
2770 " WHERE TABLE_ID = :old_id;\n"
2771 "UPDATE SYS_INDEXES SET TABLE_ID = :new_id\n"
2772 " WHERE TABLE_ID = :old_id;\n"
2773 "END;\n", FALSE, trx);
2784 row_discard_tablespace_begin(
2789 trx->
op_info =
"discarding tablespace";
2793 trx_start_if_not_started_xa(trx);
2798 row_mysql_lock_data_dictionary(trx);
2819 row_discard_tablespace_foreign_key_checks(
2837 FILE* ef = dict_foreign_err_file;
2842 mutex_enter(&dict_foreign_err_mutex);
2848 fputs(
" Cannot DISCARD table ", ef);
2851 "because it is referenced by ", ef);
2855 mutex_exit(&dict_foreign_err_mutex);
2868 row_discard_tablespace_end(
2878 DBUG_EXECUTE_IF(
"ib_discard_before_commit_crash",
2884 DBUG_EXECUTE_IF(
"ib_discard_after_commit_crash",
2900 row_discard_tablespace(
2939 if (err != DB_SUCCESS) {
2947 if (err != DB_SUCCESS) {
2963 if (err != DB_SUCCESS) {
2974 case DB_TABLESPACE_NOT_FOUND:
3031 table = row_discard_tablespace_begin(name, trx);
3034 err = DB_TABLE_NOT_FOUND;
3035 }
else if (table->
space == TRX_SYS_SPACE) {
3039 table_name,
sizeof(table_name), table->
name, FALSE);
3042 ER_TABLE_IN_SYSTEM_TABLESPACE, table_name);
3050 table_name,
sizeof(table_name), table->
name, FALSE);
3053 ER_DISCARD_FK_CHECKS_RUNNING, table_name);
3060 err = row_discard_tablespace_foreign_key_checks(trx, table);
3062 if (err == DB_SUCCESS) {
3063 err = row_discard_tablespace(trx, table);
3067 return(row_discard_tablespace_end(trx, table, err));
3079 enum lock_mode
mode,
3080 const char* op_info)
3088 ut_ad(mode == LOCK_X || mode == LOCK_S);
3114 if (err == DB_SUCCESS) {
3119 if (err != DB_QUE_THR_SUSPENDED) {
3120 ibool was_lock_wait;
3123 &err, trx, thr, NULL);
3125 if (was_lock_wait) {
3135 static_cast<que_fork_t*>(parent));
3137 ut_a(run_thr == thr);
3173 ulint recreate_space = 0;
3175 ibool has_internal_doc_id;
3176 ulint old_space = table->
space;
3217 if (srv_created_new_raw) {
3218 fputs(
"InnoDB: A new raw disk partition was initialized:\n"
3219 "InnoDB: we do not allow database modifications"
3221 "InnoDB: Shut down mysqld and edit my.cnf so that newraw"
3222 " is replaced with raw.\n", stderr);
3230 return(DB_TABLESPACE_NOT_FOUND);
3235 trx->
op_info =
"truncating table";
3244 row_mysql_lock_data_dictionary(trx);
3247 #ifdef UNIV_SYNC_DEBUG
3267 FILE* ef = dict_foreign_err_file;
3272 mutex_enter(&dict_foreign_err_mutex);
3276 fputs(
" Cannot truncate table ", ef);
3278 fputs(
" by DROP+CREATE\n"
3279 "InnoDB: because it is referenced by ", ef);
3282 mutex_exit(&dict_foreign_err_mutex);
3296 fputs(
" InnoDB: Cannot truncate table ", stderr);
3298 fputs(
" by DROP+CREATE\n"
3299 "InnoDB: because there is a foreign key check"
3300 " running on it.\n",
3326 if (err != DB_SUCCESS) {
3340 if (flags != ULINT_UNDEFINED
3352 if (space == ULINT_UNDEFINED
3362 "TRUNCATE TABLE %s failed to "
3363 "create a new tablespace",
3371 recreate_space =
space;
3378 index = dict_table_get_first_index(table);
3381 index = dict_table_get_next_index(index);
3404 dfield = dtuple_get_nth_field(tuple, 0);
3414 btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
3427 rec = btr_pcur_get_rec(&pcur);
3429 field = rec_get_nth_field_old(
3430 rec, DICT_FLD__SYS_INDEXES__TABLE_ID, &len);
3433 if (memcmp(buf, field, len) != 0) {
3448 rec = btr_pcur_get_rec(&pcur);
3452 rec, DICT_FLD__SYS_INDEXES__PAGE_NO,
3453 root_page_no, &mtr);
3482 || DICT_TF2_FLAG_IS_SET(
3484 if (has_internal_doc_id) {
3489 fts_table.
id = new_id;
3492 trx, &fts_table, table->
name, TRUE);
3495 i < ib_vector_size(table->fts->
indexes)
3496 && err == DB_SUCCESS;
3502 ib_vector_getp(table->fts->
indexes, i));
3505 trx, fts_index, table->
name, new_id);
3508 if (err != DB_SUCCESS) {
3513 fputs(
" InnoDB: Unable to truncate FTS index for"
3516 fputs(
"\n", stderr);
3531 "PROCEDURE RENUMBER_TABLE_ID_PROC () IS\n"
3534 " SET ID = :new_id, SPACE = :new_space\n"
3535 " WHERE ID = :old_id;\n"
3536 "UPDATE SYS_COLUMNS SET TABLE_ID = :new_id\n"
3537 " WHERE TABLE_ID = :old_id;\n"
3538 "UPDATE SYS_INDEXES"
3539 " SET TABLE_ID = :new_id, SPACE = :new_space\n"
3540 " WHERE TABLE_ID = :old_id;\n"
3544 if (err == DB_SUCCESS && old_space != table->
space) {
3550 info,
"new_space", (lint) table->
space);
3553 "PROCEDURE RENUMBER_TABLESPACE_PROC () IS\n"
3555 "UPDATE SYS_TABLESPACES"
3556 " SET SPACE = :new_space\n"
3557 " WHERE SPACE = :old_space;\n"
3558 "UPDATE SYS_DATAFILES"
3559 " SET SPACE = :new_space"
3560 " WHERE SPACE = :old_space;\n"
3564 DBUG_EXECUTE_IF(
"ib_ddl_crash_before_fts_truncate", err = DB_ERROR;);
3566 if (err != DB_SUCCESS) {
3578 fputs(
" InnoDB: Unable to assign a new identifier to table ",
3582 "InnoDB: after truncating it. Background processes"
3583 " may corrupt the table!\n", stderr);
3587 if (has_internal_doc_id) {
3590 table_id_t
id = table->
id;
3604 if (has_internal_doc_id) {
3610 DBUG_EXECUTE_IF(
"ib_truncate_crash_after_fts_drop",
3616 if (has_internal_doc_id && table->fts->
cache) {
3669 char* filepath = NULL;
3670 const char* tablename_minus_db;
3671 char* tablename = NULL;
3672 bool ibd_file_missing;
3674 bool locked_dictionary =
false;
3680 if (srv_created_new_raw) {
3681 fputs(
"InnoDB: A new raw disk partition was initialized:\n"
3682 "InnoDB: we do not allow database modifications"
3684 "InnoDB: Shut down mysqld and edit my.cnf so that newraw"
3685 " is replaced with raw.\n", stderr);
3694 tablename_minus_db = strchr(name,
'/');
3696 if (tablename_minus_db) {
3697 tablename_minus_db++;
3700 tablename_minus_db =
name;
3703 namelen = strlen(tablename_minus_db) + 1;
3705 if (namelen ==
sizeof S_innodb_monitor
3706 && !memcmp(tablename_minus_db, S_innodb_monitor,
3707 sizeof S_innodb_monitor)) {
3712 srv_print_innodb_monitor = FALSE;
3713 srv_print_innodb_lock_monitor = FALSE;
3714 }
else if (namelen ==
sizeof S_innodb_lock_monitor
3715 && !memcmp(tablename_minus_db, S_innodb_lock_monitor,
3716 sizeof S_innodb_lock_monitor)) {
3717 srv_print_innodb_monitor = FALSE;
3718 srv_print_innodb_lock_monitor = FALSE;
3719 }
else if (namelen ==
sizeof S_innodb_tablespace_monitor
3720 && !memcmp(tablename_minus_db, S_innodb_tablespace_monitor,
3721 sizeof S_innodb_tablespace_monitor)) {
3723 srv_print_innodb_tablespace_monitor = FALSE;
3724 }
else if (namelen ==
sizeof S_innodb_table_monitor
3725 && !memcmp(tablename_minus_db, S_innodb_table_monitor,
3726 sizeof S_innodb_table_monitor)) {
3728 srv_print_innodb_table_monitor = FALSE;
3734 trx->
op_info =
"dropping table";
3737 if (trx->
state == TRX_STATE_NOT_STARTED) {
3745 row_mysql_lock_data_dictionary(trx);
3747 locked_dictionary =
true;
3752 #ifdef UNIV_SYNC_DEBUG
3758 static_cast<dict_err_ignore_t>(
3762 err = DB_TABLE_NOT_FOUND;
3765 fputs(
" InnoDB: Error: table ", stderr);
3767 fputs(
" does not exist in the InnoDB internal\n"
3768 "InnoDB: data dictionary though MySQL is"
3769 " trying to drop it.\n"
3770 "InnoDB: Have you copied the .frm file"
3771 " of the table to the\n"
3772 "InnoDB: MySQL database directory"
3773 " from another database?\n"
3774 "InnoDB: You can look for further help from\n"
3775 "InnoDB: " REFMAN
"innodb-troubleshooting.html\n",
3790 ut_ad(lock_trx_has_sys_table_locks(trx) == 0);
3794 row_mysql_lock_data_dictionary(trx);
3825 if (err != DB_SUCCESS) {
3826 ib_logf(IB_LOG_LEVEL_WARN,
"%s", errstr);
3854 FILE* ef = dict_foreign_err_file;
3861 mutex_enter(&dict_foreign_err_mutex);
3865 fputs(
" Cannot drop table ", ef);
3868 "because it is referenced by ", ef);
3871 mutex_exit(&dict_foreign_err_mutex);
3877 goto check_next_foreign;
3888 const char* save_tablename = table->
name;
3891 added = row_add_table_to_background_drop_list(save_tablename);
3895 fputs(
" InnoDB: You are trying to drop table ",
3899 "InnoDB: though there is a"
3900 " foreign key check running on it.\n"
3901 "InnoDB: Adding the table to"
3902 " the background drop queue.\n",
3937 added = row_add_table_to_background_drop_list(table->
name);
3941 fputs(
" InnoDB: Warning: MySQL is"
3942 " trying to drop table ", stderr);
3945 "InnoDB: though there are still"
3946 " open handles to it.\n"
3947 "InnoDB: Adding the table to the"
3948 " background drop queue.\n",
3984 ut_ad(strstr(table->
name,
"/FTS_") != NULL);
3996 page_no = page_nos =
static_cast<unsigned*
>(
4023 "PROCEDURE DROP_TABLE_PROC () IS\n"
4024 "sys_foreign_id CHAR;\n"
4027 "foreign_id CHAR;\n"
4031 "DECLARE CURSOR cur_fk IS\n"
4032 "SELECT ID FROM SYS_FOREIGN\n"
4033 "WHERE FOR_NAME = :table_name\n"
4034 "AND TO_BINARY(FOR_NAME)\n"
4035 " = TO_BINARY(:table_name)\n"
4036 "LOCK IN SHARE MODE;\n"
4038 "DECLARE CURSOR cur_idx IS\n"
4039 "SELECT ID FROM SYS_INDEXES\n"
4040 "WHERE TABLE_ID = table_id\n"
4041 "LOCK IN SHARE MODE;\n"
4044 "SELECT ID INTO table_id\n"
4046 "WHERE NAME = :table_name\n"
4047 "LOCK IN SHARE MODE;\n"
4048 "IF (SQL % NOTFOUND) THEN\n"
4051 "SELECT SPACE INTO space_id\n"
4053 "WHERE NAME = :table_name;\n"
4054 "IF (SQL % NOTFOUND) THEN\n"
4058 "SELECT ID INTO sys_foreign_id\n"
4060 "WHERE NAME = 'SYS_FOREIGN'\n"
4061 "LOCK IN SHARE MODE;\n"
4062 "IF (SQL % NOTFOUND) THEN\n"
4065 "IF (:table_name = 'SYS_FOREIGN') THEN\n"
4068 "IF (:table_name = 'SYS_FOREIGN_COLS') THEN\n"
4072 "WHILE found = 1 LOOP\n"
4073 " FETCH cur_fk INTO foreign_id;\n"
4074 " IF (SQL % NOTFOUND) THEN\n"
4077 " DELETE FROM SYS_FOREIGN_COLS\n"
4078 " WHERE ID = foreign_id;\n"
4079 " DELETE FROM SYS_FOREIGN\n"
4080 " WHERE ID = foreign_id;\n"
4086 "WHILE found = 1 LOOP\n"
4087 " FETCH cur_idx INTO index_id;\n"
4088 " IF (SQL % NOTFOUND) THEN\n"
4091 " DELETE FROM SYS_FIELDS\n"
4092 " WHERE INDEX_ID = index_id;\n"
4093 " DELETE FROM SYS_INDEXES\n"
4094 " WHERE ID = index_id\n"
4095 " AND TABLE_ID = table_id;\n"
4099 "DELETE FROM SYS_TABLESPACES\n"
4100 "WHERE SPACE = space_id;\n"
4101 "DELETE FROM SYS_DATAFILES\n"
4102 "WHERE SPACE = space_id;\n"
4103 "DELETE FROM SYS_COLUMNS\n"
4104 "WHERE TABLE_ID = table_id;\n"
4105 "DELETE FROM SYS_TABLES\n"
4106 "WHERE NAME = :table_name;\n"
4117 space_id = table->
space;
4155 if (err != DB_SUCCESS) {
4157 fprintf(stderr,
" InnoDB: Error: (%s) not "
4158 "able to remove ancillary FTS tables "
4161 fputs(
"\n", stderr);
4185 fputs(
" InnoDB: Error: not able to remove table ",
4188 fputs(
" from the dictionary cache!\n", stderr);
4197 print_msg = !(is_temp || ibd_file_missing);
4199 if (err == DB_SUCCESS && space_id > TRX_SYS_SPACE) {
4202 space_id, tablename, FALSE,
4203 print_msg,
false, NULL, 0)) {
4209 char msg_tablename[MAX_FULL_NAME_LEN + 1];
4212 msg_tablename,
sizeof(tablename),
4216 "Removed the table %s from "
4217 "InnoDB's data dictionary",
4231 "InnoDB: We removed now the InnoDB"
4232 " internal data dictionary entry\n"
4233 "InnoDB: of table ");
4235 fprintf(stderr,
".\n");
4239 " InnoDB: Error: not able to"
4240 " delete tablespace %lu of table ",
4243 fputs(
"!\n", stderr);
4250 case DB_OUT_OF_FILE_SPACE:
4270 fprintf(stderr,
"InnoDB: unknown error code %lu"
4271 " while dropping table:", (ulong) err);
4273 fprintf(stderr,
".\n");
4302 if (locked_dictionary) {
4328 trx->
op_info =
"dropping temporary tables";
4329 row_mysql_lock_data_dictionary(trx);
4355 rec = btr_pcur_get_rec(&pcur);
4356 field = rec_get_nth_field_old(
4357 rec, DICT_FLD__SYS_TABLES__NAME, &len);
4358 field = rec_get_nth_field_old(
4359 rec, DICT_FLD__SYS_TABLES__N_COLS, &len);
4369 field = rec_get_nth_field_old(
4370 rec, DICT_FLD__SYS_TABLES__MIX_LEN, &len);
4377 field = rec_get_nth_field_old(
4378 rec, DICT_FLD__SYS_TABLES__NAME, &len);
4379 if (len == UNIV_SQL_NULL || len == 0) {
4412 static __attribute__((nonnull, warn_unused_result))
4414 drop_all_foreign_keys_in_db(
4422 ut_a(name[strlen(name) - 1] ==
'/');
4429 #define TABLE_NOT_IN_THIS_DB \
4430 "SUBSTR(for_name, 0, LENGTH(:dbname)) <> :dbname"
4433 "PROCEDURE DROP_ALL_FOREIGN_KEYS_PROC () IS\n"
4434 "foreign_id CHAR;\n"
4437 "DECLARE CURSOR cur IS\n"
4438 "SELECT ID, FOR_NAME FROM SYS_FOREIGN\n"
4439 "WHERE FOR_NAME >= :dbname\n"
4440 "LOCK IN SHARE MODE\n"
4441 "ORDER BY FOR_NAME;\n"
4445 "WHILE found = 1 LOOP\n"
4446 " FETCH cur INTO foreign_id, for_name;\n"
4447 " IF (SQL % NOTFOUND) THEN\n"
4449 " ELSIF (" TABLE_NOT_IN_THIS_DB
") THEN\n"
4451 " ELSIF (1=1) THEN\n"
4452 " DELETE FROM SYS_FOREIGN_COLS\n"
4453 " WHERE ID = foreign_id;\n"
4454 " DELETE FROM SYS_FOREIGN\n"
4455 " WHERE ID = foreign_id;\n"
4481 ulint namelen = strlen(name);
4484 ut_a(name[namelen - 1] ==
'/');
4486 trx->
op_info =
"dropping database";
4490 trx_start_if_not_started_xa(trx);
4492 row_mysql_lock_data_dictionary(trx);
4495 ut_a(memcmp(table_name, name, namelen) == 0);
4498 table_name, TRUE, FALSE, static_cast<dict_err_ignore_t>(
4504 "Cannot load table %s from InnoDB internal "
4505 "data dictionary during drop database",
4508 err = DB_TABLE_NOT_FOUND;
4519 "Orphan table encountered during "
4520 "DROP DATABASE. This is possible if "
4521 "'%s.frm' was lost.", table->
name);
4526 "Missing %s.ibd file for table %s.",
4545 fputs(
" InnoDB: Warning: MySQL is trying to"
4546 " drop database ", stderr);
4549 "InnoDB: though there are still"
4550 " open handles to table ", stderr);
4552 fputs(
".\n", stderr);
4564 if (err != DB_SUCCESS) {
4565 fputs(
"InnoDB: DROP DATABASE ", stderr);
4567 fprintf(stderr,
" failed with error (%s) for table ",
4578 if (err == DB_SUCCESS) {
4581 err = drop_all_foreign_keys_in_db(name, trx);
4583 if (err != DB_SUCCESS) {
4584 fputs(
"InnoDB: DROP DATABASE ", stderr);
4586 fprintf(stderr,
" failed with error %d while "
4587 "dropping all foreign keys", err);
4604 UNIV_INTERN __attribute__((warn_unused_result))
4611 return(strstr(name,
"/#sql") != NULL);
4618 static __attribute__((nonnull, warn_unused_result))
4620 row_delete_constraint_low(
4630 "PROCEDURE DELETE_CONSTRAINT () IS\n"
4632 "DELETE FROM SYS_FOREIGN_COLS WHERE ID = :id;\n"
4633 "DELETE FROM SYS_FOREIGN WHERE ID = :id;\n"
4641 static __attribute__((nonnull, warn_unused_result))
4643 row_delete_constraint(
4646 const
char* database_name,
4654 err = row_delete_constraint_low(
4657 if ((err == DB_SUCCESS) && !strchr(
id,
'/')) {
4665 err = row_delete_constraint_low(
id, trx);
4678 const char* old_name,
4679 const char* new_name,
4684 ibool dict_locked = FALSE;
4687 const char** constraints_to_drop = NULL;
4688 ulint n_constraints_to_drop = 0;
4689 ibool old_is_tmp, new_is_tmp;
4693 ut_a(old_name != NULL);
4694 ut_a(new_name != NULL);
4698 fputs(
"InnoDB: A new raw disk partition was initialized or\n"
4699 "InnoDB: innodb_force_recovery is on: we do not allow\n"
4700 "InnoDB: database modifications by the user. Shut down\n"
4701 "InnoDB: mysqld and edit my.cnf so that newraw"
4703 "InnoDB: with raw, and innodb_force_... is removed.\n",
4707 }
else if (row_mysql_is_system_table(new_name)) {
4710 "InnoDB: Error: trying to create a MySQL"
4711 " system table %s of type InnoDB.\n"
4712 "InnoDB: MySQL system tables must be"
4713 " of the MyISAM type!\n",
4719 trx->
op_info =
"renaming table";
4730 err = DB_TABLE_NOT_FOUND;
4733 fputs(
" InnoDB: Error: table ", stderr);
4735 fputs(
" does not exist in the InnoDB internal\n"
4736 "InnoDB: data dictionary though MySQL is"
4737 " trying to rename the table.\n"
4738 "InnoDB: Have you copied the .frm file"
4739 " of the table to the\n"
4740 "InnoDB: MySQL database directory"
4741 " from another database?\n"
4742 "InnoDB: You can look for further help from\n"
4743 "InnoDB: " REFMAN
"innodb-troubleshooting.html\n",
4750 err = DB_TABLE_NOT_FOUND;
4753 "Table %s does not have an .ibd file in the database "
4754 "directory. See " REFMAN
"innodb-troubleshooting.html",
4759 }
else if (new_is_tmp) {
4769 heap, trx, table, &n_constraints_to_drop,
4770 &constraints_to_drop);
4772 if (err != DB_SUCCESS) {
4778 for (retry = 0; retry < 100
4782 row_mysql_lock_data_dictionary(trx);
4787 fputs(
" InnoDB: Error: in ALTER TABLE ", stderr);
4789 fprintf(stderr,
"\n"
4790 "InnoDB: a FOREIGN KEY check is running.\n"
4791 "InnoDB: Cannot rename table.\n");
4792 err = DB_TABLE_IN_FK_CHECK;
4805 "PROCEDURE RENAME_TABLE () IS\n"
4808 " SET NAME = :new_table_name\n"
4809 " WHERE NAME = :old_table_name;\n"
4815 if (err == DB_SUCCESS
4816 && table->
space != TRX_SYS_SPACE
4828 "PROCEDURE RENAME_SPACE () IS\n"
4830 "UPDATE SYS_TABLESPACES"
4831 " SET NAME = :new_table_name\n"
4832 " WHERE SPACE = :space_id;\n"
4833 "UPDATE SYS_DATAFILES"
4834 " SET PATH = :new_path_name\n"
4835 " WHERE SPACE = :space_id;\n"
4841 if (err != DB_SUCCESS) {
4852 innobase_convert_to_system_charset(
4853 strchr(old_table_utf8,
'/') + 1,
4854 strchr(old_name,
'/') +1,
4872 innobase_convert_to_system_charset(
4873 strchr(new_table_name,
'/') + 1,
4874 strchr(new_name,
'/') +1,
4888 "PROCEDURE RENAME_CONSTRAINT_IDS () IS\n"
4889 "gen_constr_prefix CHAR;\n"
4890 "new_db_name CHAR;\n"
4891 "foreign_id CHAR;\n"
4892 "new_foreign_id CHAR;\n"
4893 "old_db_name_len INT;\n"
4894 "old_t_name_len INT;\n"
4895 "new_db_name_len INT;\n"
4901 "old_db_name_len := INSTR(:old_table_name, '/')-1;\n"
4902 "new_db_name_len := INSTR(:new_table_name, '/')-1;\n"
4903 "new_db_name := SUBSTR(:new_table_name, 0,\n"
4904 " new_db_name_len);\n"
4905 "old_t_name_len := LENGTH(:old_table_name);\n"
4906 "gen_constr_prefix := CONCAT(:old_table_name_utf8,\n"
4908 "WHILE found = 1 LOOP\n"
4909 " SELECT ID INTO foreign_id\n"
4910 " FROM SYS_FOREIGN\n"
4911 " WHERE FOR_NAME = :old_table_name\n"
4912 " AND TO_BINARY(FOR_NAME)\n"
4913 " = TO_BINARY(:old_table_name)\n"
4914 " LOCK IN SHARE MODE;\n"
4915 " IF (SQL % NOTFOUND) THEN\n"
4918 " UPDATE SYS_FOREIGN\n"
4919 " SET FOR_NAME = :new_table_name\n"
4920 " WHERE ID = foreign_id;\n"
4921 " id_len := LENGTH(foreign_id);\n"
4922 " IF (INSTR(foreign_id, '/') > 0) THEN\n"
4923 " IF (INSTR(foreign_id,\n"
4924 " gen_constr_prefix) > 0)\n"
4926 " offset := INSTR(foreign_id, '_ibfk_') - 1;\n"
4927 " new_foreign_id :=\n"
4928 " CONCAT(:new_table_utf8,\n"
4929 " SUBSTR(foreign_id, offset,\n"
4930 " id_len - offset));\n"
4932 " new_foreign_id :=\n"
4933 " CONCAT(new_db_name,\n"
4934 " SUBSTR(foreign_id,\n"
4935 " old_db_name_len,\n"
4936 " id_len - old_db_name_len));\n"
4938 " UPDATE SYS_FOREIGN\n"
4939 " SET ID = new_foreign_id\n"
4940 " WHERE ID = foreign_id;\n"
4941 " UPDATE SYS_FOREIGN_COLS\n"
4942 " SET ID = new_foreign_id\n"
4943 " WHERE ID = foreign_id;\n"
4947 "UPDATE SYS_FOREIGN SET REF_NAME = :new_table_name\n"
4948 "WHERE REF_NAME = :old_table_name\n"
4949 " AND TO_BINARY(REF_NAME)\n"
4950 " = TO_BINARY(:old_table_name);\n"
4954 }
else if (n_constraints_to_drop > 0) {
4962 for (i = 0; i < n_constraints_to_drop; i++) {
4963 err = row_delete_constraint(constraints_to_drop[i],
4964 db_name, heap, trx);
4966 if (err != DB_SUCCESS) {
4976 if (err != DB_SUCCESS && (table->
space != 0)) {
4977 char* orig_name = table->
name;
4984 table->
name =
const_cast<char*
>(new_name);
4986 table->
name = orig_name;
4991 if (err != DB_SUCCESS) {
4992 if (err == DB_DUPLICATE_KEY) {
4994 fputs(
" InnoDB: Error; possible reasons:\n"
4995 "InnoDB: 1) Table rename would cause"
4996 " two FOREIGN KEY constraints\n"
4997 "InnoDB: to have the same internal name"
4998 " in case-insensitive comparison.\n"
4999 "InnoDB: 2) table ", stderr);
5001 fputs(
" exists in the InnoDB internal data\n"
5002 "InnoDB: dictionary though MySQL is"
5003 " trying to rename table ", stderr);
5006 "InnoDB: Have you deleted the .frm file"
5007 " and not used DROP TABLE?\n"
5008 "InnoDB: You can look for further help from\n"
5009 "InnoDB: " REFMAN
"innodb-troubleshooting.html\n"
5010 "InnoDB: If table ", stderr);
5012 fputs(
" is a temporary table #sql..., then"
5014 "InnoDB: there are still queries running"
5015 " on the table, and it will be\n"
5016 "InnoDB: dropped automatically when"
5017 " the queries end.\n"
5018 "InnoDB: You can drop the orphaned table"
5019 " inside InnoDB by\n"
5020 "InnoDB: creating an InnoDB table with"
5021 " the same name in another\n"
5022 "InnoDB: database and copying the .frm file"
5023 " to the current database.\n"
5024 "InnoDB: Then MySQL thinks the table exists,"
5025 " and DROP TABLE will\n"
5026 "InnoDB: succeed.\n", stderr);
5036 table, new_name, !new_is_tmp);
5037 if (err != DB_SUCCESS) {
5052 if (err != DB_SUCCESS) {
5056 fputs(
" InnoDB: Error: in ALTER TABLE ",
5060 "InnoDB: has or is referenced"
5061 " in foreign key constraints\n"
5062 "InnoDB: which are not compatible"
5063 " with the new table definition.\n",
5066 fputs(
" InnoDB: Error: in RENAME TABLE"
5071 "InnoDB: is referenced in"
5072 " foreign key constraints\n"
5073 "InnoDB: which are not compatible"
5074 " with the new table definition.\n",
5079 table, old_name, FALSE));
5087 if (table != NULL) {
5095 if (UNIV_LIKELY_NULL(heap)) {
5120 ulint matched_fields;
5121 ulint matched_bytes;
5127 ibool contains_null;
5132 ulint offsets_[REC_OFFS_NORMAL_SIZE];
5134 rec_offs_init(offsets_);
5147 || (index->
type & DICT_FTS)) {
5154 buf =
static_cast<byte*
>(mem_alloc(UNIV_PAGE_SIZE));
5174 fputs(
" InnoDB: Warning: CHECK TABLE on ", stderr);
5176 fprintf(stderr,
" returned %lu\n", ret);
5178 case DB_END_OF_INDEX:
5186 *n_rows = *n_rows + 1;
5194 offsets = rec_get_offsets(rec, index, offsets_,
5195 ULINT_UNDEFINED, &heap);
5197 if (prev_entry != NULL) {
5201 cmp = cmp_dtuple_rec_with_match(prev_entry, rec, offsets,
5204 contains_null = FALSE;
5213 dtuple_get_nth_field(prev_entry, i))) {
5215 contains_null = TRUE;
5221 fputs(
"InnoDB: index records in a wrong order in ",
5225 prebuilt->
trx, index);
5227 "InnoDB: prev record ", stderr);
5230 "InnoDB: record ", stderr);
5240 fputs(
"InnoDB: duplicate key in ", stderr);
5251 if (UNIV_UNLIKELY(offsets != offsets_)) {
5257 offsets =
static_cast<ulint*
>(
5264 rec, index, offsets, &n_ext, heap);
5266 if (UNIV_LIKELY_NULL(tmp_heap)) {
5283 const char* table_name)
5290 len = strlen(name) + 1;
5292 return(
STR_EQ(name, len, S_innodb_monitor)
5293 ||
STR_EQ(name, len, S_innodb_lock_monitor)
5294 ||
STR_EQ(name, len, S_innodb_tablespace_monitor)
5295 ||
STR_EQ(name, len, S_innodb_table_monitor)
5296 #ifdef UNIV_MEM_DEBUG
5297 ||
STR_EQ(name, len, S_innodb_mem_validate)
5310 row_drop_list_mutex_key,
5311 &row_drop_list_mutex, SYNC_NO_ORDER_CHECK);
5315 row_mysql_drop_list_inited = TRUE;
5327 mutex_free(&row_drop_list_mutex);
5329 row_mysql_drop_list_inited = FALSE;