@@ -115,14 +115,12 @@ class index_tuple_info_t {
115
115
@param[in,out] row_heap memory heap
116
116
@param[in] pcur cluster index scanning cursor
117
117
@param[in,out] scan_mtr mini-transaction for pcur
118
- @param[out] mtr_committed whether scan_mtr got committed
119
118
@return DB_SUCCESS if successful, else error number */
120
- dberr_t insert (
119
+ inline dberr_t insert (
121
120
trx_id_t trx_id,
122
121
mem_heap_t * row_heap,
123
122
btr_pcur_t * pcur,
124
- mtr_t * scan_mtr,
125
- bool * mtr_committed)
123
+ mtr_t * scan_mtr)
126
124
{
127
125
big_rec_t * big_rec;
128
126
rec_t * rec;
@@ -150,11 +148,10 @@ class index_tuple_info_t {
150
148
ut_ad (dtuple);
151
149
152
150
if (log_sys->check_flush_or_checkpoint ) {
153
- if (!(*mtr_committed )) {
151
+ if (scan_mtr-> is_active ( )) {
154
152
btr_pcur_move_to_prev_on_page (pcur);
155
153
btr_pcur_store_position (pcur, scan_mtr);
156
- mtr_commit (scan_mtr);
157
- *mtr_committed = true ;
154
+ scan_mtr->commit ();
158
155
}
159
156
160
157
log_free_check ();
@@ -1589,7 +1586,6 @@ row_mtuple_cmp(
1589
1586
@param[in,out] sp_heap heap for tuples
1590
1587
@param[in,out] pcur cluster index cursor
1591
1588
@param[in,out] mtr mini transaction
1592
- @param[in,out] mtr_committed whether scan_mtr got committed
1593
1589
@return DB_SUCCESS or error number */
1594
1590
static
1595
1591
dberr_t
@@ -1600,8 +1596,7 @@ row_merge_spatial_rows(
1600
1596
mem_heap_t * row_heap,
1601
1597
mem_heap_t * sp_heap,
1602
1598
btr_pcur_t * pcur,
1603
- mtr_t * mtr,
1604
- bool * mtr_committed)
1599
+ mtr_t * mtr)
1605
1600
{
1606
1601
dberr_t err = DB_SUCCESS;
1607
1602
@@ -1612,9 +1607,7 @@ row_merge_spatial_rows(
1612
1607
ut_ad (sp_heap != NULL );
1613
1608
1614
1609
for (ulint j = 0 ; j < num_spatial; j++) {
1615
- err = sp_tuples[j]->insert (
1616
- trx_id, row_heap,
1617
- pcur, mtr, mtr_committed);
1610
+ err = sp_tuples[j]->insert (trx_id, row_heap, pcur, mtr);
1618
1611
1619
1612
if (err != DB_SUCCESS) {
1620
1613
return (err);
@@ -1716,7 +1709,7 @@ row_merge_read_clustered_index(
1716
1709
struct TABLE * eval_table)
1717
1710
{
1718
1711
dict_index_t * clust_index; /* Clustered index */
1719
- mem_heap_t * row_heap; /* Heap memory to create
1712
+ mem_heap_t * row_heap = NULL ; /* Heap memory to create
1720
1713
clustered index tuples */
1721
1714
row_merge_buf_t ** merge_buf; /* Temporary list for records*/
1722
1715
mem_heap_t * v_heap = NULL ; /* Heap memory to process large
@@ -1903,22 +1896,19 @@ row_merge_read_clustered_index(
1903
1896
1904
1897
/* Scan the clustered index. */
1905
1898
for (;;) {
1906
- const rec_t * rec;
1907
- ulint* offsets;
1908
- const dtuple_t * row;
1909
- row_ext_t * ext;
1910
- page_cur_t * cur = btr_pcur_get_page_cur (&pcur);
1911
-
1912
- mem_heap_empty (row_heap);
1913
-
1914
1899
/* Do not continue if table pages are still encrypted */
1915
- if (!old_table->is_readable () ||
1916
- !new_table->is_readable ()) {
1900
+ if (!old_table->is_readable () || !new_table->is_readable ()) {
1917
1901
err = DB_DECRYPTION_FAILED;
1918
1902
trx->error_key_num = 0 ;
1919
1903
goto func_exit;
1920
1904
}
1921
1905
1906
+ const rec_t * rec;
1907
+ ulint* offsets;
1908
+ const dtuple_t * row;
1909
+ row_ext_t * ext;
1910
+ page_cur_t * cur = btr_pcur_get_page_cur (&pcur);
1911
+
1922
1912
mem_heap_empty (row_heap);
1923
1913
1924
1914
page_cur_move_to_next (cur);
@@ -1953,18 +1943,15 @@ row_merge_read_clustered_index(
1953
1943
dbug_run_purge = true ;);
1954
1944
1955
1945
/* Insert the cached spatial index rows. */
1956
- bool mtr_committed = false ;
1957
-
1958
1946
err = row_merge_spatial_rows (
1959
1947
trx->id , sp_tuples, num_spatial,
1960
- row_heap, sp_heap, &pcur,
1961
- &mtr, &mtr_committed);
1948
+ row_heap, sp_heap, &pcur, &mtr);
1962
1949
1963
1950
if (err != DB_SUCCESS) {
1964
1951
goto func_exit;
1965
1952
}
1966
1953
1967
- if (mtr_committed ) {
1954
+ if (!mtr. is_active () ) {
1968
1955
goto scan_next;
1969
1956
}
1970
1957
@@ -2019,7 +2006,9 @@ row_merge_read_clustered_index(
2019
2006
row = NULL ;
2020
2007
mtr_commit (&mtr);
2021
2008
mem_heap_free (row_heap);
2009
+ row_heap = NULL ;
2022
2010
ut_free (nonnull);
2011
+ nonnull = NULL ;
2023
2012
goto write_buffers;
2024
2013
}
2025
2014
} else {
@@ -2347,8 +2336,6 @@ row_merge_read_clustered_index(
2347
2336
/* Temporary File is not used.
2348
2337
so insert sorted block to the index */
2349
2338
if (row != NULL ) {
2350
- bool mtr_committed = false ;
2351
-
2352
2339
/* We have to do insert the
2353
2340
cached spatial index rows, since
2354
2341
after the mtr_commit, the cluster
@@ -2359,8 +2346,7 @@ row_merge_read_clustered_index(
2359
2346
trx->id , sp_tuples,
2360
2347
num_spatial,
2361
2348
row_heap, sp_heap,
2362
- &pcur, &mtr,
2363
- &mtr_committed);
2349
+ &pcur, &mtr);
2364
2350
2365
2351
if (err != DB_SUCCESS) {
2366
2352
goto func_exit;
@@ -2375,13 +2361,13 @@ row_merge_read_clustered_index(
2375
2361
current row will be invalid, and
2376
2362
we must reread it on the next
2377
2363
loop iteration. */
2378
- if (!mtr_committed ) {
2364
+ if (mtr. is_active () ) {
2379
2365
btr_pcur_move_to_prev_on_page (
2380
2366
&pcur);
2381
2367
btr_pcur_store_position (
2382
2368
&pcur, &mtr);
2383
2369
2384
- mtr_commit (& mtr);
2370
+ mtr. commit ( );
2385
2371
}
2386
2372
}
2387
2373
@@ -2536,7 +2522,7 @@ row_merge_read_clustered_index(
2536
2522
buf->n_tuples , path) < 0 ) {
2537
2523
err = DB_OUT_OF_MEMORY;
2538
2524
trx->error_key_num = i;
2539
- goto func_exit ;
2525
+ break ;
2540
2526
}
2541
2527
2542
2528
/* Ensure that duplicates in the
@@ -2614,12 +2600,12 @@ row_merge_read_clustered_index(
2614
2600
}
2615
2601
2616
2602
func_exit:
2617
- /* row_merge_spatial_rows may have committed
2618
- the mtr before an error occurs. */
2619
2603
if (mtr.is_active ()) {
2620
2604
mtr_commit (&mtr);
2621
2605
}
2622
- mem_heap_free (row_heap);
2606
+ if (row_heap) {
2607
+ mem_heap_free (row_heap);
2608
+ }
2623
2609
ut_free (nonnull);
2624
2610
2625
2611
all_done:
0 commit comments