Commit 7f8cb7aa authored by marko's avatar marko

branches/zip: Merge revisions 583:634 from trunk.

parent af445f4b
......@@ -77,7 +77,7 @@ EXTRA_DIST = include/btr0btr.h include/btr0btr.ic include/btr0cur.h include/btr
include/ut0byte.h include/ut0byte.ic include/ut0dbg.h include/ut0lst.h \
include/ut0mem.h include/ut0mem.ic include/ut0rnd.h include/ut0rnd.ic \
include/ut0sort.h include/ut0ut.h include/ut0ut.ic include/ut0vec.h include/ut0vec.ic include/ha_prototypes.h \
cmakelists.txt
CMakeLists.txt
noinst_LIBRARIES = libinnobase.a
libinnobase_a_LIBADD = usr/libusr.a srv/libsrv.a dict/libdict.a \
......
......@@ -618,9 +618,9 @@ btr_page_get_father_for_rec(
buf_page_print(buf_frame_align(node_ptr), 0);
fputs("InnoDB: Corruption of an index tree: table ", stderr);
ut_print_name(stderr, NULL, index->table_name);
ut_print_name(stderr, NULL, TRUE, index->table_name);
fputs(", index ", stderr);
ut_print_name(stderr, NULL, index->name);
ut_print_name(stderr, NULL, FALSE, index->name);
fprintf(stderr, ",\n"
"InnoDB: father ptr page no %lu, child page no %lu\n",
(ulong)
......
......@@ -488,7 +488,7 @@ btr_cur_search_to_nth_level(
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
return;
goto func_exit;
}
/* Insert to the insert buffer did not succeed:
......@@ -626,6 +626,7 @@ btr_cur_search_to_nth_level(
|| mode != PAGE_CUR_LE);
}
func_exit:
if (has_search_latch) {
rw_lock_s_lock(&btr_search_latch);
......
......@@ -293,3 +293,36 @@ dtype_print(
fprintf(stderr, " len %lu prec %lu", (ulong) len, (ulong) type->prec);
}
/***************************************************************************
Returns the maximum size of a data type. Note: types in system tables may be
incomplete and return incorrect information. */
ulint
dtype_get_max_size(
/*===============*/
/* out: maximum size (ULINT_MAX for
unbounded types) */
const dtype_t* type) /* in: type */
{
switch (type->mtype) {
case DATA_SYS:
case DATA_CHAR:
case DATA_FIXBINARY:
case DATA_INT:
case DATA_FLOAT:
case DATA_DOUBLE:
case DATA_MYSQL:
case DATA_VARCHAR:
case DATA_BINARY:
case DATA_DECIMAL:
case DATA_VARMYSQL:
return(type->len);
case DATA_BLOB:
return(ULINT_MAX);
default:
ut_error;
}
return(ULINT_MAX);
}
......@@ -1212,7 +1212,7 @@ dict_create_or_check_foreign_constraint_tables(void)
"CREATE UNIQUE CLUSTERED INDEX ID_IND ON SYS_FOREIGN_COLS (ID, POS);\n"
"COMMIT WORK;\n"
"END;\n"
, trx);
, FALSE, trx);
if (error != DB_SUCCESS) {
fprintf(stderr, "InnoDB: error %lu in creation\n",
......@@ -1261,7 +1261,7 @@ dict_foreign_eval_sql(
ulint error;
FILE* ef = dict_foreign_err_file;
error = que_eval_sql(info, sql, trx);
error = que_eval_sql(info, sql, FALSE, trx);
if (error == DB_DUPLICATE_KEY) {
mutex_enter(&dict_foreign_err_mutex);
......@@ -1269,9 +1269,9 @@ dict_foreign_eval_sql(
ut_print_timestamp(ef);
fputs(" Error in foreign key constraint creation for table ",
ef);
ut_print_name(ef, trx, table->name);
ut_print_name(ef, trx, TRUE, table->name);
fputs(".\nA foreign key constraint of name ", ef);
ut_print_name(ef, trx, foreign->id);
ut_print_name(ef, trx, FALSE, foreign->id);
fputs("\nalready exists."
" (Note that internally InnoDB adds 'databasename/'\n"
"in front of the user-defined constraint name).\n",
......@@ -1299,7 +1299,7 @@ dict_foreign_eval_sql(
ut_print_timestamp(ef);
fputs(" Internal error in foreign key constraint creation"
" for table ", ef);
ut_print_name(ef, trx, table->name);
ut_print_name(ef, trx, TRUE, table->name);
fputs(".\n"
"See the MySQL .err log in the datadir for more information.\n", ef);
mutex_exit(&dict_foreign_err_mutex);
......
This diff is collapsed.
......@@ -184,7 +184,7 @@ dict_print(void)
if (table == NULL) {
fputs("InnoDB: Failed to load table ", stderr);
ut_print_namel(stderr, NULL, (char*) field, len);
ut_print_namel(stderr, NULL, TRUE, (char*) field, len);
putc('\n', stderr);
} else {
/* The table definition was corrupt if there
......
......@@ -81,6 +81,8 @@ dict_mem_table_create(
table->stat_modified_counter = 0;
table->max_row_size = 0;
mutex_create(&table->autoinc_mutex, SYNC_DICT_AUTOINC_MUTEX);
table->autoinc_inited = FALSE;
......
This diff is collapsed.
......@@ -33,6 +33,8 @@ typedef struct st_innobase_share {
} INNOBASE_SHARE;
struct row_prebuilt_struct;
my_bool innobase_query_caching_of_table_permitted(THD* thd, char* full_name,
uint full_name_len,
ulonglong *unused);
......@@ -89,7 +91,7 @@ class ha_innobase: public handler
const char* table_type() const { return("InnoDB");}
const char *index_type(uint key_number) { return "BTREE"; }
const char** bas_ext() const;
ulong table_flags() const { return int_table_flags; }
ulonglong table_flags() const { return int_table_flags; }
ulong index_flags(uint idx, uint part, bool all_parts) const
{
return (HA_READ_NEXT |
......@@ -109,7 +111,6 @@ class ha_innobase: public handler
uint max_supported_key_length() const { return 3500; }
uint max_supported_key_part_length() const;
const key_map *keys_to_use_for_scanning() { return &key_map_full; }
bool has_transactions() { return 1;}
int open(const char *name, int mode, uint test_if_locked);
int close(void);
......@@ -147,20 +148,10 @@ class ha_innobase: public handler
int optimize(THD* thd,HA_CHECK_OPT* check_opt);
int discard_or_import_tablespace(my_bool discard);
int extra(enum ha_extra_function operation);
int reset();
int external_lock(THD *thd, int lock_type);
int transactional_table_lock(THD *thd, int lock_type);
int start_stmt(THD *thd, thr_lock_type lock_type);
int ha_retrieve_all_cols()
{
ha_set_all_bits_in_read_set();
return extra(HA_EXTRA_RETRIEVE_ALL_COLS);
}
int ha_retrieve_all_pk()
{
ha_set_primary_key_in_read_set();
return extra(HA_EXTRA_RETRIEVE_PRIMARY_KEY);
}
void position(byte *record);
ha_rows records_in_range(uint inx, key_range *min_key, key_range
*max_key);
......@@ -181,7 +172,10 @@ class ha_innobase: public handler
THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to,
enum thr_lock_type lock_type);
void init_table_handle_for_HANDLER();
ulonglong get_auto_increment();
virtual void get_auto_increment(ulonglong offset, ulonglong increment,
ulonglong nb_desired_values,
ulonglong *first_value,
ulonglong *nb_reserved_values);
int reset_auto_increment(ulonglong value);
virtual bool get_error_message(int error, String *buf);
......@@ -207,6 +201,8 @@ class ha_innobase: public handler
int cmp_ref(const byte *ref1, const byte *ref2);
bool check_if_incompatible_data(HA_CREATE_INFO *info,
uint table_changes);
void build_template(struct row_prebuilt_struct *prebuilt, THD *thd,
TABLE *table, uint templ_type);
};
extern SHOW_VAR innodb_status_variables[];
......@@ -249,7 +245,7 @@ extern ulong srv_thread_concurrency;
extern ulong srv_commit_concurrency;
}
bool innobase_init(void);
int innobase_init(void);
int innobase_end(ha_panic_function type);
bool innobase_flush_logs(void);
uint innobase_get_free_space(void);
......
......@@ -330,6 +330,16 @@ dtype_get_min_size(
/* out: minimum size */
const dtype_t* type); /* in: type */
/***************************************************************************
Returns the maximum size of a data type. Note: types in system tables may be
incomplete and return incorrect information. */
ulint
dtype_get_max_size(
/*===============*/
/* out: maximum size (ULINT_MAX for
unbounded types) */
const dtype_t* type); /* in: type */
/***************************************************************************
Returns a stored SQL NULL size for a type. For fixed length types it is
the fixed length of the type, otherwise 0. */
UNIV_INLINE
......
......@@ -44,18 +44,15 @@ dict_get_db_name_len(
/* out: database name length */
const char* name); /* in: table name in the form
dbname '/' tablename */
/*************************************************************************
Accepts a specified string. Comparisons are case-insensitive. */
/************************************************************************
Return the end of table name where we have removed dbname and '/'. */
const char*
dict_accept(
/*========*/
/* out: if string was accepted, the pointer
is moved after that, else ptr is returned */
const char* ptr, /* in: scan from this */
const char* string, /* in: accept only this string as the next
non-whitespace string */
ibool* success);/* out: TRUE if accepted */
dict_remove_db_name(
/*================*/
/* out: table name */
const char* name); /* in: table name in the form
dbname '/' tablename */
/************************************************************************
Decrements the count of open MySQL handles to a table. */
......@@ -226,6 +223,17 @@ dict_table_referenced_by_foreign_key(
/* out: TRUE if table is referenced by a
foreign key */
dict_table_t* table); /* in: InnoDB table */
/**************************************************************************
Determines whether a string starts with the specified keyword. */
ibool
dict_str_starts_with_keyword(
/*=========================*/
/* out: TRUE if str starts
with keyword */
void* mysql_thd, /* in: MySQL thread handle */
const char* str, /* in: string to scan for keyword */
const char* keyword); /* in: keyword to look for */
/*************************************************************************
Scans a table create SQL string and adds to the data dictionary
the foreign key constraints declared in the string. This function
......
......@@ -344,6 +344,12 @@ struct dict_table_struct{
had an IX lock on */
UT_LIST_BASE_NODE_T(lock_t)
locks; /* list of locks on the table */
ulint max_row_size;
/* maximum size of a single row in the
table, not guaranteed to be especially
accurate. it's ULINT_MAX if there are
unbounded variable-width fields. initialized
in dict_table_add_to_cache. */
/*----------------------*/
ibool does_not_fit_in_memory;
/* this field is used to specify in simulations
......
......@@ -69,57 +69,59 @@
PARS_WHERE_TOKEN = 295,
PARS_FOR_TOKEN = 296,
PARS_DDOT_TOKEN = 297,
PARS_CONSISTENT_TOKEN = 298,
PARS_READ_TOKEN = 299,
PARS_ORDER_TOKEN = 300,
PARS_BY_TOKEN = 301,
PARS_ASC_TOKEN = 302,
PARS_DESC_TOKEN = 303,
PARS_INSERT_TOKEN = 304,
PARS_INTO_TOKEN = 305,
PARS_VALUES_TOKEN = 306,
PARS_UPDATE_TOKEN = 307,
PARS_SET_TOKEN = 308,
PARS_DELETE_TOKEN = 309,
PARS_CURRENT_TOKEN = 310,
PARS_OF_TOKEN = 311,
PARS_CREATE_TOKEN = 312,
PARS_TABLE_TOKEN = 313,
PARS_INDEX_TOKEN = 314,
PARS_UNIQUE_TOKEN = 315,
PARS_CLUSTERED_TOKEN = 316,
PARS_DOES_NOT_FIT_IN_MEM_TOKEN = 317,
PARS_ON_TOKEN = 318,
PARS_ASSIGN_TOKEN = 319,
PARS_DECLARE_TOKEN = 320,
PARS_CURSOR_TOKEN = 321,
PARS_SQL_TOKEN = 322,
PARS_OPEN_TOKEN = 323,
PARS_FETCH_TOKEN = 324,
PARS_CLOSE_TOKEN = 325,
PARS_NOTFOUND_TOKEN = 326,
PARS_TO_CHAR_TOKEN = 327,
PARS_TO_NUMBER_TOKEN = 328,
PARS_TO_BINARY_TOKEN = 329,
PARS_BINARY_TO_NUMBER_TOKEN = 330,
PARS_SUBSTR_TOKEN = 331,
PARS_REPLSTR_TOKEN = 332,
PARS_CONCAT_TOKEN = 333,
PARS_INSTR_TOKEN = 334,
PARS_LENGTH_TOKEN = 335,
PARS_SYSDATE_TOKEN = 336,
PARS_PRINTF_TOKEN = 337,
PARS_ASSERT_TOKEN = 338,
PARS_RND_TOKEN = 339,
PARS_RND_STR_TOKEN = 340,
PARS_ROW_PRINTF_TOKEN = 341,
PARS_COMMIT_TOKEN = 342,
PARS_ROLLBACK_TOKEN = 343,
PARS_WORK_TOKEN = 344,
PARS_UNSIGNED_TOKEN = 345,
PARS_EXIT_TOKEN = 346,
PARS_FUNCTION_TOKEN = 347,
NEG = 348
PARS_READ_TOKEN = 298,
PARS_ORDER_TOKEN = 299,
PARS_BY_TOKEN = 300,
PARS_ASC_TOKEN = 301,
PARS_DESC_TOKEN = 302,
PARS_INSERT_TOKEN = 303,
PARS_INTO_TOKEN = 304,
PARS_VALUES_TOKEN = 305,
PARS_UPDATE_TOKEN = 306,
PARS_SET_TOKEN = 307,
PARS_DELETE_TOKEN = 308,
PARS_CURRENT_TOKEN = 309,
PARS_OF_TOKEN = 310,
PARS_CREATE_TOKEN = 311,
PARS_TABLE_TOKEN = 312,
PARS_INDEX_TOKEN = 313,
PARS_UNIQUE_TOKEN = 314,
PARS_CLUSTERED_TOKEN = 315,
PARS_DOES_NOT_FIT_IN_MEM_TOKEN = 316,
PARS_ON_TOKEN = 317,
PARS_ASSIGN_TOKEN = 318,
PARS_DECLARE_TOKEN = 319,
PARS_CURSOR_TOKEN = 320,
PARS_SQL_TOKEN = 321,
PARS_OPEN_TOKEN = 322,
PARS_FETCH_TOKEN = 323,
PARS_CLOSE_TOKEN = 324,
PARS_NOTFOUND_TOKEN = 325,
PARS_TO_CHAR_TOKEN = 326,
PARS_TO_NUMBER_TOKEN = 327,
PARS_TO_BINARY_TOKEN = 328,
PARS_BINARY_TO_NUMBER_TOKEN = 329,
PARS_SUBSTR_TOKEN = 330,
PARS_REPLSTR_TOKEN = 331,
PARS_CONCAT_TOKEN = 332,
PARS_INSTR_TOKEN = 333,
PARS_LENGTH_TOKEN = 334,
PARS_SYSDATE_TOKEN = 335,
PARS_PRINTF_TOKEN = 336,
PARS_ASSERT_TOKEN = 337,
PARS_RND_TOKEN = 338,
PARS_RND_STR_TOKEN = 339,
PARS_ROW_PRINTF_TOKEN = 340,
PARS_COMMIT_TOKEN = 341,
PARS_ROLLBACK_TOKEN = 342,
PARS_WORK_TOKEN = 343,
PARS_UNSIGNED_TOKEN = 344,
PARS_EXIT_TOKEN = 345,
PARS_FUNCTION_TOKEN = 346,
PARS_LOCK_TOKEN = 347,
PARS_SHARE_TOKEN = 348,
PARS_MODE_TOKEN = 349,
NEG = 350
};
#endif
#define PARS_INT_LIT 258
......@@ -162,57 +164,59 @@
#define PARS_WHERE_TOKEN 295
#define PARS_FOR_TOKEN 296
#define PARS_DDOT_TOKEN 297
#define PARS_CONSISTENT_TOKEN 298
#define PARS_READ_TOKEN 299
#define PARS_ORDER_TOKEN 300
#define PARS_BY_TOKEN 301
#define PARS_ASC_TOKEN 302
#define PARS_DESC_TOKEN 303
#define PARS_INSERT_TOKEN 304
#define PARS_INTO_TOKEN 305
#define PARS_VALUES_TOKEN 306
#define PARS_UPDATE_TOKEN 307
#define PARS_SET_TOKEN 308
#define PARS_DELETE_TOKEN 309
#define PARS_CURRENT_TOKEN 310
#define PARS_OF_TOKEN 311
#define PARS_CREATE_TOKEN 312
#define PARS_TABLE_TOKEN 313
#define PARS_INDEX_TOKEN 314
#define PARS_UNIQUE_TOKEN 315
#define PARS_CLUSTERED_TOKEN 316
#define PARS_DOES_NOT_FIT_IN_MEM_TOKEN 317
#define PARS_ON_TOKEN 318
#define PARS_ASSIGN_TOKEN 319
#define PARS_DECLARE_TOKEN 320
#define PARS_CURSOR_TOKEN 321
#define PARS_SQL_TOKEN 322
#define PARS_OPEN_TOKEN 323
#define PARS_FETCH_TOKEN 324
#define PARS_CLOSE_TOKEN 325
#define PARS_NOTFOUND_TOKEN 326
#define PARS_TO_CHAR_TOKEN 327
#define PARS_TO_NUMBER_TOKEN 328
#define PARS_TO_BINARY_TOKEN 329
#define PARS_BINARY_TO_NUMBER_TOKEN 330
#define PARS_SUBSTR_TOKEN 331
#define PARS_REPLSTR_TOKEN 332
#define PARS_CONCAT_TOKEN 333
#define PARS_INSTR_TOKEN 334
#define PARS_LENGTH_TOKEN 335
#define PARS_SYSDATE_TOKEN 336
#define PARS_PRINTF_TOKEN 337
#define PARS_ASSERT_TOKEN 338
#define PARS_RND_TOKEN 339
#define PARS_RND_STR_TOKEN 340
#define PARS_ROW_PRINTF_TOKEN 341
#define PARS_COMMIT_TOKEN 342
#define PARS_ROLLBACK_TOKEN 343
#define PARS_WORK_TOKEN 344
#define PARS_UNSIGNED_TOKEN 345
#define PARS_EXIT_TOKEN 346
#define PARS_FUNCTION_TOKEN 347
#define NEG 348
#define PARS_READ_TOKEN 298
#define PARS_ORDER_TOKEN 299
#define PARS_BY_TOKEN 300
#define PARS_ASC_TOKEN 301
#define PARS_DESC_TOKEN 302
#define PARS_INSERT_TOKEN 303
#define PARS_INTO_TOKEN 304
#define PARS_VALUES_TOKEN 305
#define PARS_UPDATE_TOKEN 306
#define PARS_SET_TOKEN 307
#define PARS_DELETE_TOKEN 308
#define PARS_CURRENT_TOKEN 309
#define PARS_OF_TOKEN 310
#define PARS_CREATE_TOKEN 311
#define PARS_TABLE_TOKEN 312
#define PARS_INDEX_TOKEN 313
#define PARS_UNIQUE_TOKEN 314
#define PARS_CLUSTERED_TOKEN 315
#define PARS_DOES_NOT_FIT_IN_MEM_TOKEN 316
#define PARS_ON_TOKEN 317
#define PARS_ASSIGN_TOKEN 318
#define PARS_DECLARE_TOKEN 319
#define PARS_CURSOR_TOKEN 320
#define PARS_SQL_TOKEN 321
#define PARS_OPEN_TOKEN 322
#define PARS_FETCH_TOKEN 323
#define PARS_CLOSE_TOKEN 324
#define PARS_NOTFOUND_TOKEN 325
#define PARS_TO_CHAR_TOKEN 326
#define PARS_TO_NUMBER_TOKEN 327
#define PARS_TO_BINARY_TOKEN 328
#define PARS_BINARY_TO_NUMBER_TOKEN 329
#define PARS_SUBSTR_TOKEN 330
#define PARS_REPLSTR_TOKEN 331
#define PARS_CONCAT_TOKEN 332
#define PARS_INSTR_TOKEN 333
#define PARS_LENGTH_TOKEN 334
#define PARS_SYSDATE_TOKEN 335
#define PARS_PRINTF_TOKEN 336
#define PARS_ASSERT_TOKEN 337
#define PARS_RND_TOKEN 338
#define PARS_RND_STR_TOKEN 339
#define PARS_ROW_PRINTF_TOKEN 340
#define PARS_COMMIT_TOKEN 341
#define PARS_ROLLBACK_TOKEN 342
#define PARS_WORK_TOKEN 343
#define PARS_UNSIGNED_TOKEN 344
#define PARS_EXIT_TOKEN 345
#define PARS_FUNCTION_TOKEN 346
#define PARS_LOCK_TOKEN 347
#define PARS_SHARE_TOKEN 348
#define PARS_MODE_TOKEN 349
#define NEG 350
......
......@@ -63,7 +63,7 @@ extern pars_res_word_t pars_asc_token;
extern pars_res_word_t pars_desc_token;
extern pars_res_word_t pars_open_token;
extern pars_res_word_t pars_close_token;
extern pars_res_word_t pars_consistent_token;
extern pars_res_word_t pars_share_token;
extern pars_res_word_t pars_unique_token;
extern pars_res_word_t pars_clustered_token;
......
......@@ -143,14 +143,12 @@ que_thr_stop_for_mysql(
/*===================*/
que_thr_t* thr); /* in: query thread */
/**************************************************************************
Runs query threads. Note that the individual query thread which is run
within this function may change if, e.g., the OS thread executing this
function uses a threshold amount of resources. */
Run a query thread. Handles lock waits. */
void
que_run_threads(
/*============*/
que_thr_t* thr); /* in: query thread which is run initially */
que_thr_t* thr); /* in: query thread */
/**************************************************************************
After signal handling is finished, returns control to a query graph error
handling routine. (Currently, just returns the control to the root of the
......@@ -163,19 +161,6 @@ que_fork_error_handle(
que_t* fork); /* in: query graph which was run before signal
handling started, NULL not allowed */
/**************************************************************************
Handles an SQL error noticed during query thread execution. At the moment,
does nothing! */
void
que_thr_handle_error(
/*=================*/
que_thr_t* thr, /* in: query thread */
ulint err_no, /* in: error number */
byte* err_str,/* in, own: error string or NULL; NOTE: the
function will take care of freeing of the
string! */
ulint err_len);/* in: error string length */
/**************************************************************************
Moves a suspended query thread to the QUE_THR_RUNNING state and releases
a single worker thread to execute it. This function should be used to end
the wait state of a query thread waiting for a lock or a stored procedure
......@@ -337,9 +322,14 @@ Evaluate the given SQL */
ulint
que_eval_sql(
/*=========*/
pars_info_t* info, /* out: error code or DB_SUCCESS */
const char* sql, /* in: info struct, or NULL */
/* out: error code or DB_SUCCESS */
pars_info_t* info, /* in: info struct, or NULL */
const char* sql, /* in: SQL string */
ibool reserve_dict_mutex,
/* in: if TRUE, acquire/release
dict_sys->mutex around call to pars_sql. */
trx_t* trx); /* in: trx */
/* Query graph query thread node: the fields are protected by the kernel
mutex with the exceptions named below */
......
......@@ -18,6 +18,9 @@ Created 10/10/1995 Heikki Tuuri
extern const char* srv_main_thread_op_info;
/* Prefix used by MySQL to indicate pre-5.1 table name encoding */
extern const char srv_mysql50_table_name_prefix[9];
/* When this event is set the lock timeout and InnoDB monitor
thread starts running */
extern os_event_t srv_lock_timeout_thread_event;
......
......@@ -362,7 +362,7 @@ rw_lock_s_unlock_func(
/* Reset the shared lock by decrementing the reader count */
ut_ad(lock->reader_count > 0);
ut_a(lock->reader_count > 0);
lock->reader_count--;
#ifdef UNIV_SYNC_DEBUG
......
......@@ -266,11 +266,9 @@ trx_end_lock_wait(
/********************************************************************
Sends a signal to a trx object. */
ibool
void
trx_sig_send(
/*=========*/
/* out: TRUE if the signal was
successfully delivered */
trx_t* trx, /* in: trx handle */
ulint type, /* in: signal type */
ulint sender, /* in: TRX_SIG_SELF or
......
......@@ -222,16 +222,19 @@ ut_print_filename(
FILE* f, /* in: output stream */
const char* name); /* in: name to print */
/* Forward declaration of transaction handle */
struct trx_struct;
/**************************************************************************
Outputs a NUL-terminated string, quoted as an SQL identifier. */
struct trx_struct;
void
ut_print_name(
/*==========*/
FILE* f, /* in: output stream */
struct trx_struct*trx, /* in: transaction */
ibool table_id,/* in: TRUE=print a table name,
FALSE=print other identifier */
const char* name); /* in: name to print */
/**************************************************************************
......@@ -242,6 +245,8 @@ ut_print_namel(
/*===========*/
FILE* f, /* in: output stream */
struct trx_struct*trx, /* in: transaction (NULL=no quotes) */
ibool table_id,/* in: TRUE=print a table name,
FALSE=print other identifier */
const char* name, /* in: name to print */
ulint namelen);/* in: length of name */
......
......@@ -1863,7 +1863,7 @@ lock_rec_enqueue_waiting(
fputs(
" InnoDB: Error: a record lock wait happens in a dictionary operation!\n"
"InnoDB: Table name ", stderr);
ut_print_name(stderr, trx, index->table_name);
ut_print_name(stderr, trx, TRUE, index->table_name);
fputs(".\n"
"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n",
stderr);
......@@ -1908,7 +1908,7 @@ lock_rec_enqueue_waiting(
if (lock_print_waits) {
fprintf(stderr, "Lock wait for trx %lu in index ",
(ulong) ut_dulint_get_low(trx->id));
ut_print_name(stderr, trx, index->name);
ut_print_name(stderr, trx, FALSE, index->name);
}
#endif /* UNIV_DEBUG */
......@@ -3635,7 +3635,7 @@ lock_table_enqueue_waiting(
fputs(
" InnoDB: Error: a table lock wait happens in a dictionary operation!\n"
"InnoDB: Table name ", stderr);
ut_print_name(stderr, trx, table->name);
ut_print_name(stderr, trx, TRUE, table->name);
fputs(".\n"
"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n",
stderr);
......@@ -4158,7 +4158,8 @@ lock_table_print(
ut_a(lock_get_type(lock) == LOCK_TABLE);
fputs("TABLE LOCK table ", file);
ut_print_name(file, lock->trx, lock->un_member.tab_lock.table->name);
ut_print_name(file, lock->trx, TRUE,
lock->un_member.tab_lock.table->name);
fprintf(file, " trx id %lu %lu",
(ulong) (lock->trx)->id.high, (ulong) (lock->trx)->id.low);
......
......@@ -1370,9 +1370,9 @@ insert into `t2`values ( 1 ) ;
create table `t3` (`id` int( 11 ) not null default '0',key `id` ( `id` ) ,constraint `t2_id_fk` foreign key ( `id` ) references `t2` (`id` )) engine = innodb;
insert into `t3`values ( 1 ) ;
delete t3,t2,t1 from t1,t2,t3 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`))
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`))
update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`))
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`))
update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
ERROR 42S22: Unknown column 't1.id' in 'where clause'
drop table t3,t2,t1;
......@@ -1384,7 +1384,7 @@ foreign key(pid) references t1(id) on delete cascade) engine=innodb;
insert into t1 values(0,0),(1,0),(2,1),(3,2),(4,3),(5,4),(6,5),(7,6),
(8,7),(9,8),(10,9),(11,10),(12,11),(13,12),(14,13),(15,14);
delete from t1 where id=0;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`pid`) REFERENCES `t1` (`id`) ON DELETE CASCADE)
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`pid`) REFERENCES `t1` (`id`) ON DELETE CASCADE)
delete from t1 where id=15;
delete from t1 where id=0;
drop table t1;
......@@ -2610,18 +2610,18 @@ v INT,
CONSTRAINT c1 FOREIGN KEY (v) REFERENCES t1(id)
) ENGINE=InnoDB;
INSERT INTO t2 VALUES(2);
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
INSERT INTO t1 VALUES(1);
INSERT INTO t2 VALUES(1);
DELETE FROM t1 WHERE id = 1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
DROP TABLE t1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
SET FOREIGN_KEY_CHECKS=0;
DROP TABLE t1;
SET FOREIGN_KEY_CHECKS=1;
INSERT INTO t2 VALUES(3);
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
DROP TABLE t2;
create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
insert into t1 values (1),(2);
......@@ -2899,23 +2899,23 @@ create table t4(a int primary key,constraint foreign key(a)references t3(a)) row
insert into t1 values(1);
insert into t3 values(1);
insert into t2 values(2);
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
insert into t4 values(2);
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
insert into t2 values(1);
insert into t4 values(1);
update t1 set a=2;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
update t2 set a=2;
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
update t3 set a=2;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
update t4 set a=2;
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
truncate t1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
truncate t3;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
truncate t2;
truncate t4;
truncate t1;
......@@ -2970,7 +2970,7 @@ create table t1 (a int primary key,s1 varbinary(3) not null unique) engine=innod
create table t2 (s1 binary(2) not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb;
insert into t1 values(1,0x4100),(2,0x41),(3,0x4120),(4,0x42);
insert into t2 values(0x42);
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
insert into t2 values(0x41);
select hex(s1) from t2;
hex(s1)
......@@ -2980,11 +2980,11 @@ select hex(s1) from t2;
hex(s1)
4100
update t1 set s1=0x12 where a=1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
update t1 set s1=0x12345678 where a=1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
update t1 set s1=0x123457 where a=1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
update t1 set s1=0x1220 where a=1;
select hex(s1) from t2;
hex(s1)
......@@ -2998,11 +2998,11 @@ select hex(s1) from t2;
hex(s1)
4200
delete from t1 where a=1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
delete from t1 where a=2;
update t2 set s1=0x4120;
delete from t1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
delete from t1 where a!=3;
select a,hex(s1) from t1;
a hex(s1)
......@@ -3028,7 +3028,7 @@ hex(s1)
12
delete from t1 where a=1;
delete from t1 where a=2;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
select a,hex(s1) from t1;
a hex(s1)
2 12
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -69,57 +69,59 @@
PARS_WHERE_TOKEN = 295,
PARS_FOR_TOKEN = 296,
PARS_DDOT_TOKEN = 297,
PARS_CONSISTENT_TOKEN = 298,
PARS_READ_TOKEN = 299,
PARS_ORDER_TOKEN = 300,
PARS_BY_TOKEN = 301,
PARS_ASC_TOKEN = 302,
PARS_DESC_TOKEN = 303,
PARS_INSERT_TOKEN = 304,
PARS_INTO_TOKEN = 305,
PARS_VALUES_TOKEN = 306,
PARS_UPDATE_TOKEN = 307,
PARS_SET_TOKEN = 308,
PARS_DELETE_TOKEN = 309,
PARS_CURRENT_TOKEN = 310,
PARS_OF_TOKEN = 311,
PARS_CREATE_TOKEN = 312,
PARS_TABLE_TOKEN = 313,
PARS_INDEX_TOKEN = 314,
PARS_UNIQUE_TOKEN = 315,
PARS_CLUSTERED_TOKEN = 316,
PARS_DOES_NOT_FIT_IN_MEM_TOKEN = 317,
PARS_ON_TOKEN = 318,
PARS_ASSIGN_TOKEN = 319,
PARS_DECLARE_TOKEN = 320,
PARS_CURSOR_TOKEN = 321,
PARS_SQL_TOKEN = 322,
PARS_OPEN_TOKEN = 323,
PARS_FETCH_TOKEN = 324,
PARS_CLOSE_TOKEN = 325,
PARS_NOTFOUND_TOKEN = 326,
PARS_TO_CHAR_TOKEN = 327,
PARS_TO_NUMBER_TOKEN = 328,
PARS_TO_BINARY_TOKEN = 329,
PARS_BINARY_TO_NUMBER_TOKEN = 330,
PARS_SUBSTR_TOKEN = 331,
PARS_REPLSTR_TOKEN = 332,
PARS_CONCAT_TOKEN = 333,
PARS_INSTR_TOKEN = 334,
PARS_LENGTH_TOKEN = 335,
PARS_SYSDATE_TOKEN = 336,
PARS_PRINTF_TOKEN = 337,
PARS_ASSERT_TOKEN = 338,
PARS_RND_TOKEN = 339,
PARS_RND_STR_TOKEN = 340,
PARS_ROW_PRINTF_TOKEN = 341,
PARS_COMMIT_TOKEN = 342,
PARS_ROLLBACK_TOKEN = 343,
PARS_WORK_TOKEN = 344,
PARS_UNSIGNED_TOKEN = 345,
PARS_EXIT_TOKEN = 346,
PARS_FUNCTION_TOKEN = 347,
NEG = 348
PARS_READ_TOKEN = 298,
PARS_ORDER_TOKEN = 299,
PARS_BY_TOKEN = 300,
PARS_ASC_TOKEN = 301,
PARS_DESC_TOKEN = 302,
PARS_INSERT_TOKEN = 303,
PARS_INTO_TOKEN = 304,
PARS_VALUES_TOKEN = 305,
PARS_UPDATE_TOKEN = 306,
PARS_SET_TOKEN = 307,
PARS_DELETE_TOKEN = 308,
PARS_CURRENT_TOKEN = 309,
PARS_OF_TOKEN = 310,
PARS_CREATE_TOKEN = 311,
PARS_TABLE_TOKEN = 312,
PARS_INDEX_TOKEN = 313,
PARS_UNIQUE_TOKEN = 314,
PARS_CLUSTERED_TOKEN = 315,
PARS_DOES_NOT_FIT_IN_MEM_TOKEN = 316,
PARS_ON_TOKEN = 317,
PARS_ASSIGN_TOKEN = 318,
PARS_DECLARE_TOKEN = 319,
PARS_CURSOR_TOKEN = 320,
PARS_SQL_TOKEN = 321,
PARS_OPEN_TOKEN = 322,
PARS_FETCH_TOKEN = 323,
PARS_CLOSE_TOKEN = 324,
PARS_NOTFOUND_TOKEN = 325,
PARS_TO_CHAR_TOKEN = 326,
PARS_TO_NUMBER_TOKEN = 327,
PARS_TO_BINARY_TOKEN = 328,
PARS_BINARY_TO_NUMBER_TOKEN = 329,
PARS_SUBSTR_TOKEN = 330,
PARS_REPLSTR_TOKEN = 331,
PARS_CONCAT_TOKEN = 332,
PARS_INSTR_TOKEN = 333,
PARS_LENGTH_TOKEN = 334,
PARS_SYSDATE_TOKEN = 335,
PARS_PRINTF_TOKEN = 336,
PARS_ASSERT_TOKEN = 337,
PARS_RND_TOKEN = 338,
PARS_RND_STR_TOKEN = 339,
PARS_ROW_PRINTF_TOKEN = 340,
PARS_COMMIT_TOKEN = 341,
PARS_ROLLBACK_TOKEN = 342,
PARS_WORK_TOKEN = 343,
PARS_UNSIGNED_TOKEN = 344,
PARS_EXIT_TOKEN = 345,
PARS_FUNCTION_TOKEN = 346,
PARS_LOCK_TOKEN = 347,
PARS_SHARE_TOKEN = 348,
PARS_MODE_TOKEN = 349,
NEG = 350
};
#endif
#define PARS_INT_LIT 258
......@@ -162,57 +164,59 @@
#define PARS_WHERE_TOKEN 295
#define PARS_FOR_TOKEN 296
#define PARS_DDOT_TOKEN 297
#define PARS_CONSISTENT_TOKEN 298
#define PARS_READ_TOKEN 299
#define PARS_ORDER_TOKEN 300
#define PARS_BY_TOKEN 301
#define PARS_ASC_TOKEN 302
#define PARS_DESC_TOKEN 303
#define PARS_INSERT_TOKEN 304
#define PARS_INTO_TOKEN 305
#define PARS_VALUES_TOKEN 306
#define PARS_UPDATE_TOKEN 307
#define PARS_SET_TOKEN 308
#define PARS_DELETE_TOKEN 309
#define PARS_CURRENT_TOKEN 310
#define PARS_OF_TOKEN 311
#define PARS_CREATE_TOKEN 312
#define PARS_TABLE_TOKEN 313
#define PARS_INDEX_TOKEN 314
#define PARS_UNIQUE_TOKEN 315
#define PARS_CLUSTERED_TOKEN 316
#define PARS_DOES_NOT_FIT_IN_MEM_TOKEN 317
#define PARS_ON_TOKEN 318
#define PARS_ASSIGN_TOKEN 319
#define PARS_DECLARE_TOKEN 320
#define PARS_CURSOR_TOKEN 321
#define PARS_SQL_TOKEN 322
#define PARS_OPEN_TOKEN 323
#define PARS_FETCH_TOKEN 324
#define PARS_CLOSE_TOKEN 325
#define PARS_NOTFOUND_TOKEN 326
#define PARS_TO_CHAR_TOKEN 327
#define PARS_TO_NUMBER_TOKEN 328
#define PARS_TO_BINARY_TOKEN 329
#define PARS_BINARY_TO_NUMBER_TOKEN 330
#define PARS_SUBSTR_TOKEN 331
#define PARS_REPLSTR_TOKEN 332
#define PARS_CONCAT_TOKEN 333
#define PARS_INSTR_TOKEN 334
#define PARS_LENGTH_TOKEN 335
#define PARS_SYSDATE_TOKEN 336
#define PARS_PRINTF_TOKEN 337
#define PARS_ASSERT_TOKEN 338
#define PARS_RND_TOKEN 339
#define PARS_RND_STR_TOKEN 340
#define PARS_ROW_PRINTF_TOKEN 341
#define PARS_COMMIT_TOKEN 342
#define PARS_ROLLBACK_TOKEN 343
#define PARS_WORK_TOKEN 344
#define PARS_UNSIGNED_TOKEN 345
#define PARS_EXIT_TOKEN 346
#define PARS_FUNCTION_TOKEN 347
#define NEG 348
#define PARS_READ_TOKEN 298
#define PARS_ORDER_TOKEN 299
#define PARS_BY_TOKEN 300
#define PARS_ASC_TOKEN 301
#define PARS_DESC_TOKEN 302
#define PARS_INSERT_TOKEN 303
#define PARS_INTO_TOKEN 304
#define PARS_VALUES_TOKEN 305
#define PARS_UPDATE_TOKEN 306
#define PARS_SET_TOKEN 307
#define PARS_DELETE_TOKEN 308
#define PARS_CURRENT_TOKEN 309
#define PARS_OF_TOKEN 310
#define PARS_CREATE_TOKEN 311
#define PARS_TABLE_TOKEN 312
#define PARS_INDEX_TOKEN 313
#define PARS_UNIQUE_TOKEN 314
#define PARS_CLUSTERED_TOKEN 315
#define PARS_DOES_NOT_FIT_IN_MEM_TOKEN 316
#define PARS_ON_TOKEN 317
#define PARS_ASSIGN_TOKEN 318
#define PARS_DECLARE_TOKEN 319
#define PARS_CURSOR_TOKEN 320
#define PARS_SQL_TOKEN 321
#define PARS_OPEN_TOKEN 322
#define PARS_FETCH_TOKEN 323
#define PARS_CLOSE_TOKEN 324
#define PARS_NOTFOUND_TOKEN 325
#define PARS_TO_CHAR_TOKEN 326
#define PARS_TO_NUMBER_TOKEN 327
#define PARS_TO_BINARY_TOKEN 328
#define PARS_BINARY_TO_NUMBER_TOKEN 329
#define PARS_SUBSTR_TOKEN 330
#define PARS_REPLSTR_TOKEN 331
#define PARS_CONCAT_TOKEN 332
#define PARS_INSTR_TOKEN 333
#define PARS_LENGTH_TOKEN 334
#define PARS_SYSDATE_TOKEN 335
#define PARS_PRINTF_TOKEN 336
#define PARS_ASSERT_TOKEN 337
#define PARS_RND_TOKEN 338
#define PARS_RND_STR_TOKEN 339
#define PARS_ROW_PRINTF_TOKEN 340
#define PARS_COMMIT_TOKEN 341
#define PARS_ROLLBACK_TOKEN 342
#define PARS_WORK_TOKEN 343
#define PARS_UNSIGNED_TOKEN 344
#define PARS_EXIT_TOKEN 345
#define PARS_FUNCTION_TOKEN 346
#define PARS_LOCK_TOKEN 347
#define PARS_SHARE_TOKEN 348
#define PARS_MODE_TOKEN 349
#define NEG 350
......
......@@ -70,7 +70,6 @@ yylex(void);
%token PARS_WHERE_TOKEN
%token PARS_FOR_TOKEN
%token PARS_DDOT_TOKEN
%token PARS_CONSISTENT_TOKEN
%token PARS_READ_TOKEN
%token PARS_ORDER_TOKEN
%token PARS_BY_TOKEN
......@@ -120,6 +119,9 @@ yylex(void);
%token PARS_UNSIGNED_TOKEN
%token PARS_EXIT_TOKEN
%token PARS_FUNCTION_TOKEN
%token PARS_LOCK_TOKEN
%token PARS_SHARE_TOKEN
%token PARS_MODE_TOKEN
%left PARS_AND_TOKEN PARS_OR_TOKEN
%left PARS_NOT_TOKEN
......@@ -132,9 +134,11 @@ yylex(void);
/* Grammar follows */
%%
top_statement:
procedure_definition ';'
statement:
procedure_definition ';'
| stored_procedure_call
stored_procedure_call
| predefined_procedure_call ';'
| while_statement ';'
| for_statement ';'
......@@ -301,10 +305,10 @@ for_update_clause:
{ $$ = &pars_update_token; }
;
consistent_read_clause:
lock_shared_clause:
/* Nothing */ { $$ = NULL; }
| PARS_CONSISTENT_TOKEN PARS_READ_TOKEN
{ $$ = &pars_consistent_token; }
| PARS_LOCK_TOKEN PARS_IN_TOKEN PARS_SHARE_TOKEN PARS_MODE_TOKEN
{ $$ = &pars_share_token; }
;
order_direction:
......@@ -324,7 +328,7 @@ select_statement:
PARS_FROM_TOKEN table_list
search_condition
for_update_clause
consistent_read_clause
lock_shared_clause
order_by_clause { $$ = pars_select_statement($2, $4, $5,
$6, $7, $8); }
;
......
......@@ -325,10 +325,6 @@ In the state 'id', only two actions are possible (defined below). */
return(PARS_FOR_TOKEN);
}
"CONSISTENT" {
return(PARS_CONSISTENT_TOKEN);
}
"READ" {
return(PARS_READ_TOKEN);
}
......@@ -517,6 +513,18 @@ In the state 'id', only two actions are possible (defined below). */
return(PARS_FUNCTION_TOKEN);
}
"LOCK" {
return(PARS_LOCK_TOKEN);
}
"SHARE" {
return(PARS_SHARE_TOKEN);
}
"MODE" {
return(PARS_MODE_TOKEN);
}
{ID} {
yylval = sym_tab_add_id(pars_sym_tab_global,
(byte*)yytext,
......
......@@ -72,7 +72,7 @@ pars_res_word_t pars_asc_token = {PARS_ASC_TOKEN};
pars_res_word_t pars_desc_token = {PARS_DESC_TOKEN};
pars_res_word_t pars_open_token = {PARS_OPEN_TOKEN};
pars_res_word_t pars_close_token = {PARS_CLOSE_TOKEN};
pars_res_word_t pars_consistent_token = {PARS_CONSISTENT_TOKEN};
pars_res_word_t pars_share_token = {PARS_SHARE_TOKEN};
pars_res_word_t pars_unique_token = {PARS_UNIQUE_TOKEN};
pars_res_word_t pars_clustered_token = {PARS_CLUSTERED_TOKEN};
......@@ -699,8 +699,7 @@ pars_select_statement(
sym_node_t* table_list, /* in: table list */
que_node_t* search_cond, /* in: search condition or NULL */
pars_res_word_t* for_update, /* in: NULL or &pars_update_token */
pars_res_word_t* consistent_read,/* in: NULL or
&pars_consistent_token */
pars_res_word_t* lock_shared, /* in: NULL or &pars_share_token */
order_node_t* order_by) /* in: NULL or an order-by node */
{
select_node->state = SEL_NODE_OPEN;
......@@ -734,19 +733,24 @@ pars_select_statement(
}
if (for_update) {
ut_a(!consistent_read);
ut_a(!lock_shared);
select_node->set_x_locks = TRUE;
select_node->row_lock_mode = LOCK_X;
} else {
select_node->consistent_read = FALSE;
select_node->read_view = NULL;
} else if (lock_shared){
select_node->set_x_locks = FALSE;
select_node->row_lock_mode = LOCK_S;
}
if (consistent_read) {
select_node->consistent_read = TRUE;
} else {
select_node->consistent_read = FALSE;
select_node->read_view = NULL;
} else {
select_node->set_x_locks = FALSE;
select_node->row_lock_mode = LOCK_S;
select_node->consistent_read = TRUE;
}
select_node->order_by = order_by;
......@@ -976,7 +980,7 @@ pars_update_statement(
sel_node = pars_select_list(NULL, NULL);
pars_select_statement(sel_node, table_sym, search_cond, NULL,
NULL, NULL);
&pars_share_token, NULL);
node->searched_update = TRUE;
sel_node->common.parent = node;
}
......@@ -1857,8 +1861,9 @@ pars_sql(
#endif /* UNIV_SYNC_DEBUG */
pars_sym_tab_global = sym_tab_create(heap);
pars_sym_tab_global->sql_string = mem_heap_strdup(heap, str);
pars_sym_tab_global->string_len = strlen(str);
pars_sym_tab_global->sql_string = mem_heap_dup(heap, str,
pars_sym_tab_global->string_len + 1);
pars_sym_tab_global->next_char_pos = 0;
pars_sym_tab_global->info = info;
......
......@@ -715,27 +715,6 @@ que_graph_try_free(
return(FALSE);
}
/**************************************************************************
Handles an SQL error noticed during query thread execution. Currently,
does nothing! */
void
que_thr_handle_error(
/*=================*/
que_thr_t* thr __attribute__((unused)),
/* in: query thread */
ulint err_no __attribute__((unused)),
/* in: error number */
byte* err_str __attribute__((unused)),
/* in, own: error string or NULL; NOTE: the
function will take care of freeing of the
string! */
ulint err_len __attribute__((unused)))
/* in: error string length */
{
/* Does nothing */
}
/********************************************************************
Performs an execution step on a thr node. */
static
......@@ -813,11 +792,10 @@ que_thr_move_to_run_state(
Decrements the query thread reference counts in the query graph and the
transaction. May start signal handling, e.g., a rollback.
*** NOTE ***:
This and que_thr_stop_for_mysql are
the only functions where the reference count can be decremented and
this function may only be called from inside que_run_threads or
que_thr_check_if_switch! These restrictions exist to make the rollback code
easier to maintain. */
This and que_thr_stop_for_mysql are the only functions where the reference
count can be decremented and this function may only be called from inside
que_run_threads or que_thr_check_if_switch! These restrictions exist to make
the rollback code easier to maintain. */
static
void
que_thr_dec_refer_count(
......@@ -836,7 +814,7 @@ que_thr_dec_refer_count(
ibool stopped;
fork = thr->common.parent;
trx = thr->graph->trx;
trx = thr_get_trx(thr);
sess = trx->sess;
mutex_enter(&kernel_mutex);
......@@ -856,6 +834,12 @@ que_thr_dec_refer_count(
stderr); */
if (next_thr && *next_thr == NULL) {
/* Normally srv_suspend_mysql_thread resets
the state to DB_SUCCESS before waiting, but
in this case we have to do it here,
otherwise nobody does it. */
trx->error_state = DB_SUCCESS;
*next_thr = thr;
} else {
ut_a(0);
......@@ -1200,7 +1184,10 @@ que_thr_step(
trx_t* trx;
ulint type;
trx = thr_get_trx(thr);
ut_ad(thr->state == QUE_THR_RUNNING);
ut_a(trx->error_state == DB_SUCCESS);
thr->resource++;
......@@ -1236,7 +1223,6 @@ que_thr_step(
threads doing updating or inserting at the moment! */
if (thr->prev_node == que_node_get_parent(node)) {
trx = thr_get_trx(thr);
trx->last_sql_stat_start.least_undo_no
= trx->undo_no;
}
......@@ -1298,24 +1284,28 @@ que_thr_step(
old_thr->prev_node = node;
}
if (thr) {
ut_a(thr_get_trx(thr)->error_state == DB_SUCCESS);
}
return(thr);
}
/**************************************************************************
Runs query threads. Note that the individual query thread which is run
within this function may change if, e.g., the OS thread executing this
function uses a threshold amount of resources. */
Run a query thread until it finishes or encounters e.g. a lock wait. */
static
void
que_run_threads(
/*============*/
que_thr_t* thr) /* in: query thread which is run initially */
que_run_threads_low(
/*================*/
que_thr_t* thr) /* in: query thread */
{
que_thr_t* next_thr;
ulint cumul_resource;
ulint loop_count;
ut_ad(thr->state == QUE_THR_RUNNING);
ut_a(thr_get_trx(thr)->error_state == DB_SUCCESS);
#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
......@@ -1340,10 +1330,15 @@ que_run_threads(
next_thr = que_thr_step(thr);
/*-------------------------*/
ut_a(!next_thr || (thr_get_trx(next_thr)->error_state == DB_SUCCESS));
loop_count++;
if (next_thr != thr) {
ut_a(next_thr == NULL);
/* This can change next_thr to a non-NULL value if there was
a lock wait that already completed. */
que_thr_dec_refer_count(thr, &next_thr);
if (next_thr == NULL) {
......@@ -1359,20 +1354,89 @@ que_run_threads(
goto loop;
}
/**************************************************************************
Run a query thread. Handles lock waits. */
void
que_run_threads(
/*============*/
que_thr_t* thr) /* in: query thread */
{
loop:
ut_a(thr_get_trx(thr)->error_state == DB_SUCCESS);
que_run_threads_low(thr);
mutex_enter(&kernel_mutex);
switch (thr->state) {
case QUE_THR_RUNNING:
/* There probably was a lock wait, but it already ended
before we came here: continue running thr */
mutex_exit(&kernel_mutex);
goto loop;
case QUE_THR_LOCK_WAIT:
mutex_exit(&kernel_mutex);
/* The ..._mysql_... function works also for InnoDB's
internal threads. Let us wait that the lock wait ends. */
srv_suspend_mysql_thread(thr);
if (thr_get_trx(thr)->error_state != DB_SUCCESS) {
/* thr was chosen as a deadlock victim or there was
a lock wait timeout */
que_thr_dec_refer_count(thr, NULL);
return;
}
goto loop;
case QUE_THR_COMPLETED:
case QUE_THR_COMMAND_WAIT:
/* Do nothing */
break;
default:
ut_error;
}
mutex_exit(&kernel_mutex);
}
/*************************************************************************
Evaluate the given SQL */
Evaluate the given SQL. */
ulint
que_eval_sql(
/*=========*/
pars_info_t* info, /* out: error code or DB_SUCCESS */
const char* sql, /* in: info struct, or NULL */
/* out: error code or DB_SUCCESS */
pars_info_t* info, /* in: info struct, or NULL */
const char* sql, /* in: SQL string */
ibool reserve_dict_mutex,
/* in: if TRUE, acquire/release
dict_sys->mutex around call to pars_sql. */
trx_t* trx) /* in: trx */
{
que_thr_t* thr;
que_t* graph;
ut_a(trx->error_state == DB_SUCCESS);
if (reserve_dict_mutex) {
mutex_enter(&dict_sys->mutex);
}
graph = pars_sql(info, sql);
if (reserve_dict_mutex) {
mutex_exit(&dict_sys->mutex);
}
ut_a(graph);
graph->trx = trx;
......
......@@ -607,7 +607,7 @@ row_ins_set_detailed(
rewind(srv_misc_tmpfile);
if (os_file_set_eof(srv_misc_tmpfile)) {
ut_print_name(srv_misc_tmpfile, trx,
ut_print_name(srv_misc_tmpfile, trx, TRUE,
foreign->foreign_table_name);
dict_print_info_on_foreign_key_in_create_format(
srv_misc_tmpfile,
......@@ -649,22 +649,22 @@ row_ins_foreign_report_err(
trx_print(ef, trx, 600);
fputs("Foreign key constraint fails for table ", ef);
ut_print_name(ef, trx, foreign->foreign_table_name);
ut_print_name(ef, trx, TRUE, foreign->foreign_table_name);
fputs(":\n", ef);
dict_print_info_on_foreign_key_in_create_format(ef, trx, foreign,
TRUE);
putc('\n', ef);
fputs(errstr, ef);
fputs(" in parent table, in index ", ef);
ut_print_name(ef, trx, foreign->referenced_index->name);
ut_print_name(ef, trx, FALSE, foreign->referenced_index->name);
if (entry) {
fputs(" tuple:\n", ef);
dtuple_print(ef, entry);
}
fputs("\nBut in child table ", ef);
ut_print_name(ef, trx, foreign->foreign_table_name);
ut_print_name(ef, trx, TRUE, foreign->foreign_table_name);
fputs(", in index ", ef);
ut_print_name(ef, trx, foreign->foreign_index->name);
ut_print_name(ef, trx, FALSE, foreign->foreign_index->name);
if (rec) {
fputs(", there is a record:\n", ef);
rec_print(ef, rec, foreign->foreign_index);
......@@ -702,20 +702,20 @@ row_ins_foreign_report_add_err(
fputs(" Transaction:\n", ef);
trx_print(ef, trx, 600);
fputs("Foreign key constraint fails for table ", ef);
ut_print_name(ef, trx, foreign->foreign_table_name);
ut_print_name(ef, trx, TRUE, foreign->foreign_table_name);
fputs(":\n", ef);
dict_print_info_on_foreign_key_in_create_format(ef, trx, foreign,
TRUE);
fputs("\nTrying to add in child table, in index ", ef);
ut_print_name(ef, trx, foreign->foreign_index->name);
ut_print_name(ef, trx, FALSE, foreign->foreign_index->name);
if (entry) {
fputs(" tuple:\n", ef);
dtuple_print(ef, entry);
}
fputs("\nBut in parent table ", ef);
ut_print_name(ef, trx, foreign->referenced_table_name);
ut_print_name(ef, trx, TRUE, foreign->referenced_table_name);
fputs(", in index ", ef);
ut_print_name(ef, trx, foreign->referenced_index->name);
ut_print_name(ef, trx, FALSE, foreign->referenced_index->name);
fputs(",\nthe closest match we can find is record:\n", ef);
if (rec && page_rec_is_supremum(rec)) {
/* If the cursor ended on a supremum record, it is better
......@@ -1283,16 +1283,19 @@ row_ins_check_foreign_constraint(
fputs(" Transaction:\n", ef);
trx_print(ef, trx, 600);
fputs("Foreign key constraint fails for table ", ef);
ut_print_name(ef, trx, foreign->foreign_table_name);
ut_print_name(ef, trx, TRUE,
foreign->foreign_table_name);
fputs(":\n", ef);
dict_print_info_on_foreign_key_in_create_format(ef,
trx, foreign, TRUE);
fputs("\nTrying to add to index ", ef);
ut_print_name(ef, trx, foreign->foreign_index->name);
ut_print_name(ef, trx, FALSE,
foreign->foreign_index->name);
fputs(" tuple:\n", ef);
dtuple_print(ef, entry);
fputs("\nBut the parent table ", ef);
ut_print_name(ef, trx, foreign->referenced_table_name);
ut_print_name(ef, trx, TRUE,
foreign->referenced_table_name);
fputs("\nor its .ibd file does not currently exist!\n", ef);
mutex_exit(&dict_foreign_err_mutex);
......
This diff is collapsed.
......@@ -440,12 +440,12 @@ row_build_row_ref_in_tuple(
ut_a(ref && index && rec);
if (!index->table) {
if (UNIV_UNLIKELY(!index->table)) {
fputs("InnoDB: table ", stderr);
notfound:
ut_print_name(stderr, trx, index->table_name);
ut_print_name(stderr, trx, TRUE, index->table_name);
fputs(" for index ", stderr);
ut_print_name(stderr, trx, index->name);
ut_print_name(stderr, trx, FALSE, index->name);
fputs(" not found\n", stderr);
ut_error;
}
......
......@@ -45,6 +45,9 @@ to que_run_threads: this is to allow canceling runaway queries */
#define SEL_COST_LIMIT 100
/* The lower limit for what we consider a "big" row */
#define BIG_ROW_SIZE 1024
/* Flags for search shortcut */
#define SEL_FOUND 0
#define SEL_EXHAUSTED 1
......@@ -302,19 +305,45 @@ row_sel_fetch_columns(
}
while (column) {
mem_heap_t* heap = NULL;
ibool needs_copy;
field_no = column->field_nos[index_type];
if (field_no != ULINT_UNDEFINED) {
data = rec_get_nth_field(rec, offsets, field_no, &len);
if (UNIV_UNLIKELY(rec_offs_nth_extern(offsets,
field_no))) {
/* Copy an externally stored field to the
temporary heap */
heap = mem_heap_create(1);
if (column->copy_val) {
data = btr_rec_copy_externally_stored_field(
rec, offsets, field_no, &len, heap);
ut_a(len != UNIV_SQL_NULL);
needs_copy = TRUE;
} else {
data = rec_get_nth_field(rec, offsets,
field_no, &len);
needs_copy = column->copy_val;
}
if (needs_copy) {
eval_node_copy_and_alloc_val(column, data,
len);
} else {
val = que_node_get_val(column);
dfield_set_data(val, data, len);
}
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
}
column = UT_LIST_GET_NEXT(col_var_list, column);
......@@ -1106,11 +1135,12 @@ row_sel_try_search_shortcut(
ut_ad(plan->pcur.latch_mode == node->latch_mode);
plan->n_rows_fetched++;
ret = SEL_FOUND;
func_exit:
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
return(SEL_FOUND);
return(ret);
}
/*************************************************************************
......@@ -1214,7 +1244,8 @@ row_sel(
mtr_start(&mtr);
if (consistent_read && plan->unique_search && !plan->pcur_is_open
&& !plan->must_get_clust) {
&& !plan->must_get_clust
&& (plan->table->max_row_size < BIG_ROW_SIZE)) {
if (!search_latch_locked) {
rw_lock_s_lock(&btr_search_latch);
......@@ -1328,6 +1359,12 @@ row_sel(
if (srv_locks_unsafe_for_binlog
|| trx->isolation_level == TRX_ISO_READ_COMMITTED) {
if (page_rec_is_supremum(next_rec)) {
goto skip_lock;
}
lock_type = LOCK_REC_NOT_GAP;
} else {
lock_type = LOCK_ORDINARY;
......@@ -1346,6 +1383,7 @@ row_sel(
}
}
skip_lock:
if (page_rec_is_infimum(rec)) {
/* The infimum record on a page cannot be in the result set,
......@@ -1376,6 +1414,12 @@ row_sel(
if (srv_locks_unsafe_for_binlog
|| trx->isolation_level == TRX_ISO_READ_COMMITTED) {
if (page_rec_is_supremum(rec)) {
goto next_rec;
}
lock_type = LOCK_REC_NOT_GAP;
} else {
lock_type = LOCK_ORDINARY;
......@@ -1602,7 +1646,8 @@ row_sel(
}
if ((plan->n_rows_fetched <= SEL_PREFETCH_LIMIT)
|| plan->unique_search || plan->no_prefetch) {
|| plan->unique_search || plan->no_prefetch
|| (plan->table->max_row_size >= BIG_ROW_SIZE)) {
/* No prefetch in operation: go to the next table */
......@@ -1888,9 +1933,8 @@ row_sel_step(
err = lock_table(0, table_node->table,
i_lock_mode, thr);
if (err != DB_SUCCESS) {
thr_get_trx(thr)->error_state = err;
que_thr_handle_error(thr, DB_ERROR,
NULL, 0);
return(NULL);
}
......@@ -1926,17 +1970,8 @@ row_sel_step(
thr->graph->last_sel_node = node;
if (err == DB_SUCCESS) {
/* Ok: do nothing */
} else if (err == DB_LOCK_WAIT) {
return(NULL);
} else {
/* SQL error detected */
fprintf(stderr, "SQL error %lu\n", (ulong) err);
que_thr_handle_error(thr, DB_ERROR, NULL, 0);
if (err != DB_SUCCESS) {
thr_get_trx(thr)->error_state = err;
return(NULL);
}
......@@ -1997,7 +2032,7 @@ fetch_step(
fprintf(stderr,
"InnoDB: Error: fetch called on a closed cursor\n");
que_thr_handle_error(thr, DB_ERROR, NULL, 0);
thr_get_trx(thr)->error_state = DB_ERROR;
return(NULL);
}
......@@ -2546,6 +2581,7 @@ row_sel_store_mysql_rec(
{
mysql_row_templ_t* templ;
mem_heap_t* extern_field_heap = NULL;
mem_heap_t* heap;
byte* data;
ulint len;
ulint i;
......@@ -2570,7 +2606,19 @@ row_sel_store_mysql_rec(
ut_a(!prebuilt->trx->has_search_latch);
extern_field_heap = mem_heap_create(UNIV_PAGE_SIZE);
if (UNIV_UNLIKELY(templ->type == DATA_BLOB)) {
if (prebuilt->blob_heap == NULL) {
prebuilt->blob_heap =
mem_heap_create(UNIV_PAGE_SIZE);
}
heap = prebuilt->blob_heap;
} else {
extern_field_heap =
mem_heap_create(UNIV_PAGE_SIZE);
heap = extern_field_heap;
}
/* NOTE: if we are retrieving a big BLOB, we may
already run out of memory in the next call, which
......@@ -2578,7 +2626,7 @@ row_sel_store_mysql_rec(
data = btr_rec_copy_externally_stored_field(rec,
offsets, templ->rec_field_no, &len,
extern_field_heap);
heap);
ut_a(len != UNIV_SQL_NULL);
} else {
......@@ -2589,48 +2637,6 @@ row_sel_store_mysql_rec(
}
if (len != UNIV_SQL_NULL) {
if (UNIV_UNLIKELY(templ->type == DATA_BLOB)) {
ut_a(prebuilt->templ_contains_blob);
/* A heuristic test that we can allocate the
memory for a big BLOB. We have a safety margin
of 1000000 bytes. Since the test takes some
CPU time, we do not use it for small BLOBs. */
if (UNIV_UNLIKELY(len > 2000000)
&& UNIV_UNLIKELY(!ut_test_malloc(
len + 1000000))) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Warning: could not allocate %lu + 1000000 bytes to retrieve\n"
"InnoDB: a big column. Table name ", (ulong) len);
ut_print_name(stderr,
prebuilt->trx,
prebuilt->table->name);
putc('\n', stderr);
if (extern_field_heap) {
mem_heap_free(
extern_field_heap);
}
return(FALSE);
}
/* Copy the BLOB data to the BLOB heap of
prebuilt */
if (prebuilt->blob_heap == NULL) {
prebuilt->blob_heap =
mem_heap_create(len);
}
data = memcpy(mem_heap_alloc(
prebuilt->blob_heap, len),
data, len);
}
row_sel_field_store_in_mysql_format(
mysql_rec + templ->mysql_col_offset,
templ, data, len);
......@@ -3250,7 +3256,7 @@ row_search_for_mysql(
"InnoDB: Error: trying to free a corrupt\n"
"InnoDB: table handle. Magic n %lu, table name ",
(ulong) prebuilt->magic_n);
ut_print_name(stderr, trx, prebuilt->table->name);
ut_print_name(stderr, trx, TRUE, prebuilt->table->name);
putc('\n', stderr);
mem_analyze_corruption(prebuilt);
......@@ -3536,15 +3542,13 @@ stderr);
if (trx->isolation_level <= TRX_ISO_READ_COMMITTED
&& prebuilt->select_lock_type != LOCK_NONE
&& trx->mysql_query_str) {
&& trx->mysql_query_str && trx->mysql_thd) {
/* Scan the MySQL query string; check if SELECT is the first
word there */
ibool success;
dict_accept(*trx->mysql_query_str, "SELECT", &success);
if (success) {
if (dict_str_starts_with_keyword(trx->mysql_thd,
*trx->mysql_query_str, "SELECT")) {
/* It is a plain locking SELECT and the isolation
level is low: do not lock gaps */
......
......@@ -2008,12 +2008,7 @@ row_upd_step(
error_handling:
trx->error_state = err;
if (err == DB_SUCCESS) {
/* Ok: do nothing */
} else if (err == DB_LOCK_WAIT) {
return(NULL);
} else {
if (err != DB_SUCCESS) {
return(NULL);
}
......
......@@ -68,6 +68,9 @@ ibool srv_error_monitor_active = FALSE;
const char* srv_main_thread_op_info = "";
/* Prefix used by MySQL to indicate pre-5.1 table name encoding */
const char srv_mysql50_table_name_prefix[9] = "#mysql50#";
/* Server parameters which are read from the initfile */
/* The following three are dir paths which are catenated before file
......
......@@ -843,7 +843,7 @@ trx_undo_update_rec_get_update(
"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n"
"InnoDB: Run also CHECK TABLE ",
(ulong) dict_index_get_n_fields(index));
ut_print_name(stderr, trx, index->table_name);
ut_print_name(stderr, trx, TRUE, index->table_name);
fprintf(stderr, "\n"
"InnoDB: n_fields = %lu, i = %lu, ptr %p\n",
(ulong) n_fields, (ulong) i, ptr);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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