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

Method handle_inserts

sql/sql_insert.cc:3860–4144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3858
3859
3860bool Delayed_insert::handle_inserts(void)
3861{
3862 int error;
3863 ulong max_rows;
3864 bool using_ignore= 0, using_opt_replace= 0, using_bin_log;
3865 delayed_row *row;
3866 Write_record write;
3867 DBUG_ENTER("handle_inserts");
3868
3869 /* Allow client to insert new rows */
3870 mysql_mutex_unlock(&mutex);
3871
3872 table->next_number_field=table->found_next_number_field;
3873 table->use_all_columns();
3874
3875 THD_STAGE_INFO(&thd, stage_upgrading_lock);
3876 if (thr_upgrade_write_delay_lock(*thd.lock->locks, delayed_lock,
3877 thd.variables.lock_wait_timeout))
3878 {
3879 /*
3880 This can happen if thread is killed either by a shutdown
3881 or if another thread is removing the current table definition
3882 from the table cache.
3883 */
3884 my_error(ER_DELAYED_CANT_CHANGE_LOCK, MYF(ME_FATAL | ME_ERROR_LOG),
3885 table->s->table_name.str);
3886 goto err;
3887 }
3888
3889 THD_STAGE_INFO(&thd, stage_insert);
3890 max_rows= delayed_insert_limit;
3891 if (thd.killed || table->s->tdc->flushed)
3892 {
3893 thd.set_killed(KILL_SYSTEM_THREAD);
3894 max_rows= ULONG_MAX; // Do as much as possible
3895 }
3896
3897 if (table->file->ha_rnd_init_with_error(0))
3898 goto err;
3899 /*
3900 We have to call prepare_for_row_logging() as the second call to
3901 handler_writes() will not have called decide_logging_format.
3902 */
3903 table->file->prepare_for_row_logging();
3904 table->file->prepare_for_modify(true, true);
3905 using_bin_log= table->file->row_logging;
3906
3907 /*
3908 We can't use row caching when using the binary log because if
3909 we get a crash, then binary log will contain rows that are not yet
3910 written to disk, which will cause problems in replication.
3911 */
3912 if (!using_bin_log && !table->s->long_unique_table)
3913 table->file->extra(HA_EXTRA_WRITE_CACHE);
3914
3915 mysql_mutex_lock(&mutex);
3916
3917 while ((row=rows.get()))

Callers 1

handle_delayed_insertFunction · 0.80

Calls 15

my_errorFunction · 0.85
set_delayed_insert_blobsFunction · 0.85
use_all_columnsMethod · 0.80
set_killedMethod · 0.80
prepare_for_modifyMethod · 0.80

Tested by

no test coverage detected