mirror of
https://github.com/MariaDB/server.git
synced 2026-05-16 11:57:38 +02:00
MDEV-12358 Work around what looks like a bug in GCC 7.1.0
The parameter thr of the function btr_cur_optimistic_insert() is not declared as nonnull, but GCC 7.1.0 with -O3 is wrongly optimizing away the first part of the condition UNIV_UNLIKELY(thr && thr_get_trx(thr)->fake_changes) when the function is being called by row_merge_insert_index_tuples() with thr==NULL. The fake_changes is an XtraDB addition. This GCC bug only appears to have an impact on XtraDB, not InnoDB. We work around the problem by not attempting to dereference thr when both BTR_NO_LOCKING_FLAG and BTR_NO_UNDO_LOG_FLAG are set in the flags. Probably BTR_NO_LOCKING_FLAG alone should suffice. btr_cur_optimistic_insert(), btr_cur_pessimistic_insert(), btr_cur_pessimistic_update(): Correct comments that disagree with usage and with nonnull attributes. No other parameter than thr can actually be NULL. row_ins_duplicate_error_in_clust(): Remove an unused parameter. innobase_is_fake_change(): Unused function; remove. ibuf_insert_low(), row_log_table_apply(), row_log_apply(), row_undo_mod_clust_low(): Because we will be passing BTR_NO_LOCKING_FLAG | BTR_NO_UNDO_LOG_FLAG in the flags, the trx->fake_changes flag will be treated as false, which is the right thing to do at these low-level operations (change buffer merge, ALTER TABLE…LOCK=NONE, or ROLLBACK). This might be fixing actual XtraDB bugs. Other callers that pass these two flags are also passing thr=NULL, implying fake_changes=false. (Some callers in ROLLBACK are passing BTR_NO_LOCKING_FLAG and a nonnull thr. In these callers, fake_changes better be false, to avoid corruption.)
This commit is contained in:
parent
e22d86a3eb
commit
9f89b94ba6
9 changed files with 86 additions and 87 deletions
|
|
@ -1,6 +1,7 @@
|
|||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
|
@ -2121,14 +2122,10 @@ for a clustered index!
|
|||
@retval DB_SUCCESS if no error
|
||||
@retval DB_DUPLICATE_KEY if error,
|
||||
@retval DB_LOCK_WAIT if we have to wait for a lock on a possible duplicate
|
||||
record
|
||||
@retval DB_SUCCESS_LOCKED_REC if an exact match of the record was found
|
||||
in online table rebuild (flags & (BTR_KEEP_SYS_FLAG | BTR_NO_LOCKING_FLAG)) */
|
||||
record */
|
||||
static MY_ATTRIBUTE((nonnull, warn_unused_result))
|
||||
dberr_t
|
||||
row_ins_duplicate_error_in_clust(
|
||||
/*=============================*/
|
||||
ulint flags, /*!< in: undo logging and locking flags */
|
||||
btr_cur_t* cursor, /*!< in: B-tree cursor */
|
||||
const dtuple_t* entry, /*!< in: entry to insert */
|
||||
que_thr_t* thr, /*!< in: query thread */
|
||||
|
|
@ -2386,7 +2383,7 @@ row_ins_clust_index_entry_low(
|
|||
DB_LOCK_WAIT */
|
||||
|
||||
err = row_ins_duplicate_error_in_clust(
|
||||
flags, &cursor, entry, thr, &mtr);
|
||||
&cursor, entry, thr, &mtr);
|
||||
}
|
||||
|
||||
if (err != DB_SUCCESS) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue