mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
d5bf6b8aa8
Normally, auto_increment value is generated for the column by inserting either NULL or 0 into it. NO_AUTO_VALUE_ON_ZERO suppresses this behavior for 0 so that only NULL generates the auto_increment value. This behavior is also followed by a slave, specifically by the SQL Thread, when applying events in the statement format from a master. However, when applying events in the row format, the flag was ignored thus causing an assertion failure: "Assertion failed: next_insert_id == 0, file .\handler.cc" In fact, we never need to generate a auto_increment value for the column when applying events in row format on slave. So we don't allow it to happen by using 'MODE_NO_AUTO_VALUE_ON_ZERO'. Refactoring: Get rid of all the sql_mode checks to rows_log_event when applying it for avoiding problems caused by the inconsistency of the sql_mode on slave and master as the sql_mode is not set for Rows_log_event. mysql-test/extra/rpl_tests/rpl_auto_increment.test: Added test to verify if the assertion of "next_insert_id == 0" will fail in ha_external_lock() function. mysql-test/suite/rpl/r/rpl_auto_increment.result: Test result for bug#56662. sql/log_event.cc: Added code to not allow generation of auto_increment value when processing rows event by adding 'MODE_NO_AUTO_VALUE_ON_ZERO' to sql_mode. sql/rpl_record.cc: Added code to get rid of the 'MODE_STRICT_TRANS_TABLES' and MODE_STRICT_ALL_TABLES check to the table when appling the rows event and treat it as no strict.
36 lines
1.3 KiB
C
36 lines
1.3 KiB
C
/* Copyright 2007 MySQL AB. All rights reserved.
|
|
|
|
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 Foundation; version 2 of the License.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
|
|
#ifndef RPL_RECORD_H
|
|
#define RPL_RECORD_H
|
|
|
|
#include <rpl_reporting.h>
|
|
|
|
#if !defined(MYSQL_CLIENT)
|
|
size_t pack_row(TABLE* table, MY_BITMAP const* cols,
|
|
uchar *row_data, const uchar *data);
|
|
#endif
|
|
|
|
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
|
|
int unpack_row(Relay_log_info const *rli,
|
|
TABLE *table, uint const colcnt,
|
|
uchar const *const row_data, MY_BITMAP const *cols,
|
|
uchar const **const row_end, ulong *const master_reclength);
|
|
|
|
// Fill table's record[0] with default values.
|
|
int prepare_record(TABLE *const table, const uint skip, const bool check);
|
|
#endif
|
|
|
|
#endif
|