~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/row/row0ins.cc

  • Committer: Monty Taylor
  • Date: 2011-02-13 17:26:39 UTC
  • mfrom: (2157.2.2 give-in-to-pkg-config)
  • mto: This revision was merged to the branch mainline in revision 2166.
  • Revision ID: mordred@inaugust.com-20110213172639-nhy7i72sfhoq13ms
Merged in pkg-config fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
 
3
Copyright (C) 1996, 2010, Innobase Oy. All Rights Reserved.
4
4
 
5
5
This program is free software; you can redistribute it and/or modify it under
6
6
the terms of the GNU General Public License as published by the Free Software
51
51
#define ROW_INS_PREV    1
52
52
#define ROW_INS_NEXT    2
53
53
 
 
54
/*************************************************************************
 
55
IMPORTANT NOTE: Any operation that generates redo MUST check that there
 
56
is enough space in the redo log before for that operation. This is
 
57
done by calling log_free_check(). The reason for checking the
 
58
availability of the redo log space before the start of the operation is
 
59
that we MUST not hold any synchonization objects when performing the
 
60
check.
 
61
If you make a change in this module make sure that no codepath is
 
62
introduced where a call to log_free_check() is bypassed. */
54
63
 
55
64
/*********************************************************************//**
56
65
Creates an insert node struct.
65
74
{
66
75
        ins_node_t*     node;
67
76
 
68
 
        node = mem_heap_alloc(heap, sizeof(ins_node_t));
 
77
        node = static_cast<ins_node_t *>(mem_heap_alloc(heap, sizeof(ins_node_t)));
69
78
 
70
79
        node->common.type = QUE_NODE_INSERT;
71
80
 
78
87
 
79
88
        node->select = NULL;
80
89
 
81
 
        node->trx_id = ut_dulint_zero;
 
90
        node->trx_id = 0;
82
91
 
83
92
        node->entry_sys_heap = mem_heap_create(128);
84
93
 
141
150
 
142
151
        dfield = dtuple_get_nth_field(row, dict_col_get_no(col));
143
152
 
144
 
        ptr = mem_heap_zalloc(heap, DATA_ROW_ID_LEN);
 
153
        ptr = static_cast<byte *>(mem_heap_zalloc(heap, DATA_ROW_ID_LEN));
145
154
 
146
155
        dfield_set_data(dfield, ptr, DATA_ROW_ID_LEN);
147
156
 
152
161
        col = dict_table_get_sys_col(table, DATA_TRX_ID);
153
162
 
154
163
        dfield = dtuple_get_nth_field(row, dict_col_get_no(col));
155
 
        ptr = mem_heap_zalloc(heap, DATA_TRX_ID_LEN);
 
164
        ptr = static_cast<byte *>(mem_heap_zalloc(heap, DATA_TRX_ID_LEN));
156
165
 
157
166
        dfield_set_data(dfield, ptr, DATA_TRX_ID_LEN);
158
167
 
163
172
        col = dict_table_get_sys_col(table, DATA_ROLL_PTR);
164
173
 
165
174
        dfield = dtuple_get_nth_field(row, dict_col_get_no(col));
166
 
        ptr = mem_heap_zalloc(heap, DATA_ROLL_PTR_LEN);
 
175
        ptr = static_cast<byte *>(mem_heap_zalloc(heap, DATA_ROLL_PTR_LEN));
167
176
 
168
177
        dfield_set_data(dfield, ptr, DATA_ROLL_PTR_LEN);
169
178
}
198
207
        /* As we allocated a new trx id buf, the trx id should be written
199
208
        there again: */
200
209
 
201
 
        node->trx_id = ut_dulint_zero;
 
210
        node->trx_id = 0;
202
211
}
203
212
 
204
213
/*******************************************************************//**
362
371
 
363
372
        while (que_node_get_type(parent) == QUE_NODE_UPDATE) {
364
373
 
365
 
                upd_node = parent;
 
374
                upd_node = static_cast<upd_node_t *>(parent);
366
375
 
367
376
                if (upd_node->table == table && upd_node->is_delete == FALSE) {
368
377
 
506
515
 
507
516
                                if (!dfield_is_null(&ufield->new_val)
508
517
                                    && dtype_get_at_most_n_mbchars(
509
 
                                        col->prtype,
510
 
                                        col->mbminlen, col->mbmaxlen,
 
518
                                        col->prtype, col->mbminmaxlen,
511
519
                                        col->len,
512
520
                                        ufield_len,
513
 
                                        dfield_get_data(&ufield->new_val))
 
521
                                        static_cast<const char *>(dfield_get_data(&ufield->new_val)))
514
522
                                    < ufield_len) {
515
523
 
516
524
                                        return(ULINT_UNDEFINED);
530
538
 
531
539
                                if (min_size > ufield_len) {
532
540
 
533
 
                                        char*           pad_start;
534
 
                                        const char*     pad_end;
535
 
                                        char*           padded_data
536
 
                                                = mem_heap_alloc(
537
 
                                                        heap, min_size);
538
 
                                        pad_start = padded_data + ufield_len;
539
 
                                        pad_end = padded_data + min_size;
 
541
                                        byte*   pad;
 
542
                                        ulint   pad_len;
 
543
                                        byte*   padded_data;
 
544
                                        ulint   mbminlen;
 
545
 
 
546
                                        padded_data = static_cast<unsigned char *>(mem_heap_alloc(
 
547
                                                heap, min_size));
 
548
 
 
549
                                        pad = padded_data + ufield_len;
 
550
                                        pad_len = min_size - ufield_len;
540
551
 
541
552
                                        memcpy(padded_data,
542
553
                                               dfield_get_data(&ufield
543
554
                                                               ->new_val),
544
 
                                               dfield_get_len(&ufield
545
 
                                                              ->new_val));
546
 
 
547
 
                                        switch (UNIV_EXPECT(col->mbminlen,1)) {
548
 
                                        default:
549
 
                                                ut_error;
 
555
                                               ufield_len);
 
556
 
 
557
                                        mbminlen = dict_col_get_mbminlen(col);
 
558
 
 
559
                                        ut_ad(!(ufield_len % mbminlen));
 
560
                                        ut_ad(!(min_size % mbminlen));
 
561
 
 
562
                                        if (mbminlen == 1
 
563
                                            && dtype_get_charset_coll(
 
564
                                                    col->prtype)
 
565
                                            == DATA_MYSQL_BINARY_CHARSET_COLL) {
 
566
                                                /* Do not pad BINARY columns */
550
567
                                                return(ULINT_UNDEFINED);
551
 
                                        case 1:
552
 
                                                if (UNIV_UNLIKELY
553
 
                                                    (dtype_get_charset_coll(
554
 
                                                            col->prtype)
555
 
                                                     == DATA_MYSQL_BINARY_CHARSET_COLL)) {
556
 
                                                        /* Do not pad BINARY
557
 
                                                        columns. */
558
 
                                                        return(ULINT_UNDEFINED);
559
 
                                                }
560
 
 
561
 
                                                /* space=0x20 */
562
 
                                                memset(pad_start, 0x20,
563
 
                                                       pad_end - pad_start);
564
 
                                                break;
565
 
                                        case 2:
566
 
                                                /* space=0x0020 */
567
 
                                                ut_a(!(ufield_len % 2));
568
 
                                                ut_a(!(min_size % 2));
569
 
                                                do {
570
 
                                                        *pad_start++ = 0x00;
571
 
                                                        *pad_start++ = 0x20;
572
 
                                                } while (pad_start < pad_end);
573
 
                                                break;
574
568
                                        }
575
569
 
 
570
                                        row_mysql_pad_col(mbminlen,
 
571
                                                          pad, pad_len);
576
572
                                        dfield_set_data(&ufield->new_val,
577
573
                                                        padded_data, min_size);
578
574
                                }
805
801
 
806
802
        row_ins_invalidate_query_cache(thr, table->name);
807
803
 
808
 
        node = thr->run_node;
 
804
        node = static_cast<upd_node_t *>(thr->run_node);
809
805
 
810
806
        if (node->is_delete && 0 == (foreign->type
811
807
                                     & (DICT_FOREIGN_ON_DELETE_CASCADE
1122
1118
/*********************************************************************//**
1123
1119
Sets a shared lock on a record. Used in locking possible duplicate key
1124
1120
records and also in checking foreign key constraints.
1125
 
@return DB_SUCCESS or error code */
 
1121
@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, or error code */
1126
1122
static
1127
 
ulint
 
1123
enum db_err
1128
1124
row_ins_set_shared_rec_lock(
1129
1125
/*========================*/
1130
1126
        ulint                   type,   /*!< in: LOCK_ORDINARY, LOCK_GAP, or
1135
1131
        const ulint*            offsets,/*!< in: rec_get_offsets(rec, index) */
1136
1132
        que_thr_t*              thr)    /*!< in: query thread */
1137
1133
{
1138
 
        ulint   err;
 
1134
        enum db_err     err;
1139
1135
 
1140
1136
        ut_ad(rec_offs_validate(rec, index, offsets));
1141
1137
 
1153
1149
/*********************************************************************//**
1154
1150
Sets a exclusive lock on a record. Used in locking possible duplicate key
1155
1151
records
1156
 
@return DB_SUCCESS or error code */
 
1152
@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, or error code */
1157
1153
static
1158
 
ulint
 
1154
enum db_err
1159
1155
row_ins_set_exclusive_rec_lock(
1160
1156
/*===========================*/
1161
1157
        ulint                   type,   /*!< in: LOCK_ORDINARY, LOCK_GAP, or
1166
1162
        const ulint*            offsets,/*!< in: rec_get_offsets(rec, index) */
1167
1163
        que_thr_t*              thr)    /*!< in: query thread */
1168
1164
{
1169
 
        ulint   err;
 
1165
        enum db_err     err;
1170
1166
 
1171
1167
        ut_ad(rec_offs_validate(rec, index, offsets));
1172
1168
 
1206
1202
        dict_index_t*   check_index;
1207
1203
        ulint           n_fields_cmp;
1208
1204
        btr_pcur_t      pcur;
1209
 
        ibool           moved;
1210
1205
        int             cmp;
1211
1206
        ulint           err;
1212
1207
        ulint           i;
1243
1238
        }
1244
1239
 
1245
1240
        if (que_node_get_type(thr->run_node) == QUE_NODE_UPDATE) {
1246
 
                upd_node = thr->run_node;
 
1241
                upd_node = static_cast<upd_node_t *>(thr->run_node);
1247
1242
 
1248
1243
                if (!(upd_node->is_delete) && upd_node->foreign == foreign) {
1249
1244
                        /* If a cascaded update is done as defined by a
1337
1332
 
1338
1333
        /* Scan index records and check if there is a matching record */
1339
1334
 
1340
 
        for (;;) {
 
1335
        do {
1341
1336
                const rec_t*            rec = btr_pcur_get_rec(&pcur);
1342
1337
                const buf_block_t*      block = btr_pcur_get_block(&pcur);
1343
1338
 
1344
1339
                if (page_rec_is_infimum(rec)) {
1345
1340
 
1346
 
                        goto next_rec;
 
1341
                        continue;
1347
1342
                }
1348
1343
 
1349
1344
                offsets = rec_get_offsets(rec, check_index,
1354
1349
                        err = row_ins_set_shared_rec_lock(LOCK_ORDINARY, block,
1355
1350
                                                          rec, check_index,
1356
1351
                                                          offsets, thr);
1357
 
                        if (err != DB_SUCCESS) {
1358
 
 
1359
 
                                break;
 
1352
                        switch (err) {
 
1353
                        case DB_SUCCESS_LOCKED_REC:
 
1354
                        case DB_SUCCESS:
 
1355
                                continue;
 
1356
                        default:
 
1357
                                goto end_scan;
1360
1358
                        }
1361
 
 
1362
 
                        goto next_rec;
1363
1359
                }
1364
1360
 
1365
1361
                cmp = cmp_dtuple_rec(entry, rec, offsets);
1370
1366
                                err = row_ins_set_shared_rec_lock(
1371
1367
                                        LOCK_ORDINARY, block,
1372
1368
                                        rec, check_index, offsets, thr);
1373
 
                                if (err != DB_SUCCESS) {
1374
 
 
 
1369
                                switch (err) {
 
1370
                                case DB_SUCCESS_LOCKED_REC:
 
1371
                                case DB_SUCCESS:
1375
1372
                                        break;
 
1373
                                default:
 
1374
                                        goto end_scan;
1376
1375
                                }
1377
1376
                        } else {
1378
1377
                                /* Found a matching record. Lock only
1383
1382
                                        LOCK_REC_NOT_GAP, block,
1384
1383
                                        rec, check_index, offsets, thr);
1385
1384
 
1386
 
                                if (err != DB_SUCCESS) {
1387
 
 
 
1385
                                switch (err) {
 
1386
                                case DB_SUCCESS_LOCKED_REC:
 
1387
                                case DB_SUCCESS:
1388
1388
                                        break;
 
1389
                                default:
 
1390
                                        goto end_scan;
1389
1391
                                }
1390
1392
 
1391
1393
                                if (check_ref) {
1392
1394
                                        err = DB_SUCCESS;
1393
1395
 
1394
 
                                        break;
 
1396
                                        goto end_scan;
1395
1397
                                } else if (foreign->type != 0) {
1396
1398
                                        /* There is an ON UPDATE or ON DELETE
1397
1399
                                        condition: check them in a separate
1417
1419
                                                        err = DB_FOREIGN_DUPLICATE_KEY;
1418
1420
                                                }
1419
1421
 
1420
 
                                                break;
 
1422
                                                goto end_scan;
1421
1423
                                        }
1422
1424
 
1423
1425
                                        /* row_ins_foreign_check_on_constraint
1430
1432
                                                thr, foreign, rec, entry);
1431
1433
 
1432
1434
                                        err = DB_ROW_IS_REFERENCED;
1433
 
                                        break;
 
1435
                                        goto end_scan;
1434
1436
                                }
1435
1437
                        }
1436
 
                }
 
1438
                } else {
 
1439
                        ut_a(cmp < 0);
1437
1440
 
1438
 
                if (cmp < 0) {
1439
1441
                        err = row_ins_set_shared_rec_lock(
1440
1442
                                LOCK_GAP, block,
1441
1443
                                rec, check_index, offsets, thr);
1442
 
                        if (err != DB_SUCCESS) {
1443
 
 
1444
 
                                break;
1445
 
                        }
1446
 
 
1447
 
                        if (check_ref) {
1448
 
                                err = DB_NO_REFERENCED_ROW;
1449
 
                                row_ins_foreign_report_add_err(
1450
 
                                        trx, foreign, rec, entry);
1451
 
                        } else {
1452
 
                                err = DB_SUCCESS;
1453
 
                        }
1454
 
 
1455
 
                        break;
1456
 
                }
1457
 
 
1458
 
                ut_a(cmp == 0);
1459
 
next_rec:
1460
 
                moved = btr_pcur_move_to_next(&pcur, &mtr);
1461
 
 
1462
 
                if (!moved) {
1463
 
                        if (check_ref) {
1464
 
                                rec = btr_pcur_get_rec(&pcur);
1465
 
                                row_ins_foreign_report_add_err(
1466
 
                                        trx, foreign, rec, entry);
1467
 
                                err = DB_NO_REFERENCED_ROW;
1468
 
                        } else {
1469
 
                                err = DB_SUCCESS;
1470
 
                        }
1471
 
 
1472
 
                        break;
1473
 
                }
 
1444
 
 
1445
                        switch (err) {
 
1446
                        case DB_SUCCESS_LOCKED_REC:
 
1447
                        case DB_SUCCESS:
 
1448
                                if (check_ref) {
 
1449
                                        err = DB_NO_REFERENCED_ROW;
 
1450
                                        row_ins_foreign_report_add_err(
 
1451
                                                trx, foreign, rec, entry);
 
1452
                                } else {
 
1453
                                        err = DB_SUCCESS;
 
1454
                                }
 
1455
                        }
 
1456
 
 
1457
                        goto end_scan;
 
1458
                }
 
1459
        } while (btr_pcur_move_to_next(&pcur, &mtr));
 
1460
 
 
1461
        if (check_ref) {
 
1462
                row_ins_foreign_report_add_err(
 
1463
                        trx, foreign, btr_pcur_get_rec(&pcur), entry);
 
1464
                err = DB_NO_REFERENCED_ROW;
 
1465
        } else {
 
1466
                err = DB_SUCCESS;
1474
1467
        }
1475
1468
 
 
1469
end_scan:
1476
1470
        btr_pcur_close(&pcur);
1477
1471
 
1478
1472
        mtr_commit(&mtr);
1720
1714
                                rec, index, offsets, thr);
1721
1715
                }
1722
1716
 
1723
 
                if (err != DB_SUCCESS) {
1724
 
 
 
1717
                switch (err) {
 
1718
                case DB_SUCCESS_LOCKED_REC:
 
1719
                        err = DB_SUCCESS;
 
1720
                case DB_SUCCESS:
1725
1721
                        break;
 
1722
                default:
 
1723
                        goto end_scan;
1726
1724
                }
1727
1725
 
1728
1726
                if (page_rec_is_supremum(rec)) {
1739
1737
 
1740
1738
                                thr_get_trx(thr)->error_info = index;
1741
1739
 
1742
 
                                break;
 
1740
                                goto end_scan;
1743
1741
                        }
1744
 
                }
1745
 
 
1746
 
                if (cmp < 0) {
1747
 
                        break;
1748
 
                }
1749
 
 
1750
 
                ut_a(cmp == 0);
 
1742
                } else {
 
1743
                        ut_a(cmp < 0);
 
1744
                        goto end_scan;
 
1745
                }
1751
1746
        } while (btr_pcur_move_to_next(&pcur, &mtr));
1752
1747
 
 
1748
end_scan:
1753
1749
        if (UNIV_LIKELY_NULL(heap)) {
1754
1750
                mem_heap_free(heap);
1755
1751
        }
1773
1769
row_ins_duplicate_error_in_clust(
1774
1770
/*=============================*/
1775
1771
        btr_cur_t*      cursor, /*!< in: B-tree cursor */
1776
 
        dtuple_t*       entry,  /*!< in: entry to insert */
 
1772
        const dtuple_t* entry,  /*!< in: entry to insert */
1777
1773
        que_thr_t*      thr,    /*!< in: query thread */
1778
1774
        mtr_t*          mtr)    /*!< in: mtr */
1779
1775
{
1838
1834
                                        cursor->index, offsets, thr);
1839
1835
                        }
1840
1836
 
1841
 
                        if (err != DB_SUCCESS) {
 
1837
                        switch (err) {
 
1838
                        case DB_SUCCESS_LOCKED_REC:
 
1839
                        case DB_SUCCESS:
 
1840
                                break;
 
1841
                        default:
1842
1842
                                goto func_exit;
1843
1843
                        }
1844
1844
 
1878
1878
                                        rec, cursor->index, offsets, thr);
1879
1879
                        }
1880
1880
 
1881
 
                        if (err != DB_SUCCESS) {
 
1881
                        switch (err) {
 
1882
                        case DB_SUCCESS_LOCKED_REC:
 
1883
                        case DB_SUCCESS:
 
1884
                                break;
 
1885
                        default:
1882
1886
                                goto func_exit;
1883
1887
                        }
1884
1888
 
1961
1965
                                depending on whether we wish optimistic or
1962
1966
                                pessimistic descent down the index tree */
1963
1967
        dict_index_t*   index,  /*!< in: index */
1964
 
        dtuple_t*       entry,  /*!< in: index entry to insert */
 
1968
        dtuple_t*       entry,  /*!< in/out: index entry to insert */
1965
1969
        ulint           n_ext,  /*!< in: number of externally stored columns */
1966
1970
        que_thr_t*      thr)    /*!< in: query thread */
1967
1971
{
1968
1972
        btr_cur_t       cursor;
1969
 
        ulint           ignore_sec_unique       = 0;
 
1973
        ulint           search_mode;
1970
1974
        ulint           modify = 0; /* remove warning */
1971
1975
        rec_t*          insert_rec;
1972
1976
        rec_t*          rec;
1986
1990
        the function will return in both low_match and up_match of the
1987
1991
        cursor sensible values */
1988
1992
 
1989
 
        if (!(thr_get_trx(thr)->check_unique_secondary)) {
1990
 
                ignore_sec_unique = BTR_IGNORE_SEC_UNIQUE;
 
1993
        if (dict_index_is_clust(index)) {
 
1994
                search_mode = mode;
 
1995
        } else if (!(thr_get_trx(thr)->check_unique_secondary)) {
 
1996
                search_mode = mode | BTR_INSERT | BTR_IGNORE_SEC_UNIQUE;
 
1997
        } else {
 
1998
                search_mode = mode | BTR_INSERT;
1991
1999
        }
1992
2000
 
1993
2001
        btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE,
1994
 
                                    mode | BTR_INSERT | ignore_sec_unique,
 
2002
                                    search_mode,
1995
2003
                                    &cursor, 0, __FILE__, __LINE__, &mtr);
1996
2004
 
1997
2005
        if (cursor.flag == BTR_CUR_INSERT_TO_IBUF) {
1998
2006
                /* The insertion was made to the insert buffer already during
1999
2007
                the search: we are done */
2000
2008
 
 
2009
                ut_ad(search_mode & BTR_INSERT);
2001
2010
                err = DB_SUCCESS;
2002
2011
 
2003
2012
                goto function_exit;
2101
2110
        mtr_commit(&mtr);
2102
2111
 
2103
2112
        if (UNIV_LIKELY_NULL(big_rec)) {
2104
 
                rec_t*  rec;
 
2113
                rec_t*  exit_rec;
2105
2114
                ulint*  offsets;
2106
2115
                mtr_start(&mtr);
2107
2116
 
2108
2117
                btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE,
2109
2118
                                            BTR_MODIFY_TREE, &cursor, 0,
2110
2119
                                            __FILE__, __LINE__, &mtr);
2111
 
                rec = btr_cur_get_rec(&cursor);
2112
 
                offsets = rec_get_offsets(rec, index, NULL,
 
2120
                exit_rec = btr_cur_get_rec(&cursor);
 
2121
                offsets = rec_get_offsets(exit_rec, index, NULL,
2113
2122
                                          ULINT_UNDEFINED, &heap);
2114
2123
 
2115
2124
                err = btr_store_big_rec_extern_fields(
2116
2125
                        index, btr_cur_get_block(&cursor),
2117
 
                        rec, offsets, big_rec, &mtr);
 
2126
                        exit_rec, offsets, big_rec, &mtr);
2118
2127
 
2119
2128
                if (modify) {
2120
2129
                        dtuple_big_rec_free(big_rec);
2142
2151
row_ins_index_entry(
2143
2152
/*================*/
2144
2153
        dict_index_t*   index,  /*!< in: index */
2145
 
        dtuple_t*       entry,  /*!< in: index entry to insert */
 
2154
        dtuple_t*       entry,  /*!< in/out: index entry to insert */
2146
2155
        ulint           n_ext,  /*!< in: number of externally stored columns */
2147
 
        ibool           foreign,/*!< in: TRUE=check foreign key constraints */
 
2156
        ibool           foreign,/*!< in: TRUE=check foreign key constraints
 
2157
                                (foreign=FALSE only during CREATE INDEX) */
2148
2158
        que_thr_t*      thr)    /*!< in: query thread */
2149
2159
{
2150
 
        ulint   err;
 
2160
        enum db_err     err;
2151
2161
 
2152
2162
        if (foreign && UT_LIST_GET_FIRST(index->table->foreign_list)) {
2153
 
                err = row_ins_check_foreign_constraints(index->table, index,
2154
 
                                                        entry, thr);
 
2163
                err = static_cast<db_err>(row_ins_check_foreign_constraints(index->table, index,
 
2164
                                                        entry, thr));
2155
2165
                if (err != DB_SUCCESS) {
2156
2166
 
2157
2167
                        return(err);
2160
2170
 
2161
2171
        /* Try first optimistic descent to the B-tree */
2162
2172
 
2163
 
        err = row_ins_index_entry_low(BTR_MODIFY_LEAF, index, entry,
2164
 
                                      n_ext, thr);
 
2173
        err = static_cast<db_err>(row_ins_index_entry_low(BTR_MODIFY_LEAF, index, entry,
 
2174
                                      n_ext, thr));
2165
2175
        if (err != DB_FAIL) {
2166
2176
 
2167
2177
                return(err);
2169
2179
 
2170
2180
        /* Try then pessimistic descent to the B-tree */
2171
2181
 
2172
 
        err = row_ins_index_entry_low(BTR_MODIFY_TREE, index, entry,
2173
 
                                      n_ext, thr);
 
2182
        err = static_cast<db_err>(row_ins_index_entry_low(BTR_MODIFY_TREE, index, entry,
 
2183
                                      n_ext, thr));
2174
2184
        return(err);
2175
2185
}
2176
2186
 
2211
2221
                                = dict_field_get_col(ind_field);
2212
2222
 
2213
2223
                        len = dtype_get_at_most_n_mbchars(
2214
 
                                col->prtype, col->mbminlen, col->mbmaxlen,
 
2224
                                col->prtype, col->mbminmaxlen,
2215
2225
                                ind_field->prefix_len,
2216
 
                                len, dfield_get_data(row_field));
 
2226
                                len, static_cast<const char *>(dfield_get_data(row_field)));
2217
2227
 
2218
2228
                        ut_ad(!dfield_is_ext(row_field));
2219
2229
                }
2237
2247
        ins_node_t*     node,   /*!< in: row insert node */
2238
2248
        que_thr_t*      thr)    /*!< in: query thread */
2239
2249
{
2240
 
        ulint   err;
 
2250
        enum db_err     err;
2241
2251
 
2242
2252
        ut_ad(dtuple_check_typed(node->row));
2243
2253
 
2245
2255
 
2246
2256
        ut_ad(dtuple_check_typed(node->entry));
2247
2257
 
2248
 
        err = row_ins_index_entry(node->index, node->entry, 0, TRUE, thr);
 
2258
        err = static_cast<db_err>(row_ins_index_entry(node->index, node->entry, 0, TRUE, thr));
2249
2259
 
2250
2260
        return(err);
2251
2261
}
2258
2268
/*======================*/
2259
2269
        ins_node_t*     node)   /*!< in: row insert node */
2260
2270
{
2261
 
        dulint  row_id;
 
2271
        row_id_t        row_id;
2262
2272
 
2263
2273
        ut_ad(node->state == INS_NODE_ALLOC_ROW_ID);
2264
2274
 
2417
2427
 
2418
2428
        trx_start_if_not_started(trx);
2419
2429
 
2420
 
        node = thr->run_node;
 
2430
        node = static_cast<ins_node_t *>(thr->run_node);
2421
2431
 
2422
2432
        ut_ad(que_node_get_type(node) == QUE_NODE_INSERT);
2423
2433
 
2445
2455
                /* It may be that the current session has not yet started
2446
2456
                its transaction, or it has been committed: */
2447
2457
 
2448
 
                if (UT_DULINT_EQ(trx->id, node->trx_id)) {
 
2458
                if (trx->id == node->trx_id) {
2449
2459
                        /* No need to do IX-locking */
2450
2460
 
2451
2461
                        goto same_trx;