MDEV-17614 post-fix: Remove dead dup_chk_only=true code.

The parameter dup_chk_only was always passed as a constant false.
Remove the parameter and the dead code related to it.
This commit is contained in:
Marko Mäkelä 2019-09-23 08:29:39 +03:00
parent 44c5144943
commit 60cb5559a9
4 changed files with 20 additions and 56 deletions

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2018, MariaDB Corporation. Copyright (c) 2017, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
@ -92,10 +92,7 @@ row_ins_clust_index_entry_low(
ulint n_uniq, /*!< in: 0 or index->n_uniq */ ulint n_uniq, /*!< in: 0 or index->n_uniq */
dtuple_t* entry, /*!< in/out: index entry to insert */ dtuple_t* entry, /*!< in/out: index entry to insert */
ulint n_ext, /*!< in: number of externally stored columns */ ulint n_ext, /*!< in: number of externally stored columns */
que_thr_t* thr, /*!< in: query thread or NULL */ que_thr_t* thr) /*!< in: query thread or NULL */
bool dup_chk_only)
/*!< in: if true, just do duplicate check
and return. don't execute actual insert. */
MY_ATTRIBUTE((warn_unused_result)); MY_ATTRIBUTE((warn_unused_result));
/***************************************************************//** /***************************************************************//**
@ -120,10 +117,7 @@ row_ins_sec_index_entry_low(
dtuple_t* entry, /*!< in/out: index entry to insert */ dtuple_t* entry, /*!< in/out: index entry to insert */
trx_id_t trx_id, /*!< in: PAGE_MAX_TRX_ID during trx_id_t trx_id, /*!< in: PAGE_MAX_TRX_ID during
row_log_table_apply(), or 0 */ row_log_table_apply(), or 0 */
que_thr_t* thr, /*!< in: query thread */ que_thr_t* thr) /*!< in: query thread */
bool dup_chk_only)
/*!< in: if true, just do duplicate check
and return. don't execute actual insert. */
MY_ATTRIBUTE((warn_unused_result)); MY_ATTRIBUTE((warn_unused_result));
/***************************************************************//** /***************************************************************//**
@ -138,10 +132,7 @@ row_ins_clust_index_entry(
dict_index_t* index, /*!< in: clustered index */ dict_index_t* index, /*!< in: clustered index */
dtuple_t* entry, /*!< in/out: index entry to insert */ dtuple_t* entry, /*!< in/out: index entry to insert */
que_thr_t* thr, /*!< in: query thread */ que_thr_t* thr, /*!< in: query thread */
ulint n_ext, /*!< in: number of externally stored columns */ ulint n_ext) /*!< in: number of externally stored columns */
bool dup_chk_only)
/*!< in: if true, just do duplicate check
and return. don't execute actual insert. */
MY_ATTRIBUTE((warn_unused_result)); MY_ATTRIBUTE((warn_unused_result));
/***************************************************************//** /***************************************************************//**
Inserts an entry into a secondary index. Tries first optimistic, Inserts an entry into a secondary index. Tries first optimistic,
@ -154,10 +145,7 @@ row_ins_sec_index_entry(
/*====================*/ /*====================*/
dict_index_t* index, /*!< in: secondary index */ dict_index_t* index, /*!< in: secondary index */
dtuple_t* entry, /*!< in/out: index entry to insert */ dtuple_t* entry, /*!< in/out: index entry to insert */
que_thr_t* thr, /*!< in: query thread */ que_thr_t* thr) /*!< in: query thread */
bool dup_chk_only)
/*!< in: if true, just do duplicate check
and return. don't execute actual insert. */
MY_ATTRIBUTE((warn_unused_result)); MY_ATTRIBUTE((warn_unused_result));
/***********************************************************//** /***********************************************************//**
Inserts a row to a table. This is a high-level function used in Inserts a row to a table. This is a high-level function used in

View File

@ -2553,10 +2553,7 @@ row_ins_clust_index_entry_low(
ulint n_uniq, /*!< in: 0 or index->n_uniq */ ulint n_uniq, /*!< in: 0 or index->n_uniq */
dtuple_t* entry, /*!< in/out: index entry to insert */ dtuple_t* entry, /*!< in/out: index entry to insert */
ulint n_ext, /*!< in: number of externally stored columns */ ulint n_ext, /*!< in: number of externally stored columns */
que_thr_t* thr, /*!< in: query thread */ que_thr_t* thr) /*!< in: query thread */
bool dup_chk_only)
/*!< in: if true, just do duplicate check
and return. don't execute actual insert. */
{ {
btr_pcur_t pcur; btr_pcur_t pcur;
btr_cur_t* cursor; btr_cur_t* cursor;
@ -2676,11 +2673,6 @@ err_exit:
} }
} }
if (dup_chk_only) {
mtr_commit(&mtr);
goto func_exit;
}
/* Note: Allowing duplicates would qualify for modification of /* Note: Allowing duplicates would qualify for modification of
an existing record as the new entry is exactly same as old entry. */ an existing record as the new entry is exactly same as old entry. */
if (row_ins_must_modify_rec(cursor)) { if (row_ins_must_modify_rec(cursor)) {
@ -2840,10 +2832,7 @@ row_ins_sec_index_entry_low(
dtuple_t* entry, /*!< in/out: index entry to insert */ dtuple_t* entry, /*!< in/out: index entry to insert */
trx_id_t trx_id, /*!< in: PAGE_MAX_TRX_ID during trx_id_t trx_id, /*!< in: PAGE_MAX_TRX_ID during
row_log_table_apply(), or 0 */ row_log_table_apply(), or 0 */
que_thr_t* thr, /*!< in: query thread */ que_thr_t* thr) /*!< in: query thread */
bool dup_chk_only)
/*!< in: if true, just do duplicate check
and return. don't execute actual insert. */
{ {
DBUG_ENTER("row_ins_sec_index_entry_low"); DBUG_ENTER("row_ins_sec_index_entry_low");
@ -3040,10 +3029,6 @@ row_ins_sec_index_entry_low(
&cursor, 0, __FILE__, __LINE__, &mtr); &cursor, 0, __FILE__, __LINE__, &mtr);
} }
if (dup_chk_only) {
goto func_exit;
}
if (row_ins_must_modify_rec(&cursor)) { if (row_ins_must_modify_rec(&cursor)) {
/* There is already an index entry with a long enough common /* There is already an index entry with a long enough common
prefix, we must convert the insert into a modify of an prefix, we must convert the insert into a modify of an
@ -3132,10 +3117,7 @@ row_ins_clust_index_entry(
dict_index_t* index, /*!< in: clustered index */ dict_index_t* index, /*!< in: clustered index */
dtuple_t* entry, /*!< in/out: index entry to insert */ dtuple_t* entry, /*!< in/out: index entry to insert */
que_thr_t* thr, /*!< in: query thread */ que_thr_t* thr, /*!< in: query thread */
ulint n_ext, /*!< in: number of externally stored columns */ ulint n_ext) /*!< in: number of externally stored columns */
bool dup_chk_only)
/*!< in: if true, just do duplicate check
and return. don't execute actual insert. */
{ {
dberr_t err; dberr_t err;
ulint n_uniq; ulint n_uniq;
@ -3170,8 +3152,7 @@ row_ins_clust_index_entry(
err = row_ins_clust_index_entry_low( err = row_ins_clust_index_entry_low(
flags, BTR_MODIFY_LEAF, index, n_uniq, entry, flags, BTR_MODIFY_LEAF, index, n_uniq, entry,
n_ext, thr, dup_chk_only); n_ext, thr);
DEBUG_SYNC_C_IF_THD(thr_get_trx(thr)->mysql_thd, DEBUG_SYNC_C_IF_THD(thr_get_trx(thr)->mysql_thd,
"after_row_ins_clust_index_entry_leaf"); "after_row_ins_clust_index_entry_leaf");
@ -3186,7 +3167,7 @@ row_ins_clust_index_entry(
err = row_ins_clust_index_entry_low( err = row_ins_clust_index_entry_low(
flags, BTR_MODIFY_TREE, index, n_uniq, entry, flags, BTR_MODIFY_TREE, index, n_uniq, entry,
n_ext, thr, dup_chk_only); n_ext, thr);
DBUG_RETURN(err); DBUG_RETURN(err);
} }
@ -3202,10 +3183,7 @@ row_ins_sec_index_entry(
/*====================*/ /*====================*/
dict_index_t* index, /*!< in: secondary index */ dict_index_t* index, /*!< in: secondary index */
dtuple_t* entry, /*!< in/out: index entry to insert */ dtuple_t* entry, /*!< in/out: index entry to insert */
que_thr_t* thr, /*!< in: query thread */ que_thr_t* thr) /*!< in: query thread */
bool dup_chk_only)
/*!< in: if true, just do duplicate check
and return. don't execute actual insert. */
{ {
dberr_t err; dberr_t err;
mem_heap_t* offsets_heap; mem_heap_t* offsets_heap;
@ -3248,7 +3226,7 @@ row_ins_sec_index_entry(
err = row_ins_sec_index_entry_low( err = row_ins_sec_index_entry_low(
flags, BTR_MODIFY_LEAF, index, offsets_heap, heap, entry, flags, BTR_MODIFY_LEAF, index, offsets_heap, heap, entry,
trx_id, thr, dup_chk_only); trx_id, thr);
if (err == DB_FAIL) { if (err == DB_FAIL) {
mem_heap_empty(heap); mem_heap_empty(heap);
@ -3262,8 +3240,7 @@ row_ins_sec_index_entry(
err = row_ins_sec_index_entry_low( err = row_ins_sec_index_entry_low(
flags, BTR_MODIFY_TREE, index, flags, BTR_MODIFY_TREE, index,
offsets_heap, heap, entry, 0, thr, offsets_heap, heap, entry, 0, thr);
dup_chk_only);
} }
mem_heap_free(heap); mem_heap_free(heap);
@ -3292,9 +3269,9 @@ row_ins_index_entry(
return(DB_LOCK_WAIT);}); return(DB_LOCK_WAIT);});
if (dict_index_is_clust(index)) { if (dict_index_is_clust(index)) {
return(row_ins_clust_index_entry(index, entry, thr, 0, false)); return(row_ins_clust_index_entry(index, entry, thr, 0));
} else { } else {
return(row_ins_sec_index_entry(index, entry, thr, false)); return(row_ins_sec_index_entry(index, entry, thr));
} }
} }

View File

@ -1524,7 +1524,7 @@ row_log_table_apply_insert_low(
error = row_ins_clust_index_entry_low( error = row_ins_clust_index_entry_low(
flags, BTR_MODIFY_TREE, index, index->n_uniq, flags, BTR_MODIFY_TREE, index, index->n_uniq,
entry, 0, thr, false); entry, 0, thr);
switch (error) { switch (error) {
case DB_SUCCESS: case DB_SUCCESS:
@ -1547,8 +1547,7 @@ row_log_table_apply_insert_low(
entry = row_build_index_entry(row, NULL, index, heap); entry = row_build_index_entry(row, NULL, index, heap);
error = row_ins_sec_index_entry_low( error = row_ins_sec_index_entry_low(
flags, BTR_MODIFY_TREE, flags, BTR_MODIFY_TREE,
index, offsets_heap, heap, entry, trx_id, thr, index, offsets_heap, heap, entry, trx_id, thr);
false);
if (error != DB_SUCCESS) { if (error != DB_SUCCESS) {
if (error == DB_DUPLICATE_KEY) { if (error == DB_DUPLICATE_KEY) {
@ -2178,7 +2177,7 @@ func_exit_committed:
BTR_CREATE_FLAG | BTR_NO_LOCKING_FLAG BTR_CREATE_FLAG | BTR_NO_LOCKING_FLAG
| BTR_NO_UNDO_LOG_FLAG | BTR_KEEP_SYS_FLAG, | BTR_NO_UNDO_LOG_FLAG | BTR_KEEP_SYS_FLAG,
BTR_MODIFY_TREE, index, offsets_heap, heap, BTR_MODIFY_TREE, index, offsets_heap, heap,
entry, trx_id, thr, false); entry, trx_id, thr);
/* Report correct index name for duplicate key error. */ /* Report correct index name for duplicate key error. */
if (error == DB_DUPLICATE_KEY) { if (error == DB_DUPLICATE_KEY) {

View File

@ -2524,7 +2524,7 @@ row_upd_sec_index_entry(
ut_a(entry); ut_a(entry);
/* Insert new index entry */ /* Insert new index entry */
err = row_ins_sec_index_entry(index, entry, thr, false); err = row_ins_sec_index_entry(index, entry, thr);
func_exit: func_exit:
mem_heap_free(heap); mem_heap_free(heap);
@ -2795,7 +2795,7 @@ check_fk:
err = row_ins_clust_index_entry( err = row_ins_clust_index_entry(
index, entry, thr, index, entry, thr,
node->upd_ext ? node->upd_ext->n_ext : 0, false); node->upd_ext ? node->upd_ext->n_ext : 0);
node->state = UPD_NODE_INSERT_CLUSTERED; node->state = UPD_NODE_INSERT_CLUSTERED;
mem_heap_free(heap); mem_heap_free(heap);