Commit d36f9479 authored by unknown's avatar unknown

Applied innodb-5.1-ss660 snapshot.

 Changes in SQL parser:
 * Change default mode of SELECT from "lock in share mode"
   to "consistent read".
 * Remove support from SELECT for specifying "consistent read".
 * Add support in SELECT for specifying "lock in share mode".
 * Change all uses of SQL parser to specify "lock in share mode".
 * Modify syntax so that the only valid top-level statement is
   a procedure definition, since it's the only one that actually
   works.
 * Add support for lock waits.


sql/ha_innodb.cc:
  Applied innodb-5.1-ss660 snapshot.
   Document better the "bool table_id" flag.
storage/innobase/btr/btr0cur.c:
  Applied innodb-5.1-ss660 snapshot.
   btr_cur_search_to_nth_level(): Reacquire btr_search_latch after
   inserting to the insert buffer. This was noticed while analysing
   Bug#19801, but this should not fix this bug since, according to
   Heikki, btr_search_latch is not reserved during an insert.
storage/innobase/configure.in:
  Applied innodb-5.1-ss660 snapshot.
   Add -Wpointer-arith to CFLAGS when using GCC.
storage/innobase/data/data0type.c:
  Applied innodb-5.1-ss660 snapshot.
storage/innobase/dict/dict0crea.c:
  Applied innodb-5.1-ss660 snapshot.
storage/innobase/dict/dict0dict.c:
  Applied innodb-5.1-ss660 snapshot.
   Make dict_remove_db_name() non-static.
storage/innobase/ibuf/ibuf0ibuf.c:
  Applied innodb-5.1-ss660 snapshot.
   ibuf_fixed_addr_page(): Add parameter space. As the insert buffer
   B-tree is only located in the system tablespace (space 0),
   IBUF_TREE_ROOT_PAGE_NO is only special in space 0.
storage/innobase/include/data0type.h:
  Applied innodb-5.1-ss660 snapshot.
storage/innobase/include/dict0dict.h:
  Applied innodb-5.1-ss660 snapshot.
   Make dict_remove_db_name() non-static.
storage/innobase/include/pars0grm.h:
  Applied innodb-5.1-ss660 snapshot.
storage/innobase/include/pars0pars.h:
  Applied innodb-5.1-ss660 snapshot.
storage/innobase/include/que0que.h:
  Applied innodb-5.1-ss660 snapshot.
storage/innobase/include/sync0rw.ic:
  Applied innodb-5.1-ss660 snapshot.
   rw_lock_s_unlock_func(): Change a debug assertion to a
   production assertion in order to track down Bug#19081.
storage/innobase/include/trx0trx.h:
  Applied innodb-5.1-ss660 snapshot.
   trx_sig_send() always succeeds or asserts.
storage/innobase/include/ut0ut.h:
  Applied innodb-5.1-ss660 snapshot.
   Document better the "bool table_id" flags.
storage/innobase/mem/mem0mem.c:
  Applied innodb-5.1-ss660 snapshot.
storage/innobase/pars/lexyy.c:
  Applied innodb-5.1-ss660 snapshot.
storage/innobase/pars/pars0grm.c:
  Applied innodb-5.1-ss660 snapshot.
storage/innobase/pars/pars0grm.h:
  Applied innodb-5.1-ss660 snapshot.
storage/innobase/pars/pars0grm.y:
  Applied innodb-5.1-ss660 snapshot.
storage/innobase/pars/pars0lex.l:
  Applied innodb-5.1-ss660 snapshot.
storage/innobase/pars/pars0pars.c:
  Applied innodb-5.1-ss660 snapshot.
storage/innobase/que/que0que.c:
  Applied innodb-5.1-ss660 snapshot.
storage/innobase/row/row0mysql.c:
  Applied innodb-5.1-ss660 snapshot.
storage/innobase/row/row0sel.c:
  Applied innodb-5.1-ss660 snapshot.
   * Disable prefetch and adaptive hash index for tables
     with rows over 1024 bytes in InnoDB's SQL parser.
   * row_sel_try_search_shortcut(): Do not return SEL_FOUND
     when the record was not found. This bug was introduced
     in MySQL/InnoDB 5.0.3, but luckily it should never
     manifest itself, given that existing InnoDB SQL code
     never makes use of consistent reads.
   * Don't take unnecesary locks on supremum records when the
     srv_locks_unsafe_for_binlog option is enabled. Fixes an
     assertion failure in the innodb_unsafe_binlog testcase
     when compiled with UNIV_DEBUG.
storage/innobase/row/row0upd.c:
  Applied innodb-5.1-ss660 snapshot.
storage/innobase/trx/trx0roll.c:
  Applied innodb-5.1-ss660 snapshot.
   trx_sig_send() always succeeds or asserts.
storage/innobase/trx/trx0trx.c:
  Applied innodb-5.1-ss660 snapshot.
   trx_sig_send() always succeeds or asserts.
storage/innobase/ut/ut0ut.c:
  Applied innodb-5.1-ss660 snapshot.
   Document better the "bool table_id" flags.
parent 3a409d4a
...@@ -1174,7 +1174,8 @@ innobase_print_identifier( ...@@ -1174,7 +1174,8 @@ innobase_print_identifier(
/*======================*/ /*======================*/
FILE* f, /* in: output stream */ FILE* f, /* in: output stream */
trx_t* trx, /* in: transaction */ trx_t* trx, /* in: transaction */
ibool table_id,/* in: TRUE=decode table name */ ibool table_id,/* in: TRUE=print a table name,
FALSE=print other identifier */
const char* name, /* in: name to print */ const char* name, /* in: name to print */
ulint namelen)/* in: length of name */ ulint namelen)/* in: length of name */
{ {
......
...@@ -455,7 +455,7 @@ btr_cur_search_to_nth_level( ...@@ -455,7 +455,7 @@ btr_cur_search_to_nth_level(
if (UNIV_LIKELY_NULL(heap)) { if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap); mem_heap_free(heap);
} }
return; goto func_exit;
} }
/* Insert to the insert buffer did not succeed: /* Insert to the insert buffer did not succeed:
...@@ -571,6 +571,7 @@ btr_cur_search_to_nth_level( ...@@ -571,6 +571,7 @@ btr_cur_search_to_nth_level(
|| mode != PAGE_CUR_LE); || mode != PAGE_CUR_LE);
} }
func_exit:
if (has_search_latch) { if (has_search_latch) {
rw_lock_s_lock(&btr_search_latch); rw_lock_s_lock(&btr_search_latch);
......
...@@ -105,7 +105,7 @@ fi ...@@ -105,7 +105,7 @@ fi
# If using gcc, add some extra warning flags. # If using gcc, add some extra warning flags.
if test "$ac_cv_prog_gcc" = "yes" if test "$ac_cv_prog_gcc" = "yes"
then then
CFLAGS="$CFLAGS -Werror-implicit-function-declaration" CFLAGS="$CFLAGS -Werror-implicit-function-declaration -Wpointer-arith"
fi fi
case "$target_os" in case "$target_os" in
......
...@@ -297,6 +297,7 @@ dtype_print( ...@@ -297,6 +297,7 @@ dtype_print(
/*************************************************************************** /***************************************************************************
Returns the maximum size of a data type. Note: types in system tables may be Returns the maximum size of a data type. Note: types in system tables may be
incomplete and return incorrect information. */ incomplete and return incorrect information. */
ulint ulint
dtype_get_max_size( dtype_get_max_size(
/*===============*/ /*===============*/
......
...@@ -1193,7 +1193,7 @@ dict_create_or_check_foreign_constraint_tables(void) ...@@ -1193,7 +1193,7 @@ dict_create_or_check_foreign_constraint_tables(void)
"CREATE UNIQUE CLUSTERED INDEX ID_IND ON SYS_FOREIGN_COLS (ID, POS);\n" "CREATE UNIQUE CLUSTERED INDEX ID_IND ON SYS_FOREIGN_COLS (ID, POS);\n"
"COMMIT WORK;\n" "COMMIT WORK;\n"
"END;\n" "END;\n"
, trx); , FALSE, trx);
if (error != DB_SUCCESS) { if (error != DB_SUCCESS) {
fprintf(stderr, "InnoDB: error %lu in creation\n", fprintf(stderr, "InnoDB: error %lu in creation\n",
...@@ -1242,7 +1242,7 @@ dict_foreign_eval_sql( ...@@ -1242,7 +1242,7 @@ dict_foreign_eval_sql(
ulint error; ulint error;
FILE* ef = dict_foreign_err_file; 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) { if (error == DB_DUPLICATE_KEY) {
mutex_enter(&dict_foreign_err_mutex); mutex_enter(&dict_foreign_err_mutex);
......
...@@ -285,7 +285,7 @@ dict_tables_have_same_db( ...@@ -285,7 +285,7 @@ dict_tables_have_same_db(
/************************************************************************ /************************************************************************
Return the end of table name where we have removed dbname and '/'. */ Return the end of table name where we have removed dbname and '/'. */
static
const char* const char*
dict_remove_db_name( dict_remove_db_name(
/*================*/ /*================*/
......
...@@ -952,14 +952,11 @@ ibool ...@@ -952,14 +952,11 @@ ibool
ibuf_fixed_addr_page( ibuf_fixed_addr_page(
/*=================*/ /*=================*/
/* out: TRUE if a fixed address ibuf i/o page */ /* out: TRUE if a fixed address ibuf i/o page */
ulint space, /* in: space id */
ulint page_no)/* in: page number */ ulint page_no)/* in: page number */
{ {
if ((ibuf_bitmap_page(page_no)) return((space == 0 && page_no == IBUF_TREE_ROOT_PAGE_NO)
|| (page_no == IBUF_TREE_ROOT_PAGE_NO)) { || ibuf_bitmap_page(page_no));
return(TRUE);
}
return(FALSE);
} }
/*************************************************************************** /***************************************************************************
...@@ -983,7 +980,7 @@ ibuf_page( ...@@ -983,7 +980,7 @@ ibuf_page(
return(FALSE); return(FALSE);
} }
if (ibuf_fixed_addr_page(page_no)) { if (ibuf_fixed_addr_page(space, page_no)) {
return(TRUE); return(TRUE);
} }
...@@ -1031,7 +1028,7 @@ ibuf_page_low( ...@@ -1031,7 +1028,7 @@ ibuf_page_low(
return(FALSE); return(FALSE);
} }
#endif #endif
if (ibuf_fixed_addr_page(page_no)) { if (ibuf_fixed_addr_page(space, page_no)) {
return(TRUE); return(TRUE);
} }
...@@ -3070,7 +3067,7 @@ ibuf_merge_or_delete_for_page( ...@@ -3070,7 +3067,7 @@ ibuf_merge_or_delete_for_page(
return; return;
} }
#endif #endif
if (ibuf_fixed_addr_page(page_no) || fsp_descr_page(page_no) if (ibuf_fixed_addr_page(space, page_no) || fsp_descr_page(page_no)
|| trx_sys_hdr_page(space, page_no)) { || trx_sys_hdr_page(space, page_no)) {
return; return;
} }
......
...@@ -332,6 +332,7 @@ dtype_get_min_size( ...@@ -332,6 +332,7 @@ dtype_get_min_size(
/*************************************************************************** /***************************************************************************
Returns the maximum size of a data type. Note: types in system tables may be Returns the maximum size of a data type. Note: types in system tables may be
incomplete and return incorrect information. */ incomplete and return incorrect information. */
ulint ulint
dtype_get_max_size( dtype_get_max_size(
/*===============*/ /*===============*/
......
...@@ -45,6 +45,15 @@ dict_get_db_name_len( ...@@ -45,6 +45,15 @@ dict_get_db_name_len(
const char* name); /* in: table name in the form const char* name); /* in: table name in the form
dbname '/' tablename */ dbname '/' tablename */
/************************************************************************ /************************************************************************
Return the end of table name where we have removed dbname and '/'. */
const char*
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. */ Decrements the count of open MySQL handles to a table. */
void void
......
...@@ -69,57 +69,59 @@ ...@@ -69,57 +69,59 @@
PARS_WHERE_TOKEN = 295, PARS_WHERE_TOKEN = 295,
PARS_FOR_TOKEN = 296, PARS_FOR_TOKEN = 296,
PARS_DDOT_TOKEN = 297, PARS_DDOT_TOKEN = 297,
PARS_CONSISTENT_TOKEN = 298, PARS_READ_TOKEN = 298,
PARS_READ_TOKEN = 299, PARS_ORDER_TOKEN = 299,
PARS_ORDER_TOKEN = 300, PARS_BY_TOKEN = 300,
PARS_BY_TOKEN = 301, PARS_ASC_TOKEN = 301,
PARS_ASC_TOKEN = 302, PARS_DESC_TOKEN = 302,
PARS_DESC_TOKEN = 303, PARS_INSERT_TOKEN = 303,
PARS_INSERT_TOKEN = 304, PARS_INTO_TOKEN = 304,
PARS_INTO_TOKEN = 305, PARS_VALUES_TOKEN = 305,
PARS_VALUES_TOKEN = 306, PARS_UPDATE_TOKEN = 306,
PARS_UPDATE_TOKEN = 307, PARS_SET_TOKEN = 307,
PARS_SET_TOKEN = 308, PARS_DELETE_TOKEN = 308,
PARS_DELETE_TOKEN = 309, PARS_CURRENT_TOKEN = 309,
PARS_CURRENT_TOKEN = 310, PARS_OF_TOKEN = 310,
PARS_OF_TOKEN = 311, PARS_CREATE_TOKEN = 311,
PARS_CREATE_TOKEN = 312, PARS_TABLE_TOKEN = 312,
PARS_TABLE_TOKEN = 313, PARS_INDEX_TOKEN = 313,
PARS_INDEX_TOKEN = 314, PARS_UNIQUE_TOKEN = 314,
PARS_UNIQUE_TOKEN = 315, PARS_CLUSTERED_TOKEN = 315,
PARS_CLUSTERED_TOKEN = 316, PARS_DOES_NOT_FIT_IN_MEM_TOKEN = 316,
PARS_DOES_NOT_FIT_IN_MEM_TOKEN = 317, PARS_ON_TOKEN = 317,
PARS_ON_TOKEN = 318, PARS_ASSIGN_TOKEN = 318,
PARS_ASSIGN_TOKEN = 319, PARS_DECLARE_TOKEN = 319,
PARS_DECLARE_TOKEN = 320, PARS_CURSOR_TOKEN = 320,
PARS_CURSOR_TOKEN = 321, PARS_SQL_TOKEN = 321,
PARS_SQL_TOKEN = 322, PARS_OPEN_TOKEN = 322,
PARS_OPEN_TOKEN = 323, PARS_FETCH_TOKEN = 323,
PARS_FETCH_TOKEN = 324, PARS_CLOSE_TOKEN = 324,
PARS_CLOSE_TOKEN = 325, PARS_NOTFOUND_TOKEN = 325,
PARS_NOTFOUND_TOKEN = 326, PARS_TO_CHAR_TOKEN = 326,
PARS_TO_CHAR_TOKEN = 327, PARS_TO_NUMBER_TOKEN = 327,
PARS_TO_NUMBER_TOKEN = 328, PARS_TO_BINARY_TOKEN = 328,
PARS_TO_BINARY_TOKEN = 329, PARS_BINARY_TO_NUMBER_TOKEN = 329,
PARS_BINARY_TO_NUMBER_TOKEN = 330, PARS_SUBSTR_TOKEN = 330,
PARS_SUBSTR_TOKEN = 331, PARS_REPLSTR_TOKEN = 331,
PARS_REPLSTR_TOKEN = 332, PARS_CONCAT_TOKEN = 332,
PARS_CONCAT_TOKEN = 333, PARS_INSTR_TOKEN = 333,
PARS_INSTR_TOKEN = 334, PARS_LENGTH_TOKEN = 334,
PARS_LENGTH_TOKEN = 335, PARS_SYSDATE_TOKEN = 335,
PARS_SYSDATE_TOKEN = 336, PARS_PRINTF_TOKEN = 336,
PARS_PRINTF_TOKEN = 337, PARS_ASSERT_TOKEN = 337,
PARS_ASSERT_TOKEN = 338, PARS_RND_TOKEN = 338,
PARS_RND_TOKEN = 339, PARS_RND_STR_TOKEN = 339,
PARS_RND_STR_TOKEN = 340, PARS_ROW_PRINTF_TOKEN = 340,
PARS_ROW_PRINTF_TOKEN = 341, PARS_COMMIT_TOKEN = 341,
PARS_COMMIT_TOKEN = 342, PARS_ROLLBACK_TOKEN = 342,
PARS_ROLLBACK_TOKEN = 343, PARS_WORK_TOKEN = 343,
PARS_WORK_TOKEN = 344, PARS_UNSIGNED_TOKEN = 344,
PARS_UNSIGNED_TOKEN = 345, PARS_EXIT_TOKEN = 345,
PARS_EXIT_TOKEN = 346, PARS_FUNCTION_TOKEN = 346,
PARS_FUNCTION_TOKEN = 347, PARS_LOCK_TOKEN = 347,
NEG = 348 PARS_SHARE_TOKEN = 348,
PARS_MODE_TOKEN = 349,
NEG = 350
}; };
#endif #endif
#define PARS_INT_LIT 258 #define PARS_INT_LIT 258
...@@ -162,57 +164,59 @@ ...@@ -162,57 +164,59 @@
#define PARS_WHERE_TOKEN 295 #define PARS_WHERE_TOKEN 295
#define PARS_FOR_TOKEN 296 #define PARS_FOR_TOKEN 296
#define PARS_DDOT_TOKEN 297 #define PARS_DDOT_TOKEN 297
#define PARS_CONSISTENT_TOKEN 298 #define PARS_READ_TOKEN 298
#define PARS_READ_TOKEN 299 #define PARS_ORDER_TOKEN 299
#define PARS_ORDER_TOKEN 300 #define PARS_BY_TOKEN 300
#define PARS_BY_TOKEN 301 #define PARS_ASC_TOKEN 301
#define PARS_ASC_TOKEN 302 #define PARS_DESC_TOKEN 302
#define PARS_DESC_TOKEN 303 #define PARS_INSERT_TOKEN 303
#define PARS_INSERT_TOKEN 304 #define PARS_INTO_TOKEN 304
#define PARS_INTO_TOKEN 305 #define PARS_VALUES_TOKEN 305
#define PARS_VALUES_TOKEN 306 #define PARS_UPDATE_TOKEN 306
#define PARS_UPDATE_TOKEN 307 #define PARS_SET_TOKEN 307
#define PARS_SET_TOKEN 308 #define PARS_DELETE_TOKEN 308
#define PARS_DELETE_TOKEN 309 #define PARS_CURRENT_TOKEN 309
#define PARS_CURRENT_TOKEN 310 #define PARS_OF_TOKEN 310
#define PARS_OF_TOKEN 311 #define PARS_CREATE_TOKEN 311
#define PARS_CREATE_TOKEN 312 #define PARS_TABLE_TOKEN 312
#define PARS_TABLE_TOKEN 313 #define PARS_INDEX_TOKEN 313
#define PARS_INDEX_TOKEN 314 #define PARS_UNIQUE_TOKEN 314
#define PARS_UNIQUE_TOKEN 315 #define PARS_CLUSTERED_TOKEN 315
#define PARS_CLUSTERED_TOKEN 316 #define PARS_DOES_NOT_FIT_IN_MEM_TOKEN 316
#define PARS_DOES_NOT_FIT_IN_MEM_TOKEN 317 #define PARS_ON_TOKEN 317
#define PARS_ON_TOKEN 318 #define PARS_ASSIGN_TOKEN 318
#define PARS_ASSIGN_TOKEN 319 #define PARS_DECLARE_TOKEN 319
#define PARS_DECLARE_TOKEN 320 #define PARS_CURSOR_TOKEN 320
#define PARS_CURSOR_TOKEN 321 #define PARS_SQL_TOKEN 321
#define PARS_SQL_TOKEN 322 #define PARS_OPEN_TOKEN 322
#define PARS_OPEN_TOKEN 323 #define PARS_FETCH_TOKEN 323
#define PARS_FETCH_TOKEN 324 #define PARS_CLOSE_TOKEN 324
#define PARS_CLOSE_TOKEN 325 #define PARS_NOTFOUND_TOKEN 325
#define PARS_NOTFOUND_TOKEN 326 #define PARS_TO_CHAR_TOKEN 326
#define PARS_TO_CHAR_TOKEN 327 #define PARS_TO_NUMBER_TOKEN 327
#define PARS_TO_NUMBER_TOKEN 328 #define PARS_TO_BINARY_TOKEN 328
#define PARS_TO_BINARY_TOKEN 329 #define PARS_BINARY_TO_NUMBER_TOKEN 329
#define PARS_BINARY_TO_NUMBER_TOKEN 330 #define PARS_SUBSTR_TOKEN 330
#define PARS_SUBSTR_TOKEN 331 #define PARS_REPLSTR_TOKEN 331
#define PARS_REPLSTR_TOKEN 332 #define PARS_CONCAT_TOKEN 332
#define PARS_CONCAT_TOKEN 333 #define PARS_INSTR_TOKEN 333
#define PARS_INSTR_TOKEN 334 #define PARS_LENGTH_TOKEN 334
#define PARS_LENGTH_TOKEN 335 #define PARS_SYSDATE_TOKEN 335
#define PARS_SYSDATE_TOKEN 336 #define PARS_PRINTF_TOKEN 336
#define PARS_PRINTF_TOKEN 337 #define PARS_ASSERT_TOKEN 337
#define PARS_ASSERT_TOKEN 338 #define PARS_RND_TOKEN 338
#define PARS_RND_TOKEN 339 #define PARS_RND_STR_TOKEN 339
#define PARS_RND_STR_TOKEN 340 #define PARS_ROW_PRINTF_TOKEN 340
#define PARS_ROW_PRINTF_TOKEN 341 #define PARS_COMMIT_TOKEN 341
#define PARS_COMMIT_TOKEN 342 #define PARS_ROLLBACK_TOKEN 342
#define PARS_ROLLBACK_TOKEN 343 #define PARS_WORK_TOKEN 343
#define PARS_WORK_TOKEN 344 #define PARS_UNSIGNED_TOKEN 344
#define PARS_UNSIGNED_TOKEN 345 #define PARS_EXIT_TOKEN 345
#define PARS_EXIT_TOKEN 346 #define PARS_FUNCTION_TOKEN 346
#define PARS_FUNCTION_TOKEN 347 #define PARS_LOCK_TOKEN 347
#define NEG 348 #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; ...@@ -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_desc_token;
extern pars_res_word_t pars_open_token; extern pars_res_word_t pars_open_token;
extern pars_res_word_t pars_close_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_unique_token;
extern pars_res_word_t pars_clustered_token; extern pars_res_word_t pars_clustered_token;
......
...@@ -143,14 +143,12 @@ que_thr_stop_for_mysql( ...@@ -143,14 +143,12 @@ que_thr_stop_for_mysql(
/*===================*/ /*===================*/
que_thr_t* thr); /* in: query thread */ que_thr_t* thr); /* in: query thread */
/************************************************************************** /**************************************************************************
Runs query threads. Note that the individual query thread which is run Run a query thread. Handles lock waits. */
within this function may change if, e.g., the OS thread executing this
function uses a threshold amount of resources. */
void void
que_run_threads( 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 After signal handling is finished, returns control to a query graph error
handling routine. (Currently, just returns the control to the root of the handling routine. (Currently, just returns the control to the root of the
...@@ -163,19 +161,6 @@ que_fork_error_handle( ...@@ -163,19 +161,6 @@ que_fork_error_handle(
que_t* fork); /* in: query graph which was run before signal que_t* fork); /* in: query graph which was run before signal
handling started, NULL not allowed */ 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 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 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 the wait state of a query thread waiting for a lock or a stored procedure
...@@ -337,9 +322,14 @@ Evaluate the given SQL */ ...@@ -337,9 +322,14 @@ Evaluate the given SQL */
ulint ulint
que_eval_sql( que_eval_sql(
/*=========*/ /*=========*/
pars_info_t* info, /* out: error code or DB_SUCCESS */ /* out: error code or DB_SUCCESS */
const char* sql, /* in: info struct, or NULL */ 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 */ trx_t* trx); /* in: trx */
/* Query graph query thread node: the fields are protected by the kernel /* Query graph query thread node: the fields are protected by the kernel
mutex with the exceptions named below */ mutex with the exceptions named below */
......
...@@ -362,7 +362,7 @@ rw_lock_s_unlock_func( ...@@ -362,7 +362,7 @@ rw_lock_s_unlock_func(
/* Reset the shared lock by decrementing the reader count */ /* Reset the shared lock by decrementing the reader count */
ut_ad(lock->reader_count > 0); ut_a(lock->reader_count > 0);
lock->reader_count--; lock->reader_count--;
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
......
...@@ -266,11 +266,9 @@ trx_end_lock_wait( ...@@ -266,11 +266,9 @@ trx_end_lock_wait(
/******************************************************************** /********************************************************************
Sends a signal to a trx object. */ Sends a signal to a trx object. */
ibool void
trx_sig_send( trx_sig_send(
/*=========*/ /*=========*/
/* out: TRUE if the signal was
successfully delivered */
trx_t* trx, /* in: trx handle */ trx_t* trx, /* in: trx handle */
ulint type, /* in: signal type */ ulint type, /* in: signal type */
ulint sender, /* in: TRX_SIG_SELF or ulint sender, /* in: TRX_SIG_SELF or
......
...@@ -214,17 +214,19 @@ ut_print_filename( ...@@ -214,17 +214,19 @@ ut_print_filename(
FILE* f, /* in: output stream */ FILE* f, /* in: output stream */
const char* name); /* in: name to print */ 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. */ Outputs a NUL-terminated string, quoted as an SQL identifier. */
struct trx_struct;
void void
ut_print_name( ut_print_name(
/*==========*/ /*==========*/
FILE* f, /* in: output stream */ FILE* f, /* in: output stream */
struct trx_struct*trx, /* in: transaction */ struct trx_struct*trx, /* in: transaction */
ibool table_id,/* in: TRUE=decode table name */ ibool table_id,/* in: TRUE=print a table name,
FALSE=print other identifier */
const char* name); /* in: name to print */ const char* name); /* in: name to print */
/************************************************************************** /**************************************************************************
...@@ -235,7 +237,8 @@ ut_print_namel( ...@@ -235,7 +237,8 @@ ut_print_namel(
/*===========*/ /*===========*/
FILE* f, /* in: output stream */ FILE* f, /* in: output stream */
struct trx_struct*trx, /* in: transaction (NULL=no quotes) */ struct trx_struct*trx, /* in: transaction (NULL=no quotes) */
ibool table_id,/* in: TRUE=decode table name */ ibool table_id,/* in: TRUE=print a table name,
FALSE=print other identifier */
const char* name, /* in: name to print */ const char* name, /* in: name to print */
ulint namelen);/* in: length of name */ ulint namelen);/* in: length of name */
......
...@@ -144,7 +144,7 @@ mem_heap_cat( ...@@ -144,7 +144,7 @@ mem_heap_cat(
void* res = mem_heap_alloc(heap, len1 + len2); void* res = mem_heap_alloc(heap, len1 + len2);
memcpy(res, b1, len1); memcpy(res, b1, len1);
memcpy((char *)res + len1, b2, len2); memcpy((char*)res + len1, b2, len2);
return(res); return(res);
} }
......
This diff is collapsed.
This diff is collapsed.
...@@ -69,57 +69,59 @@ ...@@ -69,57 +69,59 @@
PARS_WHERE_TOKEN = 295, PARS_WHERE_TOKEN = 295,
PARS_FOR_TOKEN = 296, PARS_FOR_TOKEN = 296,
PARS_DDOT_TOKEN = 297, PARS_DDOT_TOKEN = 297,
PARS_CONSISTENT_TOKEN = 298, PARS_READ_TOKEN = 298,
PARS_READ_TOKEN = 299, PARS_ORDER_TOKEN = 299,
PARS_ORDER_TOKEN = 300, PARS_BY_TOKEN = 300,
PARS_BY_TOKEN = 301, PARS_ASC_TOKEN = 301,
PARS_ASC_TOKEN = 302, PARS_DESC_TOKEN = 302,
PARS_DESC_TOKEN = 303, PARS_INSERT_TOKEN = 303,
PARS_INSERT_TOKEN = 304, PARS_INTO_TOKEN = 304,
PARS_INTO_TOKEN = 305, PARS_VALUES_TOKEN = 305,
PARS_VALUES_TOKEN = 306, PARS_UPDATE_TOKEN = 306,
PARS_UPDATE_TOKEN = 307, PARS_SET_TOKEN = 307,
PARS_SET_TOKEN = 308, PARS_DELETE_TOKEN = 308,
PARS_DELETE_TOKEN = 309, PARS_CURRENT_TOKEN = 309,
PARS_CURRENT_TOKEN = 310, PARS_OF_TOKEN = 310,
PARS_OF_TOKEN = 311, PARS_CREATE_TOKEN = 311,
PARS_CREATE_TOKEN = 312, PARS_TABLE_TOKEN = 312,
PARS_TABLE_TOKEN = 313, PARS_INDEX_TOKEN = 313,
PARS_INDEX_TOKEN = 314, PARS_UNIQUE_TOKEN = 314,
PARS_UNIQUE_TOKEN = 315, PARS_CLUSTERED_TOKEN = 315,
PARS_CLUSTERED_TOKEN = 316, PARS_DOES_NOT_FIT_IN_MEM_TOKEN = 316,
PARS_DOES_NOT_FIT_IN_MEM_TOKEN = 317, PARS_ON_TOKEN = 317,
PARS_ON_TOKEN = 318, PARS_ASSIGN_TOKEN = 318,
PARS_ASSIGN_TOKEN = 319, PARS_DECLARE_TOKEN = 319,
PARS_DECLARE_TOKEN = 320, PARS_CURSOR_TOKEN = 320,
PARS_CURSOR_TOKEN = 321, PARS_SQL_TOKEN = 321,
PARS_SQL_TOKEN = 322, PARS_OPEN_TOKEN = 322,
PARS_OPEN_TOKEN = 323, PARS_FETCH_TOKEN = 323,
PARS_FETCH_TOKEN = 324, PARS_CLOSE_TOKEN = 324,
PARS_CLOSE_TOKEN = 325, PARS_NOTFOUND_TOKEN = 325,
PARS_NOTFOUND_TOKEN = 326, PARS_TO_CHAR_TOKEN = 326,
PARS_TO_CHAR_TOKEN = 327, PARS_TO_NUMBER_TOKEN = 327,
PARS_TO_NUMBER_TOKEN = 328, PARS_TO_BINARY_TOKEN = 328,
PARS_TO_BINARY_TOKEN = 329, PARS_BINARY_TO_NUMBER_TOKEN = 329,
PARS_BINARY_TO_NUMBER_TOKEN = 330, PARS_SUBSTR_TOKEN = 330,
PARS_SUBSTR_TOKEN = 331, PARS_REPLSTR_TOKEN = 331,
PARS_REPLSTR_TOKEN = 332, PARS_CONCAT_TOKEN = 332,
PARS_CONCAT_TOKEN = 333, PARS_INSTR_TOKEN = 333,
PARS_INSTR_TOKEN = 334, PARS_LENGTH_TOKEN = 334,
PARS_LENGTH_TOKEN = 335, PARS_SYSDATE_TOKEN = 335,
PARS_SYSDATE_TOKEN = 336, PARS_PRINTF_TOKEN = 336,
PARS_PRINTF_TOKEN = 337, PARS_ASSERT_TOKEN = 337,
PARS_ASSERT_TOKEN = 338, PARS_RND_TOKEN = 338,
PARS_RND_TOKEN = 339, PARS_RND_STR_TOKEN = 339,
PARS_RND_STR_TOKEN = 340, PARS_ROW_PRINTF_TOKEN = 340,
PARS_ROW_PRINTF_TOKEN = 341, PARS_COMMIT_TOKEN = 341,
PARS_COMMIT_TOKEN = 342, PARS_ROLLBACK_TOKEN = 342,
PARS_ROLLBACK_TOKEN = 343, PARS_WORK_TOKEN = 343,
PARS_WORK_TOKEN = 344, PARS_UNSIGNED_TOKEN = 344,
PARS_UNSIGNED_TOKEN = 345, PARS_EXIT_TOKEN = 345,
PARS_EXIT_TOKEN = 346, PARS_FUNCTION_TOKEN = 346,
PARS_FUNCTION_TOKEN = 347, PARS_LOCK_TOKEN = 347,
NEG = 348 PARS_SHARE_TOKEN = 348,
PARS_MODE_TOKEN = 349,
NEG = 350
}; };
#endif #endif
#define PARS_INT_LIT 258 #define PARS_INT_LIT 258
...@@ -162,57 +164,59 @@ ...@@ -162,57 +164,59 @@
#define PARS_WHERE_TOKEN 295 #define PARS_WHERE_TOKEN 295
#define PARS_FOR_TOKEN 296 #define PARS_FOR_TOKEN 296
#define PARS_DDOT_TOKEN 297 #define PARS_DDOT_TOKEN 297
#define PARS_CONSISTENT_TOKEN 298 #define PARS_READ_TOKEN 298
#define PARS_READ_TOKEN 299 #define PARS_ORDER_TOKEN 299
#define PARS_ORDER_TOKEN 300 #define PARS_BY_TOKEN 300
#define PARS_BY_TOKEN 301 #define PARS_ASC_TOKEN 301
#define PARS_ASC_TOKEN 302 #define PARS_DESC_TOKEN 302
#define PARS_DESC_TOKEN 303 #define PARS_INSERT_TOKEN 303
#define PARS_INSERT_TOKEN 304 #define PARS_INTO_TOKEN 304
#define PARS_INTO_TOKEN 305 #define PARS_VALUES_TOKEN 305
#define PARS_VALUES_TOKEN 306 #define PARS_UPDATE_TOKEN 306
#define PARS_UPDATE_TOKEN 307 #define PARS_SET_TOKEN 307
#define PARS_SET_TOKEN 308 #define PARS_DELETE_TOKEN 308
#define PARS_DELETE_TOKEN 309 #define PARS_CURRENT_TOKEN 309
#define PARS_CURRENT_TOKEN 310 #define PARS_OF_TOKEN 310
#define PARS_OF_TOKEN 311 #define PARS_CREATE_TOKEN 311
#define PARS_CREATE_TOKEN 312 #define PARS_TABLE_TOKEN 312
#define PARS_TABLE_TOKEN 313 #define PARS_INDEX_TOKEN 313
#define PARS_INDEX_TOKEN 314 #define PARS_UNIQUE_TOKEN 314
#define PARS_UNIQUE_TOKEN 315 #define PARS_CLUSTERED_TOKEN 315
#define PARS_CLUSTERED_TOKEN 316 #define PARS_DOES_NOT_FIT_IN_MEM_TOKEN 316
#define PARS_DOES_NOT_FIT_IN_MEM_TOKEN 317 #define PARS_ON_TOKEN 317
#define PARS_ON_TOKEN 318 #define PARS_ASSIGN_TOKEN 318
#define PARS_ASSIGN_TOKEN 319 #define PARS_DECLARE_TOKEN 319
#define PARS_DECLARE_TOKEN 320 #define PARS_CURSOR_TOKEN 320
#define PARS_CURSOR_TOKEN 321 #define PARS_SQL_TOKEN 321
#define PARS_SQL_TOKEN 322 #define PARS_OPEN_TOKEN 322
#define PARS_OPEN_TOKEN 323 #define PARS_FETCH_TOKEN 323
#define PARS_FETCH_TOKEN 324 #define PARS_CLOSE_TOKEN 324
#define PARS_CLOSE_TOKEN 325 #define PARS_NOTFOUND_TOKEN 325
#define PARS_NOTFOUND_TOKEN 326 #define PARS_TO_CHAR_TOKEN 326
#define PARS_TO_CHAR_TOKEN 327 #define PARS_TO_NUMBER_TOKEN 327
#define PARS_TO_NUMBER_TOKEN 328 #define PARS_TO_BINARY_TOKEN 328
#define PARS_TO_BINARY_TOKEN 329 #define PARS_BINARY_TO_NUMBER_TOKEN 329
#define PARS_BINARY_TO_NUMBER_TOKEN 330 #define PARS_SUBSTR_TOKEN 330
#define PARS_SUBSTR_TOKEN 331 #define PARS_REPLSTR_TOKEN 331
#define PARS_REPLSTR_TOKEN 332 #define PARS_CONCAT_TOKEN 332
#define PARS_CONCAT_TOKEN 333 #define PARS_INSTR_TOKEN 333
#define PARS_INSTR_TOKEN 334 #define PARS_LENGTH_TOKEN 334
#define PARS_LENGTH_TOKEN 335 #define PARS_SYSDATE_TOKEN 335
#define PARS_SYSDATE_TOKEN 336 #define PARS_PRINTF_TOKEN 336
#define PARS_PRINTF_TOKEN 337 #define PARS_ASSERT_TOKEN 337
#define PARS_ASSERT_TOKEN 338 #define PARS_RND_TOKEN 338
#define PARS_RND_TOKEN 339 #define PARS_RND_STR_TOKEN 339
#define PARS_RND_STR_TOKEN 340 #define PARS_ROW_PRINTF_TOKEN 340
#define PARS_ROW_PRINTF_TOKEN 341 #define PARS_COMMIT_TOKEN 341
#define PARS_COMMIT_TOKEN 342 #define PARS_ROLLBACK_TOKEN 342
#define PARS_ROLLBACK_TOKEN 343 #define PARS_WORK_TOKEN 343
#define PARS_WORK_TOKEN 344 #define PARS_UNSIGNED_TOKEN 344
#define PARS_UNSIGNED_TOKEN 345 #define PARS_EXIT_TOKEN 345
#define PARS_EXIT_TOKEN 346 #define PARS_FUNCTION_TOKEN 346
#define PARS_FUNCTION_TOKEN 347 #define PARS_LOCK_TOKEN 347
#define NEG 348 #define PARS_SHARE_TOKEN 348
#define PARS_MODE_TOKEN 349
#define NEG 350
......
...@@ -70,7 +70,6 @@ yylex(void); ...@@ -70,7 +70,6 @@ yylex(void);
%token PARS_WHERE_TOKEN %token PARS_WHERE_TOKEN
%token PARS_FOR_TOKEN %token PARS_FOR_TOKEN
%token PARS_DDOT_TOKEN %token PARS_DDOT_TOKEN
%token PARS_CONSISTENT_TOKEN
%token PARS_READ_TOKEN %token PARS_READ_TOKEN
%token PARS_ORDER_TOKEN %token PARS_ORDER_TOKEN
%token PARS_BY_TOKEN %token PARS_BY_TOKEN
...@@ -120,6 +119,9 @@ yylex(void); ...@@ -120,6 +119,9 @@ yylex(void);
%token PARS_UNSIGNED_TOKEN %token PARS_UNSIGNED_TOKEN
%token PARS_EXIT_TOKEN %token PARS_EXIT_TOKEN
%token PARS_FUNCTION_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_AND_TOKEN PARS_OR_TOKEN
%left PARS_NOT_TOKEN %left PARS_NOT_TOKEN
...@@ -132,9 +134,11 @@ yylex(void); ...@@ -132,9 +134,11 @@ yylex(void);
/* Grammar follows */ /* Grammar follows */
%% %%
top_statement:
procedure_definition ';'
statement: statement:
procedure_definition ';' stored_procedure_call
| stored_procedure_call
| predefined_procedure_call ';' | predefined_procedure_call ';'
| while_statement ';' | while_statement ';'
| for_statement ';' | for_statement ';'
...@@ -301,10 +305,10 @@ for_update_clause: ...@@ -301,10 +305,10 @@ for_update_clause:
{ $$ = &pars_update_token; } { $$ = &pars_update_token; }
; ;
consistent_read_clause: lock_shared_clause:
/* Nothing */ { $$ = NULL; } /* Nothing */ { $$ = NULL; }
| PARS_CONSISTENT_TOKEN PARS_READ_TOKEN | PARS_LOCK_TOKEN PARS_IN_TOKEN PARS_SHARE_TOKEN PARS_MODE_TOKEN
{ $$ = &pars_consistent_token; } { $$ = &pars_share_token; }
; ;
order_direction: order_direction:
...@@ -324,7 +328,7 @@ select_statement: ...@@ -324,7 +328,7 @@ select_statement:
PARS_FROM_TOKEN table_list PARS_FROM_TOKEN table_list
search_condition search_condition
for_update_clause for_update_clause
consistent_read_clause lock_shared_clause
order_by_clause { $$ = pars_select_statement($2, $4, $5, order_by_clause { $$ = pars_select_statement($2, $4, $5,
$6, $7, $8); } $6, $7, $8); }
; ;
......
...@@ -325,10 +325,6 @@ In the state 'id', only two actions are possible (defined below). */ ...@@ -325,10 +325,6 @@ In the state 'id', only two actions are possible (defined below). */
return(PARS_FOR_TOKEN); return(PARS_FOR_TOKEN);
} }
"CONSISTENT" {
return(PARS_CONSISTENT_TOKEN);
}
"READ" { "READ" {
return(PARS_READ_TOKEN); return(PARS_READ_TOKEN);
} }
...@@ -517,6 +513,18 @@ In the state 'id', only two actions are possible (defined below). */ ...@@ -517,6 +513,18 @@ In the state 'id', only two actions are possible (defined below). */
return(PARS_FUNCTION_TOKEN); return(PARS_FUNCTION_TOKEN);
} }
"LOCK" {
return(PARS_LOCK_TOKEN);
}
"SHARE" {
return(PARS_SHARE_TOKEN);
}
"MODE" {
return(PARS_MODE_TOKEN);
}
{ID} { {ID} {
yylval = sym_tab_add_id(pars_sym_tab_global, yylval = sym_tab_add_id(pars_sym_tab_global,
(byte*)yytext, (byte*)yytext,
......
...@@ -72,7 +72,7 @@ pars_res_word_t pars_asc_token = {PARS_ASC_TOKEN}; ...@@ -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_desc_token = {PARS_DESC_TOKEN};
pars_res_word_t pars_open_token = {PARS_OPEN_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_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_unique_token = {PARS_UNIQUE_TOKEN};
pars_res_word_t pars_clustered_token = {PARS_CLUSTERED_TOKEN}; pars_res_word_t pars_clustered_token = {PARS_CLUSTERED_TOKEN};
...@@ -699,8 +699,7 @@ pars_select_statement( ...@@ -699,8 +699,7 @@ pars_select_statement(
sym_node_t* table_list, /* in: table list */ sym_node_t* table_list, /* in: table list */
que_node_t* search_cond, /* in: search condition or NULL */ 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* for_update, /* in: NULL or &pars_update_token */
pars_res_word_t* consistent_read,/* in: NULL or pars_res_word_t* lock_shared, /* in: NULL or &pars_share_token */
&pars_consistent_token */
order_node_t* order_by) /* in: NULL or an order-by node */ order_node_t* order_by) /* in: NULL or an order-by node */
{ {
select_node->state = SEL_NODE_OPEN; select_node->state = SEL_NODE_OPEN;
...@@ -734,19 +733,24 @@ pars_select_statement( ...@@ -734,19 +733,24 @@ pars_select_statement(
} }
if (for_update) { if (for_update) {
ut_a(!consistent_read); ut_a(!lock_shared);
select_node->set_x_locks = TRUE; select_node->set_x_locks = TRUE;
select_node->row_lock_mode = LOCK_X; 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->set_x_locks = FALSE;
select_node->row_lock_mode = LOCK_S; select_node->row_lock_mode = LOCK_S;
}
if (consistent_read) {
select_node->consistent_read = TRUE;
} else {
select_node->consistent_read = FALSE; select_node->consistent_read = FALSE;
select_node->read_view = NULL; 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; select_node->order_by = order_by;
...@@ -976,7 +980,7 @@ pars_update_statement( ...@@ -976,7 +980,7 @@ pars_update_statement(
sel_node = pars_select_list(NULL, NULL); sel_node = pars_select_list(NULL, NULL);
pars_select_statement(sel_node, table_sym, search_cond, NULL, pars_select_statement(sel_node, table_sym, search_cond, NULL,
NULL, NULL); &pars_share_token, NULL);
node->searched_update = TRUE; node->searched_update = TRUE;
sel_node->common.parent = node; sel_node->common.parent = node;
} }
...@@ -1857,8 +1861,9 @@ pars_sql( ...@@ -1857,8 +1861,9 @@ pars_sql(
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
pars_sym_tab_global = sym_tab_create(heap); 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->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->next_char_pos = 0;
pars_sym_tab_global->info = info; pars_sym_tab_global->info = info;
......
...@@ -715,27 +715,6 @@ que_graph_try_free( ...@@ -715,27 +715,6 @@ que_graph_try_free(
return(FALSE); 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. */ Performs an execution step on a thr node. */
static static
...@@ -813,11 +792,10 @@ que_thr_move_to_run_state( ...@@ -813,11 +792,10 @@ que_thr_move_to_run_state(
Decrements the query thread reference counts in the query graph and the Decrements the query thread reference counts in the query graph and the
transaction. May start signal handling, e.g., a rollback. transaction. May start signal handling, e.g., a rollback.
*** NOTE ***: *** NOTE ***:
This and que_thr_stop_for_mysql are This and que_thr_stop_for_mysql are the only functions where the reference
the only functions where the reference count can be decremented and count can be decremented and this function may only be called from inside
this function may only be called from inside que_run_threads or que_run_threads or que_thr_check_if_switch! These restrictions exist to make
que_thr_check_if_switch! These restrictions exist to make the rollback code the rollback code easier to maintain. */
easier to maintain. */
static static
void void
que_thr_dec_refer_count( que_thr_dec_refer_count(
...@@ -836,7 +814,7 @@ que_thr_dec_refer_count( ...@@ -836,7 +814,7 @@ que_thr_dec_refer_count(
ibool stopped; ibool stopped;
fork = thr->common.parent; fork = thr->common.parent;
trx = thr->graph->trx; trx = thr_get_trx(thr);
sess = trx->sess; sess = trx->sess;
mutex_enter(&kernel_mutex); mutex_enter(&kernel_mutex);
...@@ -856,6 +834,12 @@ que_thr_dec_refer_count( ...@@ -856,6 +834,12 @@ que_thr_dec_refer_count(
stderr); */ stderr); */
if (next_thr && *next_thr == NULL) { 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; *next_thr = thr;
} else { } else {
ut_a(0); ut_a(0);
...@@ -1200,7 +1184,10 @@ que_thr_step( ...@@ -1200,7 +1184,10 @@ que_thr_step(
trx_t* trx; trx_t* trx;
ulint type; ulint type;
trx = thr_get_trx(thr);
ut_ad(thr->state == QUE_THR_RUNNING); ut_ad(thr->state == QUE_THR_RUNNING);
ut_a(trx->error_state == DB_SUCCESS);
thr->resource++; thr->resource++;
...@@ -1236,7 +1223,6 @@ que_thr_step( ...@@ -1236,7 +1223,6 @@ que_thr_step(
threads doing updating or inserting at the moment! */ threads doing updating or inserting at the moment! */
if (thr->prev_node == que_node_get_parent(node)) { if (thr->prev_node == que_node_get_parent(node)) {
trx = thr_get_trx(thr);
trx->last_sql_stat_start.least_undo_no trx->last_sql_stat_start.least_undo_no
= trx->undo_no; = trx->undo_no;
} }
...@@ -1298,24 +1284,28 @@ que_thr_step( ...@@ -1298,24 +1284,28 @@ que_thr_step(
old_thr->prev_node = node; old_thr->prev_node = node;
} }
if (thr) {
ut_a(thr_get_trx(thr)->error_state == DB_SUCCESS);
}
return(thr); return(thr);
} }
/************************************************************************** /**************************************************************************
Runs query threads. Note that the individual query thread which is run Run a query thread until it finishes or encounters e.g. a lock wait. */
within this function may change if, e.g., the OS thread executing this static
function uses a threshold amount of resources. */
void void
que_run_threads( que_run_threads_low(
/*============*/ /*================*/
que_thr_t* thr) /* in: query thread which is run initially */ que_thr_t* thr) /* in: query thread */
{ {
que_thr_t* next_thr; que_thr_t* next_thr;
ulint cumul_resource; ulint cumul_resource;
ulint loop_count; ulint loop_count;
ut_ad(thr->state == QUE_THR_RUNNING); ut_ad(thr->state == QUE_THR_RUNNING);
ut_a(thr_get_trx(thr)->error_state == DB_SUCCESS);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex)); ut_ad(!mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
...@@ -1340,10 +1330,15 @@ que_run_threads( ...@@ -1340,10 +1330,15 @@ que_run_threads(
next_thr = que_thr_step(thr); next_thr = que_thr_step(thr);
/*-------------------------*/ /*-------------------------*/
ut_a(!next_thr || (thr_get_trx(next_thr)->error_state == DB_SUCCESS));
loop_count++; loop_count++;
if (next_thr != thr) { if (next_thr != thr) {
ut_a(next_thr == NULL); 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); que_thr_dec_refer_count(thr, &next_thr);
if (next_thr == NULL) { if (next_thr == NULL) {
...@@ -1359,20 +1354,89 @@ que_run_threads( ...@@ -1359,20 +1354,89 @@ que_run_threads(
goto loop; 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 ulint
que_eval_sql( que_eval_sql(
/*=========*/ /*=========*/
pars_info_t* info, /* out: error code or DB_SUCCESS */ /* out: error code or DB_SUCCESS */
const char* sql, /* in: info struct, or NULL */ 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 */ trx_t* trx) /* in: trx */
{ {
que_thr_t* thr; que_thr_t* thr;
que_t* graph; que_t* graph;
ut_a(trx->error_state == DB_SUCCESS);
if (reserve_dict_mutex) {
mutex_enter(&dict_sys->mutex);
}
graph = pars_sql(info, sql); graph = pars_sql(info, sql);
if (reserve_dict_mutex) {
mutex_exit(&dict_sys->mutex);
}
ut_a(graph); ut_a(graph);
graph->trx = trx; graph->trx = trx;
......
...@@ -2503,7 +2503,8 @@ do not allow the discard. We also reserve the data dictionary latch. */ ...@@ -2503,7 +2503,8 @@ do not allow the discard. We also reserve the data dictionary latch. */
"BEGIN\n" "BEGIN\n"
"SELECT ID INTO old_id\n" "SELECT ID INTO old_id\n"
"FROM SYS_TABLES\n" "FROM SYS_TABLES\n"
"WHERE NAME = :table_name;\n" "WHERE NAME = :table_name\n"
"LOCK IN SHARE MODE;\n"
"IF (SQL % NOTFOUND) THEN\n" "IF (SQL % NOTFOUND) THEN\n"
" COMMIT WORK;\n" " COMMIT WORK;\n"
" RETURN;\n" " RETURN;\n"
...@@ -2516,7 +2517,7 @@ do not allow the discard. We also reserve the data dictionary latch. */ ...@@ -2516,7 +2517,7 @@ do not allow the discard. We also reserve the data dictionary latch. */
" WHERE TABLE_ID = old_id;\n" " WHERE TABLE_ID = old_id;\n"
"COMMIT WORK;\n" "COMMIT WORK;\n"
"END;\n" "END;\n"
, trx); , FALSE, trx);
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
trx->error_state = DB_SUCCESS; trx->error_state = DB_SUCCESS;
...@@ -2912,7 +2913,7 @@ do not allow the TRUNCATE. We also reserve the data dictionary latch. */ ...@@ -2912,7 +2913,7 @@ do not allow the TRUNCATE. We also reserve the data dictionary latch. */
" WHERE TABLE_ID = :old_id;\n" " WHERE TABLE_ID = :old_id;\n"
"COMMIT WORK;\n" "COMMIT WORK;\n"
"END;\n" "END;\n"
, trx); , FALSE, trx);
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
trx->error_state = DB_SUCCESS; trx->error_state = DB_SUCCESS;
...@@ -3182,7 +3183,8 @@ fputs(" InnoDB: You are trying to drop table ", stderr); ...@@ -3182,7 +3183,8 @@ fputs(" InnoDB: You are trying to drop table ", stderr);
"BEGIN\n" "BEGIN\n"
"SELECT ID INTO table_id\n" "SELECT ID INTO table_id\n"
"FROM SYS_TABLES\n" "FROM SYS_TABLES\n"
"WHERE NAME = :table_name;\n" "WHERE NAME = :table_name\n"
"LOCK IN SHARE MODE;\n"
"IF (SQL % NOTFOUND) THEN\n" "IF (SQL % NOTFOUND) THEN\n"
" COMMIT WORK;\n" " COMMIT WORK;\n"
" RETURN;\n" " RETURN;\n"
...@@ -3190,7 +3192,8 @@ fputs(" InnoDB: You are trying to drop table ", stderr); ...@@ -3190,7 +3192,8 @@ fputs(" InnoDB: You are trying to drop table ", stderr);
"found := 1;\n" "found := 1;\n"
"SELECT ID INTO sys_foreign_id\n" "SELECT ID INTO sys_foreign_id\n"
"FROM SYS_TABLES\n" "FROM SYS_TABLES\n"
"WHERE NAME = 'SYS_FOREIGN';\n" "WHERE NAME = 'SYS_FOREIGN'\n"
"LOCK IN SHARE MODE;\n"
"IF (SQL % NOTFOUND) THEN\n" "IF (SQL % NOTFOUND) THEN\n"
" found := 0;\n" " found := 0;\n"
"END IF;\n" "END IF;\n"
...@@ -3204,7 +3207,8 @@ fputs(" InnoDB: You are trying to drop table ", stderr); ...@@ -3204,7 +3207,8 @@ fputs(" InnoDB: You are trying to drop table ", stderr);
" SELECT ID INTO foreign_id\n" " SELECT ID INTO foreign_id\n"
" FROM SYS_FOREIGN\n" " FROM SYS_FOREIGN\n"
" WHERE FOR_NAME = :table_name\n" " WHERE FOR_NAME = :table_name\n"
" AND TO_BINARY(FOR_NAME) = TO_BINARY(:table_name);\n" " AND TO_BINARY(FOR_NAME) = TO_BINARY(:table_name)\n"
" LOCK IN SHARE MODE;\n"
" IF (SQL % NOTFOUND) THEN\n" " IF (SQL % NOTFOUND) THEN\n"
" found := 0;\n" " found := 0;\n"
" ELSE" " ELSE"
...@@ -3216,7 +3220,8 @@ fputs(" InnoDB: You are trying to drop table ", stderr); ...@@ -3216,7 +3220,8 @@ fputs(" InnoDB: You are trying to drop table ", stderr);
"WHILE found = 1 LOOP\n" "WHILE found = 1 LOOP\n"
" SELECT ID INTO index_id\n" " SELECT ID INTO index_id\n"
" FROM SYS_INDEXES\n" " FROM SYS_INDEXES\n"
" WHERE TABLE_ID = table_id;\n" " WHERE TABLE_ID = table_id\n"
" LOCK IN SHARE MODE;\n"
" IF (SQL % NOTFOUND) THEN\n" " IF (SQL % NOTFOUND) THEN\n"
" found := 0;\n" " found := 0;\n"
" ELSE" " ELSE"
...@@ -3229,7 +3234,7 @@ fputs(" InnoDB: You are trying to drop table ", stderr); ...@@ -3229,7 +3234,7 @@ fputs(" InnoDB: You are trying to drop table ", stderr);
"DELETE FROM SYS_TABLES WHERE ID = table_id;\n" "DELETE FROM SYS_TABLES WHERE ID = table_id;\n"
"COMMIT WORK;\n" "COMMIT WORK;\n"
"END;\n" "END;\n"
, trx); , FALSE, trx);
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
ut_a(err == DB_OUT_OF_FILE_SPACE); ut_a(err == DB_OUT_OF_FILE_SPACE);
...@@ -3438,7 +3443,7 @@ row_delete_constraint_low( ...@@ -3438,7 +3443,7 @@ row_delete_constraint_low(
"DELETE FROM SYS_FOREIGN_COLS WHERE ID = :id;\n" "DELETE FROM SYS_FOREIGN_COLS WHERE ID = :id;\n"
"DELETE FROM SYS_FOREIGN WHERE ID = :id;\n" "DELETE FROM SYS_FOREIGN WHERE ID = :id;\n"
"END;\n" "END;\n"
, trx)); , FALSE, trx));
} }
/******************************************************************** /********************************************************************
...@@ -3604,7 +3609,7 @@ row_rename_table_for_mysql( ...@@ -3604,7 +3609,7 @@ row_rename_table_for_mysql(
"UPDATE SYS_TABLES SET NAME = :new_table_name\n" "UPDATE SYS_TABLES SET NAME = :new_table_name\n"
" WHERE NAME = :old_table_name;\n" " WHERE NAME = :old_table_name;\n"
"END;\n" "END;\n"
, trx); , FALSE, trx);
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
...@@ -3641,7 +3646,8 @@ row_rename_table_for_mysql( ...@@ -3641,7 +3646,8 @@ row_rename_table_for_mysql(
" SELECT ID INTO foreign_id\n" " SELECT ID INTO foreign_id\n"
" FROM SYS_FOREIGN\n" " FROM SYS_FOREIGN\n"
" WHERE FOR_NAME = :old_table_name\n" " WHERE FOR_NAME = :old_table_name\n"
" AND TO_BINARY(FOR_NAME) = TO_BINARY(:old_table_name);\n" " AND TO_BINARY(FOR_NAME) = TO_BINARY(:old_table_name)\n"
" LOCK IN SHARE MODE;\n"
" IF (SQL % NOTFOUND) THEN\n" " IF (SQL % NOTFOUND) THEN\n"
" found := 0;\n" " found := 0;\n"
" ELSE\n" " ELSE\n"
...@@ -3677,7 +3683,7 @@ row_rename_table_for_mysql( ...@@ -3677,7 +3683,7 @@ row_rename_table_for_mysql(
"WHERE REF_NAME = :old_table_name\n" "WHERE REF_NAME = :old_table_name\n"
" AND TO_BINARY(REF_NAME) = TO_BINARY(:old_table_name);\n" " AND TO_BINARY(REF_NAME) = TO_BINARY(:old_table_name);\n"
"END;\n" "END;\n"
, trx); , FALSE, trx);
} else if (n_constraints_to_drop > 0) { } else if (n_constraints_to_drop > 0) {
/* Drop some constraints of tmp tables. */ /* Drop some constraints of tmp tables. */
......
...@@ -45,6 +45,9 @@ to que_run_threads: this is to allow canceling runaway queries */ ...@@ -45,6 +45,9 @@ to que_run_threads: this is to allow canceling runaway queries */
#define SEL_COST_LIMIT 100 #define SEL_COST_LIMIT 100
/* The lower limit for what we consider a "big" row */
#define BIG_ROW_SIZE 1024
/* Flags for search shortcut */ /* Flags for search shortcut */
#define SEL_FOUND 0 #define SEL_FOUND 0
#define SEL_EXHAUSTED 1 #define SEL_EXHAUSTED 1
...@@ -1132,11 +1135,12 @@ row_sel_try_search_shortcut( ...@@ -1132,11 +1135,12 @@ row_sel_try_search_shortcut(
ut_ad(plan->pcur.latch_mode == node->latch_mode); ut_ad(plan->pcur.latch_mode == node->latch_mode);
plan->n_rows_fetched++; plan->n_rows_fetched++;
ret = SEL_FOUND;
func_exit: func_exit:
if (UNIV_LIKELY_NULL(heap)) { if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap); mem_heap_free(heap);
} }
return(SEL_FOUND); return(ret);
} }
/************************************************************************* /*************************************************************************
...@@ -1240,7 +1244,8 @@ row_sel( ...@@ -1240,7 +1244,8 @@ row_sel(
mtr_start(&mtr); mtr_start(&mtr);
if (consistent_read && plan->unique_search && !plan->pcur_is_open 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) { if (!search_latch_locked) {
rw_lock_s_lock(&btr_search_latch); rw_lock_s_lock(&btr_search_latch);
...@@ -1354,6 +1359,12 @@ row_sel( ...@@ -1354,6 +1359,12 @@ row_sel(
if (srv_locks_unsafe_for_binlog if (srv_locks_unsafe_for_binlog
|| trx->isolation_level == TRX_ISO_READ_COMMITTED) { || trx->isolation_level == TRX_ISO_READ_COMMITTED) {
if (page_rec_is_supremum(next_rec)) {
goto skip_lock;
}
lock_type = LOCK_REC_NOT_GAP; lock_type = LOCK_REC_NOT_GAP;
} else { } else {
lock_type = LOCK_ORDINARY; lock_type = LOCK_ORDINARY;
...@@ -1372,6 +1383,7 @@ row_sel( ...@@ -1372,6 +1383,7 @@ row_sel(
} }
} }
skip_lock:
if (page_rec_is_infimum(rec)) { if (page_rec_is_infimum(rec)) {
/* The infimum record on a page cannot be in the result set, /* The infimum record on a page cannot be in the result set,
...@@ -1402,6 +1414,12 @@ row_sel( ...@@ -1402,6 +1414,12 @@ row_sel(
if (srv_locks_unsafe_for_binlog if (srv_locks_unsafe_for_binlog
|| trx->isolation_level == TRX_ISO_READ_COMMITTED) { || trx->isolation_level == TRX_ISO_READ_COMMITTED) {
if (page_rec_is_supremum(rec)) {
goto next_rec;
}
lock_type = LOCK_REC_NOT_GAP; lock_type = LOCK_REC_NOT_GAP;
} else { } else {
lock_type = LOCK_ORDINARY; lock_type = LOCK_ORDINARY;
...@@ -1628,7 +1646,8 @@ row_sel( ...@@ -1628,7 +1646,8 @@ row_sel(
} }
if ((plan->n_rows_fetched <= SEL_PREFETCH_LIMIT) 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 */ /* No prefetch in operation: go to the next table */
...@@ -1914,9 +1933,8 @@ row_sel_step( ...@@ -1914,9 +1933,8 @@ row_sel_step(
err = lock_table(0, table_node->table, err = lock_table(0, table_node->table,
i_lock_mode, thr); i_lock_mode, thr);
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
thr_get_trx(thr)->error_state = err;
que_thr_handle_error(thr, DB_ERROR,
NULL, 0);
return(NULL); return(NULL);
} }
...@@ -1952,17 +1970,8 @@ row_sel_step( ...@@ -1952,17 +1970,8 @@ row_sel_step(
thr->graph->last_sel_node = node; thr->graph->last_sel_node = node;
if (err == DB_SUCCESS) { if (err != DB_SUCCESS) {
/* Ok: do nothing */ thr_get_trx(thr)->error_state = err;
} 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);
return(NULL); return(NULL);
} }
...@@ -2023,7 +2032,7 @@ fetch_step( ...@@ -2023,7 +2032,7 @@ fetch_step(
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: fetch called on a closed cursor\n"); "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); return(NULL);
} }
......
...@@ -1984,12 +1984,7 @@ row_upd_step( ...@@ -1984,12 +1984,7 @@ row_upd_step(
error_handling: error_handling:
trx->error_state = err; trx->error_state = err;
if (err == DB_SUCCESS) { if (err != DB_SUCCESS) {
/* Ok: do nothing */
} else if (err == DB_LOCK_WAIT) {
return(NULL);
} else {
return(NULL); return(NULL);
} }
......
...@@ -1286,7 +1286,6 @@ trx_rollback_step( ...@@ -1286,7 +1286,6 @@ trx_rollback_step(
que_thr_t* thr) /* in: query thread */ que_thr_t* thr) /* in: query thread */
{ {
roll_node_t* node; roll_node_t* node;
ibool success;
ulint sig_no; ulint sig_no;
trx_savept_t* savept; trx_savept_t* savept;
...@@ -1313,19 +1312,13 @@ trx_rollback_step( ...@@ -1313,19 +1312,13 @@ trx_rollback_step(
/* Send a rollback signal to the transaction */ /* Send a rollback signal to the transaction */
success = trx_sig_send(thr_get_trx(thr), trx_sig_send(thr_get_trx(thr), sig_no, TRX_SIG_SELF, thr,
sig_no, TRX_SIG_SELF, savept, NULL);
thr, savept, NULL);
thr->state = QUE_THR_SIG_REPLY_WAIT; thr->state = QUE_THR_SIG_REPLY_WAIT;
mutex_exit(&kernel_mutex); mutex_exit(&kernel_mutex);
if (!success) {
/* Error in delivering the rollback signal */
que_thr_handle_error(thr, DB_ERROR, NULL, 0);
}
return(NULL); return(NULL);
} }
......
...@@ -1223,11 +1223,9 @@ trx_sig_is_compatible( ...@@ -1223,11 +1223,9 @@ trx_sig_is_compatible(
/******************************************************************** /********************************************************************
Sends a signal to a trx object. */ Sends a signal to a trx object. */
ibool void
trx_sig_send( trx_sig_send(
/*=========*/ /*=========*/
/* out: TRUE if the signal was
successfully delivered */
trx_t* trx, /* in: trx handle */ trx_t* trx, /* in: trx handle */
ulint type, /* in: signal type */ ulint type, /* in: signal type */
ulint sender, /* in: TRX_SIG_SELF or ulint sender, /* in: TRX_SIG_SELF or
...@@ -1254,11 +1252,9 @@ trx_sig_send( ...@@ -1254,11 +1252,9 @@ trx_sig_send(
if (!trx_sig_is_compatible(trx, type, sender)) { if (!trx_sig_is_compatible(trx, type, sender)) {
/* The signal is not compatible with the other signals in /* The signal is not compatible with the other signals in
the queue: do nothing */ the queue: die */
ut_error; ut_error;
return(FALSE);
} }
/* Queue the signal object */ /* Queue the signal object */
...@@ -1299,11 +1295,6 @@ trx_sig_send( ...@@ -1299,11 +1295,6 @@ trx_sig_send(
} }
if ((sender != TRX_SIG_SELF) || (type == TRX_SIG_BREAK_EXECUTION)) { if ((sender != TRX_SIG_SELF) || (type == TRX_SIG_BREAK_EXECUTION)) {
/* The following call will add a TRX_SIG_ERROR_OCCURRED
signal to the end of the queue, if the session is not yet
in the error state: */
ut_error; ut_error;
} }
...@@ -1314,8 +1305,6 @@ trx_sig_send( ...@@ -1314,8 +1305,6 @@ trx_sig_send(
trx_sig_start_handle(trx, next_thr); trx_sig_start_handle(trx, next_thr);
} }
return(TRUE);
} }
/******************************************************************** /********************************************************************
...@@ -1541,7 +1530,6 @@ trx_commit_step( ...@@ -1541,7 +1530,6 @@ trx_commit_step(
{ {
commit_node_t* node; commit_node_t* node;
que_thr_t* next_thr; que_thr_t* next_thr;
ibool success;
node = thr->run_node; node = thr->run_node;
...@@ -1562,16 +1550,11 @@ trx_commit_step( ...@@ -1562,16 +1550,11 @@ trx_commit_step(
/* Send the commit signal to the transaction */ /* Send the commit signal to the transaction */
success = trx_sig_send(thr_get_trx(thr), TRX_SIG_COMMIT, trx_sig_send(thr_get_trx(thr), TRX_SIG_COMMIT, TRX_SIG_SELF,
TRX_SIG_SELF, thr, NULL, &next_thr); thr, NULL, &next_thr);
mutex_exit(&kernel_mutex); mutex_exit(&kernel_mutex);
if (!success) {
/* Error in delivering the commit signal */
que_thr_handle_error(thr, DB_ERROR, NULL, 0);
}
return(next_thr); return(next_thr);
} }
......
...@@ -30,7 +30,8 @@ innobase_print_identifier( ...@@ -30,7 +30,8 @@ innobase_print_identifier(
/*======================*/ /*======================*/
FILE* f, /* in: output stream */ FILE* f, /* in: output stream */
trx_t* trx, /* in: transaction */ trx_t* trx, /* in: transaction */
ibool table_id,/* in: TRUE=decode table name */ ibool table_id,/* in: TRUE=print a table name,
FALSE=print other identifier */
const char* name, /* in: name to print */ const char* name, /* in: name to print */
ulint namelen);/* in: length of name */ ulint namelen);/* in: length of name */
#endif /* !UNIV_HOTBACKUP */ #endif /* !UNIV_HOTBACKUP */
...@@ -400,7 +401,8 @@ ut_print_name( ...@@ -400,7 +401,8 @@ ut_print_name(
/*==========*/ /*==========*/
FILE* f, /* in: output stream */ FILE* f, /* in: output stream */
trx_t* trx, /* in: transaction */ trx_t* trx, /* in: transaction */
ibool table_id,/* in: TRUE=decode table name */ ibool table_id,/* in: TRUE=print a table name,
FALSE=print other identifier */
const char* name) /* in: name to print */ const char* name) /* in: name to print */
{ {
ut_print_namel(f, trx, table_id, name, strlen(name)); ut_print_namel(f, trx, table_id, name, strlen(name));
...@@ -414,7 +416,8 @@ ut_print_namel( ...@@ -414,7 +416,8 @@ ut_print_namel(
/*===========*/ /*===========*/
FILE* f, /* in: output stream */ FILE* f, /* in: output stream */
trx_t* trx, /* in: transaction (NULL=no quotes) */ trx_t* trx, /* in: transaction (NULL=no quotes) */
ibool table_id,/* in: TRUE=decode table name */ ibool table_id,/* in: TRUE=print a table name,
FALSE=print other identifier */
const char* name, /* in: name to print */ const char* name, /* in: name to print */
ulint namelen)/* in: length of name */ ulint namelen)/* in: length of name */
{ {
......
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