MCPcopy Create free account
hub / github.com/MariaDB/server / open_and_lock_table

Method open_and_lock_table

sql/sql_insert.cc:3463–3500  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3461*/
3462
3463bool Delayed_insert::open_and_lock_table()
3464{
3465 Delayed_prelocking_strategy prelocking_strategy;
3466
3467 /*
3468 Use special prelocking strategy to get ER_DELAYED_NOT_SUPPORTED
3469 error for tables with engines which don't support delayed inserts.
3470
3471 We can't do auto-repair in insert delayed thread, as it would hang
3472 when trying to an exclusive MDL_LOCK on the table during repair
3473 as the connection thread has a SHARED_WRITE lock.
3474 */
3475 if (!(table= open_n_lock_single_table(&thd, &table_list,
3476 TL_WRITE_DELAYED,
3477 MYSQL_OPEN_IGNORE_GLOBAL_READ_LOCK |
3478 MYSQL_OPEN_IGNORE_REPAIR,
3479 &prelocking_strategy)))
3480 {
3481 /* If table was crashed, then upper level should retry open+repair */
3482 retry= table_list.crashed;
3483 thd.fatal_error(); // Abort waiting inserts
3484 return TRUE;
3485 }
3486
3487 if (table->triggers || table->check_constraints || table->internal_tables)
3488 {
3489 /*
3490 Table uses triggers, check constraints or sequences. This is not an error,
3491 but we do not support these with delayed insert. Terminate the delayed
3492 thread without an error and thus request lock upgrade.
3493 */
3494 return TRUE;
3495 }
3496 table->copy_blobs= 1;
3497
3498 table->file->prepare_for_row_logging();
3499 return FALSE;
3500}
3501
3502
3503/*

Callers 1

handle_delayed_insertFunction · 0.80

Calls 3

fatal_errorMethod · 0.80
open_n_lock_single_tableFunction · 0.70

Tested by

no test coverage detected