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

Method Delayed_insert

sql/sql_insert.cc:2668–2705  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2666 */
2667 MDL_request grl_protection;
2668 Delayed_insert(LEX *lex)
2669 :locks_in_memory(0), thd(next_thread_id()),
2670 table(0),tables_in_use(0), stacked_inserts(0),
2671 status(0), retry(0), handler_thread_initialized(FALSE), group_count(0)
2672 {
2673 DBUG_ENTER("Delayed_insert constructor");
2674 thd.security_ctx->user=(char*) delayed_user;
2675 thd.security_ctx->host=(char*) my_localhost;
2676 thd.security_ctx->ip= NULL;
2677 thd.query_id= 0;
2678 strmake_buf(thd.security_ctx->priv_user, thd.security_ctx->user);
2679 thd.current_tablenr=0;
2680 thd.set_command(COM_DELAYED_INSERT);
2681 thd.lex->current_select= lex->current_select;
2682 thd.lex->sql_command= lex->sql_command; // For innodb::store_lock()
2683 thd.lex->duplicates= lex->duplicates;
2684 /*
2685 Prevent changes to global.lock_wait_timeout from affecting
2686 delayed insert threads as any timeouts in delayed inserts
2687 are not communicated to the client.
2688 */
2689 thd.variables.lock_wait_timeout= LONG_TIMEOUT;
2690
2691 bzero((char*) &thd.net, sizeof(thd.net)); // Safety
2692 bzero((char*) &table_list, sizeof(table_list)); // Safety
2693 thd.system_thread= SYSTEM_THREAD_DELAYED_INSERT;
2694 thd.security_ctx->host_or_ip= "";
2695 bzero((char*) &info,sizeof(info));
2696 mysql_mutex_init(key_delayed_insert_mutex, &mutex, MY_MUTEX_INIT_FAST);
2697 mysql_cond_init(key_delayed_insert_cond, &cond, NULL);
2698 mysql_cond_init(key_delayed_insert_cond_client, &cond_client, NULL);
2699 mysql_mutex_lock(&LOCK_delayed_insert);
2700 delayed_insert_threads++;
2701 mysql_mutex_unlock(&LOCK_delayed_insert);
2702 delayed_lock= global_system_variables.low_priority_updates ?
2703 TL_WRITE_LOW_PRIORITY : TL_WRITE;
2704 DBUG_VOID_RETURN;
2705 }
2706 ~Delayed_insert() override
2707 {
2708 /* The following is not really needed, but just for safety */

Callers

nothing calls this directly

Calls 2

next_thread_idFunction · 0.85
set_commandMethod · 0.45

Tested by

no test coverage detected