~jlukas79/+junk/mysql-server

« back to all changes in this revision

Viewing changes to sql/sql_insert.cc

manual merge 6.0-main --> 6.0-bka-review

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
#include "sql_show.h"
62
62
#include "slave.h"
63
63
#include "rpl_mi.h"
64
 
#include "backup/debug.h"
65
64
#include "sql_audit.h"
66
65
 
67
66
#ifndef EMBEDDED_LIBRARY
427
426
    */
428
427
    if (specialflag & (SPECIAL_NO_NEW_FUNC | SPECIAL_SAFE_MODE) ||
429
428
        thd->variables.max_insert_delayed_threads == 0 ||
430
 
        thd->prelocked_mode ||
 
429
        thd->locked_tables_mode > LTM_LOCK_TABLES ||
431
430
        thd->lex->uses_stored_routines())
432
431
    {
433
432
      *lock_type= TL_WRITE;
561
560
  bool transactional_table, joins_freed= FALSE;
562
561
  bool changed;
563
562
  bool was_insert_delayed= (table_list->lock_type ==  TL_WRITE_DELAYED);
 
563
  bool using_bulk_insert= 0;
564
564
  uint value_count;
565
565
  ulong counter = 1;
566
566
  ulonglong id;
597
597
    never be able to get a lock on the table. QQQ: why not
598
598
    upgrade the lock here instead?
599
599
  */
600
 
  if (table_list->lock_type == TL_WRITE_DELAYED && thd->locked_tables &&
601
 
      find_locked_table(thd, table_list->db, table_list->table_name))
 
600
  if (table_list->lock_type == TL_WRITE_DELAYED &&
 
601
      thd->locked_tables_mode &&
 
602
      find_locked_table(thd->open_tables, table_list->db,
 
603
                        table_list->table_name))
602
604
  {
603
605
    my_error(ER_DELAYED_INSERT_TABLE_LOCKED, MYF(0),
604
606
             table_list->table_name);
617
619
  }
618
620
  lock_type= table_list->lock_type;
619
621
 
620
 
  /*
621
 
    Breakpoints for backup testing.
622
 
  */
623
 
  BACKUP_BREAKPOINT("backup_cs_reading");
624
 
  BACKUP_BREAKPOINT("commit_blocker_step_1");
 
622
  DEBUG_SYNC(thd, "after_insert_locked_tables");
625
623
  thd_proc_info(thd, "init");
626
624
  thd->used_tables=0;
627
625
  values= its++;
702
700
  if (thd->slave_thread &&
703
701
      (info.handle_duplicates == DUP_UPDATE) &&
704
702
      (table->next_number_field != NULL) &&
705
 
      rpl_master_has_bug(&active_mi->rli, 24432))
 
703
      rpl_master_has_bug(&active_mi->rli, 24432, TRUE, NULL, NULL))
706
704
    goto abort;
707
705
#endif
708
706
 
709
707
  error=0;
710
708
  thd_proc_info(thd, "update");
711
 
  if (duplic != DUP_ERROR || ignore)
712
 
    table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
713
709
  if (duplic == DUP_REPLACE &&
714
710
      (!table->triggers || !table->triggers->has_delete_triggers()))
715
711
    table->file->extra(HA_EXTRA_WRITE_CAN_REPLACE);
727
723
    values_list.elements, and - if nothing else - to initialize
728
724
    the code to make the call of end_bulk_insert() below safe.
729
725
  */
730
 
  if (lock_type != TL_WRITE_DELAYED && !thd->prelocked_mode)
731
 
    table->file->ha_start_bulk_insert(values_list.elements);
 
726
#ifndef EMBEDDED_LIBRARY
 
727
  if (lock_type != TL_WRITE_DELAYED)
 
728
#endif /* EMBEDDED_LIBRARY */
 
729
  {
 
730
    if (duplic != DUP_ERROR || ignore)
 
731
      table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
 
732
    /**
 
733
      This is a simple check for the case when the table has a trigger
 
734
      that reads from it, or when the statement invokes a stored function
 
735
      that reads from the table being inserted to.
 
736
      Engines can't handle a bulk insert in parallel with a read form the
 
737
      same table in the same connection.
 
738
    */
 
739
    if ((thd->locked_tables_mode <= LTM_LOCK_TABLES) &&
 
740
        (values_list.elements > 1))
 
741
    {
 
742
      using_bulk_insert= 1;
 
743
      table->file->ha_start_bulk_insert(values_list.elements);
 
744
    }
 
745
  }
732
746
 
733
747
  thd->abort_on_warning= (!ignore && (thd->variables.sql_mode &
734
748
                                       (MODE_STRICT_TRANS_TABLES |
842
856
      auto_inc values from the delayed_insert thread as they share TABLE.
843
857
    */
844
858
    table->file->ha_release_auto_increment();
845
 
    if (!thd->prelocked_mode && table->file->ha_end_bulk_insert() && !error)
 
859
    if (using_bulk_insert && table->file->ha_end_bulk_insert(0) && !error)
846
860
    {
847
861
      table->file->print_error(my_errno,MYF(0));
848
862
      error=1;
849
863
    }
 
864
    if (duplic != DUP_ERROR || ignore)
 
865
      table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
 
866
 
850
867
    transactional_table= table->file->has_transactions();
851
868
 
852
869
    if ((changed= (info.copied || info.deleted || info.updated)))
939
956
  table->next_number_field=0;
940
957
  thd->count_cuted_fields= CHECK_FIELD_IGNORE;
941
958
  table->auto_increment_field_not_null= FALSE;
942
 
  if (duplic != DUP_ERROR || ignore)
943
 
    table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
944
959
  if (duplic == DUP_REPLACE &&
945
960
      (!table->triggers || !table->triggers->has_delete_triggers()))
946
961
    table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
1029
1044
 
1030
1045
  DBUG_ASSERT(view->table != 0 && view->field_translation != 0);
1031
1046
 
1032
 
  VOID(bitmap_init(&used_fields, used_fields_buff, table->s->fields, 0));
 
1047
  (void) bitmap_init(&used_fields, used_fields_buff, table->s->fields, 0);
1033
1048
  bitmap_clear_all(&used_fields);
1034
1049
 
1035
1050
  view->contain_auto_increment= 0;
1176
1191
  bool res= 0;
1177
1192
  table_map map= 0;
1178
1193
  DBUG_ENTER("mysql_prepare_insert");
1179
 
  DBUG_PRINT("enter", ("table_list 0x%lx, table 0x%lx, view %d",
1180
 
                       (ulong)table_list, (ulong)table,
 
1194
  DBUG_PRINT("enter", ("table_list %p table %p view %d",
 
1195
                       table_list, table,
1181
1196
                       (int)insert_into_view));
1182
1197
  /* INSERT should have a SELECT or VALUES clause */
1183
1198
  DBUG_ASSERT (!select_insert || !values);
1276
1291
    select_lex->fix_prepare_information(thd, &fake_conds, &fake_conds);
1277
1292
    select_lex->first_execution= 0;
1278
1293
  }
1279
 
  if (duplic == DUP_UPDATE || duplic == DUP_REPLACE)
 
1294
  /*
 
1295
    Only call prepare_for_posistion() if we are not performing a DELAYED
 
1296
    operation. It will instead be executed by delayed insert thread.
 
1297
  */
 
1298
  if ((duplic == DUP_UPDATE || duplic == DUP_REPLACE) &&
 
1299
      (table->reginfo.lock_type != TL_WRITE_DELAYED))
1280
1300
    table->prepare_for_position();
1281
1301
  DBUG_RETURN(FALSE);
1282
1302
}
1717
1737
    pthread_mutex_init(&mutex,MY_MUTEX_INIT_FAST);
1718
1738
    pthread_cond_init(&cond,NULL);
1719
1739
    pthread_cond_init(&cond_client,NULL);
1720
 
    VOID(pthread_mutex_lock(&LOCK_thread_count));
 
1740
    pthread_mutex_lock(&LOCK_thread_count);
1721
1741
    delayed_insert_threads++;
1722
 
    VOID(pthread_mutex_unlock(&LOCK_thread_count));
 
1742
    pthread_mutex_unlock(&LOCK_thread_count);
1723
1743
  }
1724
1744
  ~Delayed_insert()
1725
1745
  {
1729
1749
      delete row;
1730
1750
    if (table)
1731
1751
      close_thread_tables(&thd);
1732
 
    VOID(pthread_mutex_lock(&LOCK_thread_count));
 
1752
    pthread_mutex_lock(&LOCK_thread_count);
1733
1753
    pthread_mutex_destroy(&mutex);
1734
1754
    pthread_cond_destroy(&cond);
1735
1755
    pthread_cond_destroy(&cond_client);
1738
1758
    thd.security_ctx->user= thd.security_ctx->host=0;
1739
1759
    thread_count--;
1740
1760
    delayed_insert_threads--;
1741
 
    VOID(pthread_mutex_unlock(&LOCK_thread_count));
1742
 
    VOID(pthread_cond_broadcast(&COND_thread_count)); /* Tell main we are ready */
 
1761
    pthread_mutex_unlock(&LOCK_thread_count);
 
1762
    pthread_cond_broadcast(&COND_thread_count); /* Tell main we are ready */
1743
1763
  }
1744
1764
 
1745
1765
  /* The following is for checking when we can delete ourselves */
1765
1785
  inline uint lock_count() { return locks_in_memory; }
1766
1786
 
1767
1787
  TABLE* get_local_table(THD* client_thd);
 
1788
  bool open_and_lock_table();
1768
1789
  bool handle_inserts(void);
1769
1790
};
1770
1791
 
1871
1892
    if (! (di= find_handler(thd, table_list)))
1872
1893
    {
1873
1894
      if (!(di= new Delayed_insert()))
1874
 
      {
1875
 
        thd->fatal_error();
1876
1895
        goto end_create;
1877
 
      }
1878
1896
      pthread_mutex_lock(&LOCK_thread_count);
1879
1897
      thread_count++;
1880
1898
      pthread_mutex_unlock(&LOCK_thread_count);
1881
1899
      di->thd.set_db(table_list->db, strlen(table_list->db));
1882
 
      di->thd.query= my_strdup(table_list->table_name, MYF(MY_WME));
 
1900
      di->thd.query= my_strdup(table_list->table_name, MYF(MY_WME | ME_FATALERROR));
1883
1901
      if (di->thd.db == NULL || di->thd.query == NULL)
1884
1902
      {
1885
1903
        /* The error is reported */
1886
1904
        delete di;
1887
 
        thd->fatal_error();
1888
1905
        goto end_create;
1889
1906
      }
1890
1907
      di->table_list= *table_list;                      // Needed to open table
1902
1919
        pthread_mutex_unlock(&di->mutex);
1903
1920
        di->unlock();
1904
1921
        delete di;
1905
 
        my_error(ER_CANT_CREATE_THREAD, MYF(0), error);
1906
 
        thd->fatal_error();
 
1922
        my_error(ER_CANT_CREATE_THREAD, MYF(ME_FATALERROR), error);
1907
1923
        goto end_create;
1908
1924
      }
1909
1925
 
2202
2218
 
2203
2219
void kill_delayed_threads(void)
2204
2220
{
2205
 
  VOID(pthread_mutex_lock(&LOCK_delayed_insert)); // For unlink from list
 
2221
  pthread_mutex_lock(&LOCK_delayed_insert); // For unlink from list
2206
2222
 
2207
2223
  I_List_iterator<Delayed_insert> it(delayed_threads);
2208
2224
  Delayed_insert *di;
2227
2243
      pthread_mutex_unlock(&di->thd.mysys_var->mutex);
2228
2244
    }
2229
2245
  }
2230
 
  VOID(pthread_mutex_unlock(&LOCK_delayed_insert)); // For unlink from list
 
2246
  pthread_mutex_unlock(&LOCK_delayed_insert); // For unlink from list
 
2247
}
 
2248
 
 
2249
 
 
2250
/**
 
2251
   Open and lock table for use by delayed thread and check that
 
2252
   this table is suitable for delayed inserts.
 
2253
 
 
2254
   @retval FALSE - Success.
 
2255
   @retval TRUE  - Failure.
 
2256
*/
 
2257
 
 
2258
bool Delayed_insert::open_and_lock_table()
 
2259
{
 
2260
  if (!(table= open_n_lock_single_table(&thd, &table_list,
 
2261
                                        TL_WRITE_DELAYED, 0)))
 
2262
  {
 
2263
    thd.fatal_error();                          // Abort waiting inserts
 
2264
    return TRUE;
 
2265
  }
 
2266
  if (!(table->file->ha_table_flags() & HA_CAN_INSERT_DELAYED))
 
2267
  {
 
2268
    my_error(ER_DELAYED_NOT_SUPPORTED, MYF(ME_FATALERROR),
 
2269
             table_list.table_name);
 
2270
    return TRUE;
 
2271
  }
 
2272
  if (table->triggers)
 
2273
  {
 
2274
    /*
 
2275
      Table has triggers. This is not an error, but we do
 
2276
      not support triggers with delayed insert. Terminate the delayed
 
2277
      thread without an error and thus request lock upgrade.
 
2278
    */
 
2279
    return TRUE;
 
2280
  }
 
2281
  table->copy_blobs= 1;
 
2282
  return FALSE;
2231
2283
}
2232
2284
 
2233
2285
 
2293
2345
  thd->lex->set_stmt_unsafe();
2294
2346
  thd->set_current_stmt_binlog_row_based_if_mixed();
2295
2347
 
2296
 
  /* Open table */
2297
 
  if (!(di->table= open_n_lock_single_table(thd, &di->table_list,
2298
 
                                            TL_WRITE_DELAYED)))
2299
 
  {
2300
 
    thd->fatal_error();                         // Abort waiting inserts
2301
 
    goto err;
2302
 
  }
2303
 
  if (!(di->table->file->ha_table_flags() & HA_CAN_INSERT_DELAYED))
2304
 
  {
2305
 
    thd->fatal_error();
2306
 
    my_error(ER_ILLEGAL_HA, MYF(0), di->table_list.table_name);
2307
 
    goto err;
2308
 
  }
2309
 
  if (di->table->triggers)
2310
 
  {
2311
 
    /*
2312
 
      Table has triggers. This is not an error, but we do
2313
 
      not support triggers with delayed insert. Terminate the delayed
2314
 
      thread without an error and thus request lock upgrade.
2315
 
    */
2316
 
    goto err;
2317
 
  }
2318
 
  di->table->copy_blobs=1;
 
2348
  alloc_mdl_locks(&di->table_list, thd->mem_root);
 
2349
 
 
2350
  if (di->open_and_lock_table())
 
2351
    goto err;
2319
2352
 
2320
2353
  /* Tell client that the thread is initialized */
2321
2354
  pthread_cond_signal(&di->cond_client);
2390
2423
 
2391
2424
    if (di->tables_in_use && ! thd->lock)
2392
2425
    {
2393
 
      bool not_used;
 
2426
      bool need_reopen;
2394
2427
      /*
2395
2428
        Request for new delayed insert.
2396
2429
        Lock the table, but avoid to be blocked by a global read lock.
2403
2436
      */
2404
2437
      if (! (thd->lock= mysql_lock_tables(thd, &di->table, 1,
2405
2438
                                          MYSQL_LOCK_IGNORE_GLOBAL_READ_LOCK,
2406
 
                                          &not_used)))
 
2439
                                          &need_reopen)))
2407
2440
      {
2408
 
        /* Fatal error */
2409
 
        di->dead= 1;
2410
 
        thd->killed= THD::KILL_CONNECTION;
 
2441
        if (need_reopen)
 
2442
        {
 
2443
          /*
 
2444
            We were waiting to obtain TL_WRITE_DELAYED (probably due to
 
2445
            someone having or requesting TL_WRITE_ALLOW_READ) and got
 
2446
            aborted. Try to reopen table and if it fails die.
 
2447
          */
 
2448
          close_thread_tables(thd);
 
2449
          di->table= 0;
 
2450
          if (di->open_and_lock_table())
 
2451
          {
 
2452
            di->dead= 1;
 
2453
            thd->killed= THD::KILL_CONNECTION;
 
2454
          }
 
2455
        }
 
2456
        else
 
2457
        {
 
2458
          /* Fatal error */
 
2459
          di->dead= 1;
 
2460
          thd->killed= THD::KILL_CONNECTION;
 
2461
        }
2411
2462
      }
2412
2463
      pthread_cond_broadcast(&di->cond_client);
2413
2464
    }
2436
2487
      */
2437
2488
      di->table->file->ha_release_auto_increment();
2438
2489
      mysql_unlock_tables(thd, lock);
 
2490
      ha_autocommit_or_rollback(thd, 0);
2439
2491
      di->group_count=0;
2440
2492
      mysql_audit_release(thd);
2441
2493
      pthread_mutex_lock(&di->mutex);
2538
2590
 
2539
2591
  thd_proc_info(&thd, "insert");
2540
2592
  max_rows= delayed_insert_limit;
2541
 
  if (thd.killed || table->needs_reopen_or_name_lock())
 
2593
  if (thd.killed || table->needs_reopen())
2542
2594
  {
2543
2595
    thd.killed= THD::KILL_CONNECTION;
2544
2596
    max_rows= ULONG_MAX;                     // Do as much as possible
2946
2998
    lex->current_select->join->select_options|= OPTION_BUFFER_RESULT;
2947
2999
  }
2948
3000
  else if (!(lex->current_select->options & OPTION_BUFFER_RESULT) &&
2949
 
           !thd->prelocked_mode)
 
3001
           thd->locked_tables_mode <= LTM_LOCK_TABLES)
2950
3002
  {
2951
3003
    /*
2952
3004
      We must not yet prepare the result table if it is the same as one of the 
2966
3018
  if (thd->slave_thread &&
2967
3019
      (info.handle_duplicates == DUP_UPDATE) &&
2968
3020
      (table->next_number_field != NULL) &&
2969
 
      rpl_master_has_bug(&active_mi->rli, 24432))
 
3021
      rpl_master_has_bug(&active_mi->rli, 24432, TRUE, NULL, NULL))
2970
3022
    DBUG_RETURN(1);
2971
3023
#endif
2972
3024
 
3012
3064
{
3013
3065
  DBUG_ENTER("select_insert::prepare2");
3014
3066
  if (thd->lex->current_select->options & OPTION_BUFFER_RESULT &&
3015
 
      !thd->prelocked_mode)
 
3067
      thd->locked_tables_mode <= LTM_LOCK_TABLES)
3016
3068
    table->file->ha_start_bulk_insert((ha_rows) 0);
3017
3069
  DBUG_RETURN(0);
3018
3070
}
3132
3184
  DBUG_PRINT("enter", ("trans_table=%d, table_type='%s'",
3133
3185
                       trans_table, table->file->table_type()));
3134
3186
 
3135
 
  error= (!thd->prelocked_mode) ? table->file->ha_end_bulk_insert():0;
 
3187
  error= ((thd->locked_tables_mode <= LTM_LOCK_TABLES) ?
 
3188
          table->file->ha_end_bulk_insert(0) : 0);
3136
3189
  table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
3137
3190
  table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
3138
3191
 
3206
3259
      If we are not in prelocked mode, we end the bulk insert started
3207
3260
      before.
3208
3261
    */
3209
 
    if (!thd->prelocked_mode)
3210
 
      table->file->ha_end_bulk_insert();
 
3262
    if (thd->locked_tables_mode <= LTM_LOCK_TABLES)
 
3263
      table->file->ha_end_bulk_insert(0);
3211
3264
 
3212
3265
    /*
3213
3266
      If at least one row has been inserted/modified and will stay in
3306
3359
  Item *item;
3307
3360
  Field *tmp_field;
3308
3361
  bool not_used;
 
3362
  enum_open_table_action not_used2;
3309
3363
  DBUG_ENTER("create_table_from_items");
3310
3364
 
3311
3365
  DBUG_EXECUTE_IF("sleep_create_select_before_check_if_exists", my_sleep(6000000););
3312
3366
 
3313
 
  if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE) &&
3314
 
      create_table->table->db_stat)
 
3367
  if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE) &&  create_table->table)
3315
3368
  {
3316
3369
    /* Table already exists and was open at open_and_lock_tables() stage. */
3317
3370
    if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)
3403
3456
 
3404
3457
      if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE))
3405
3458
      {
3406
 
        VOID(pthread_mutex_lock(&LOCK_open));
3407
 
        if (reopen_name_locked_table(thd, create_table, FALSE))
 
3459
        enum enum_open_table_action ot_action_unused;
 
3460
        /*
 
3461
          Here we open the destination table, on which we already have
 
3462
          an exclusive metadata lock.
 
3463
        */
 
3464
        if (open_table(thd, create_table, thd->mem_root, &ot_action_unused,
 
3465
                       MYSQL_OPEN_REOPEN))
3408
3466
        {
 
3467
          pthread_mutex_lock(&LOCK_open);
3409
3468
          quick_rm_table(create_info->db_type, create_table->db,
3410
3469
                         table_case_name(create_info, create_table->table_name),
3411
3470
                         0);
 
3471
          pthread_mutex_unlock(&LOCK_open);
3412
3472
        }
3413
3473
        else
3414
3474
          table= create_table->table;
3415
 
        VOID(pthread_mutex_unlock(&LOCK_open));
3416
3475
      }
3417
3476
      else
3418
3477
      {
3419
 
        if (!(table= open_table(thd, create_table, thd->mem_root, (bool*) 0,
3420
 
                                MYSQL_OPEN_TEMPORARY_ONLY)) &&
 
3478
        if (open_table(thd, create_table, thd->mem_root, &not_used2,
 
3479
                       MYSQL_OPEN_TEMPORARY_ONLY) &&
3421
3480
            !create_info->table_existed)
3422
3481
        {
3423
3482
          /*
3427
3486
          */
3428
3487
          drop_temporary_table(thd, create_table);
3429
3488
        }
 
3489
        else
 
3490
          table= create_table->table;
3430
3491
      }
3431
3492
    }
3432
3493
    reenable_binlog(thd);
3438
3499
 
3439
3500
  table->reginfo.lock_type=TL_WRITE;
3440
3501
  hooks->prelock(&table, 1);                    // Call prelock hooks
 
3502
  /*
 
3503
    mysql_lock_tables() below should never fail with request to reopen table
 
3504
    since it won't wait for the table lock (we have exclusive metadata lock on
 
3505
    the table) and thus can't get aborted and since it ignores other threads
 
3506
    setting THD::some_tables_deleted thanks to MYSQL_LOCK_IGNORE_FLUSH.
 
3507
  */
3441
3508
  if (! ((*lock)= mysql_lock_tables(thd, &table, 1,
3442
3509
                                    MYSQL_LOCK_IGNORE_FLUSH, &not_used)) ||
3443
3510
        hooks->postlock(&table, 1))
3570
3637
    table->file->extra(HA_EXTRA_WRITE_CAN_REPLACE);
3571
3638
  if (info.handle_duplicates == DUP_UPDATE)
3572
3639
    table->file->extra(HA_EXTRA_INSERT_WITH_UPDATE);
3573
 
  if (!thd->prelocked_mode)
 
3640
  if (thd->locked_tables_mode <= LTM_LOCK_TABLES)
3574
3641
    table->file->ha_start_bulk_insert((ha_rows) 0);
3575
3642
  thd->abort_on_warning= (!info.ignore &&
3576
3643
                          (thd->variables.sql_mode &
3701
3768
  DBUG_ENTER("select_create::abort");
3702
3769
 
3703
3770
  /*
3704
 
   Disable binlog, because we "roll back" partial inserts in ::abort
3705
 
   by removing the table, even for non-transactional tables.
3706
 
  */
3707
 
  tmp_disable_binlog(thd);
3708
 
  /*
3709
3771
    In select_insert::abort() we roll back the statement, including
3710
 
    truncating the transaction cache of the binary log.
 
3772
    truncating the transaction cache of the binary log. To do this, we
 
3773
    pretend that the statement is transactional, even though it might
 
3774
    be the case that it was not.
3711
3775
 
3712
3776
    We roll back the statement prior to deleting the table and prior
3713
3777
    to releasing the lock on the table, since there might be potential
3718
3782
    of the table succeeded or not, since we need to reset the binary
3719
3783
    log state.
3720
3784
  */
 
3785
  tmp_disable_binlog(thd);
3721
3786
  select_insert::abort();
 
3787
  thd->transaction.stmt.modified_non_trans_table= FALSE;
3722
3788
  reenable_binlog(thd);
3723
 
 
 
3789
  thd->binlog_flush_pending_rows_event(TRUE);
3724
3790
 
3725
3791
  if (m_plock)
3726
3792
  {