1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

Don't give warning if there are two unique keys used with INSERT .. ON DUPLICATE KEY UPDATE.

We should assume that the store engine will report the first duplicate key for this case.

Old code of suppression of unsafe logging error with LIMIT didn't work, because of wrong usage of my_interval_timer().

Suppress unsafe logging errors to the error log if we get too many unsafe logging errors in a short time.
This is to not overflow the error log with meaningless errors.

- Each error code is suppressed and counted separately.
- We do a 5 minute suppression of new errors if we get more than 10 errors in that time.

Only print unsafe logging errors if log_warnings > 1.



mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result:
  Update test results as INSERT ... ON DUPLICATE KEY UPDATE doesn't get logged anymore
mysql-test/suite/binlog/r/binlog_unsafe.result:
  Update test results as INSERT ... ON DUPLICATE KEY UPDATE doesn't get logged anymore
mysql-test/suite/engines/README:
  Fixed typos
mysql-test/suite/rpl/r/rpl_known_bugs_detection.result:
  Update test results as INSERT ... ON DUPLICATE KEY UPDATE doesn't get logged anymore
sql/sql_base.cc:
  Don't log warning if there are two unique keys used with INSERT .. ON DUPLICATE KEY UPDATE.
  We should assume that the store engine will report the first duplicate key for this case.
sql/sql_class.cc:
  Suppress error in binary log if we get too many unsafe logging errors in a short time.
  Only print unsafe logging errors if log_warnings > 1
This commit is contained in:
Michael Widenius
2014-09-16 00:00:47 +03:00
parent e167c48a9f
commit 8e4566e912
6 changed files with 109 additions and 105 deletions

View File

@ -5304,6 +5304,7 @@ bool lock_tables(THD *thd, TABLE_LIST *tables, uint count,
thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_AUTOINC_NOT_FIRST);
}
#ifdef NOT_USED_IN_MARIADB
/*
INSERT...ON DUPLICATE KEY UPDATE on a table with more than one unique keys
can be unsafe.
@ -5329,6 +5330,7 @@ bool lock_tables(THD *thd, TABLE_LIST *tables, uint count,
thd->lex->duplicates == DUP_UPDATE)
thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_INSERT_TWO_KEYS);
}
#endif
/* We have to emulate LOCK TABLES if we are statement needs prelocking. */
if (thd->lex->requires_prelocking())