~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/row/row0mysql.c

  • Committer: Andrew Hutchings
  • Date: 2010-12-06 19:36:53 UTC
  • mfrom: (1976 staging)
  • mto: This revision was merged to the branch mainline in revision 1991.
  • Revision ID: andrew@linuxjedi.co.uk-20101206193653-l85vryv18jb0yxx8
Merge with trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
618
618
                      "InnoDB: " REFMAN "forcing-recovery.html"
619
619
                      " for help.\n", stderr);
620
620
                break;
621
 
        case DB_FOREIGN_EXCEED_MAX_CASCADE:
622
 
                fprintf(stderr, "InnoDB: Cannot delete/update rows with"
623
 
                        " cascading foreign key constraints that exceed max"
624
 
                        " depth of %lu\n"
625
 
                        "Please drop excessive foreign constraints"
626
 
                        " and try again\n", (ulong) DICT_FK_MAX_RECURSIVE_LOAD);
627
 
                break;
628
621
        default:
629
622
                fprintf(stderr, "InnoDB: unknown error code %lu\n",
630
623
                        (ulong) err);
1431
1424
run_again:
1432
1425
        thr->run_node = node;
1433
1426
        thr->prev_node = node;
1434
 
        thr->fk_cascade_depth = 0;
1435
1427
 
1436
1428
        row_upd_step(thr);
1437
1429
 
1438
 
        /* The recursive call for cascading update/delete happens
1439
 
        in above row_upd_step(), reset the counter once we come
1440
 
        out of the recursive call, so it does not accumulate for
1441
 
        different row deletes */
1442
 
        thr->fk_cascade_depth = 0;
1443
 
 
1444
1430
        err = trx->error_state;
1445
1431
 
1446
 
        /* Reset fk_cascade_depth back to 0 */
1447
 
        thr->fk_cascade_depth = 0;
1448
 
 
1449
1432
        if (err != DB_SUCCESS) {
1450
1433
                que_thr_stop_for_mysql(thr);
1451
1434
 
1482
1465
                srv_n_rows_updated++;
1483
1466
        }
1484
1467
 
1485
 
        /* We update table statistics only if it is a DELETE or UPDATE
1486
 
        that changes indexed columns, UPDATEs that change only non-indexed
1487
 
        columns would not affect statistics. */
1488
 
        if (node->is_delete || !(node->cmpl_info & UPD_NODE_NO_ORD_CHANGE)) {
1489
 
                row_update_statistics_if_needed(prebuilt->table);
1490
 
        }
 
1468
        row_update_statistics_if_needed(prebuilt->table);
1491
1469
 
1492
1470
        trx->op_info = "";
1493
1471
 
1641
1619
        trx_t*  trx;
1642
1620
 
1643
1621
        trx = thr_get_trx(thr);
1644
 
 
1645
 
        /* Increment fk_cascade_depth to record the recursive call depth on
1646
 
        a single update/delete that affects multiple tables chained
1647
 
        together with foreign key relations. */
1648
 
        thr->fk_cascade_depth++;
1649
 
 
1650
 
        if (thr->fk_cascade_depth > FK_MAX_CASCADE_DEL) {
1651
 
                return (DB_FOREIGN_EXCEED_MAX_CASCADE);
1652
 
        }
1653
1622
run_again:
1654
1623
        thr->run_node = node;
1655
1624
        thr->prev_node = node;
1656
1625
 
1657
1626
        row_upd_step(thr);
1658
1627
 
1659
 
        /* The recursive call for cascading update/delete happens
1660
 
        in above row_upd_step(), reset the counter once we come
1661
 
        out of the recursive call, so it does not accumulate for
1662
 
        different row deletes */
1663
 
        thr->fk_cascade_depth = 0;
1664
 
 
1665
1628
        err = trx->error_state;
1666
1629
 
1667
1630
        /* Note that the cascade node is a subnode of another InnoDB
2124
2087
                                              name, reject_fks);
2125
2088
        if (err == DB_SUCCESS) {
2126
2089
                /* Check that also referencing constraints are ok */
2127
 
                err = dict_load_foreigns(name, FALSE, TRUE);
 
2090
                err = dict_load_foreigns(name, TRUE);
2128
2091
        }
2129
2092
 
2130
2093
        if (err != DB_SUCCESS) {
2817
2780
 
2818
2781
        trx->table_id = table->id;
2819
2782
 
2820
 
        /* Lock all index trees for this table, as we will
2821
 
        truncate the table/index and possibly change their metadata.
2822
 
        All DML/DDL are blocked by table level lock, with
2823
 
        a few exceptions such as queries into information schema
2824
 
        about the table, MySQL could try to access index stats
2825
 
        for this kind of query, we need to use index locks to
2826
 
        sync up */
2827
 
        dict_table_x_lock_indexes(table);
2828
 
 
2829
2783
        if (table->space && !table->dir_path_of_temp_table) {
2830
2784
                /* Discard and create the single-table tablespace. */
2831
2785
                ulint   space   = table->space;
2842
2796
                            || fil_create_new_single_table_tablespace(
2843
2797
                                    space, table->name, FALSE, flags,
2844
2798
                                    FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) {
2845
 
                                dict_table_x_unlock_indexes(table);
2846
2799
                                ut_print_timestamp(stderr);
2847
2800
                                fprintf(stderr,
2848
2801
                                        "  InnoDB: TRUNCATE TABLE %s failed to"
2946
2899
 
2947
2900
        mem_heap_free(heap);
2948
2901
 
2949
 
        /* Done with index truncation, release index tree locks,
2950
 
        subsequent work relates to table level metadata change */
2951
 
        dict_table_x_unlock_indexes(table);
2952
 
 
2953
2902
        dict_hdr_get_new_id(&new_id, NULL, NULL);
2954
2903
 
2955
2904
        info = pars_info_create();
4001
3950
                an ALTER, not in a RENAME. */
4002
3951
 
4003
3952
                err = dict_load_foreigns(
4004
 
                        new_name, FALSE, !old_is_tmp || trx->check_foreigns);
 
3953
                        new_name, !old_is_tmp || trx->check_foreigns);
4005
3954
 
4006
3955
                if (err != DB_SUCCESS) {
4007
3956
                        ut_print_timestamp(stderr);