maria-discuss team mailing list archive
Mailing list archive
Re: R: Doubt about 'atomic' insert
some more points, that i read at mysql documentation and mariadb jira (i
didn't read the mariadb kb yet)
reported at MDEV-7314, from Jean Weisbuch (jean@xxxxxxxxxx) ...
Hitting a duplicate key on such query means that no lock has been issued.
The KB on concurrent INSERTS on *MyISAM* states that :
If the binary log is used, CREATE TABLE ... SELECT and INSERT ...
SELECT statements cannot use concurrent inserts. These statements
acquire a read lock on the table, so concurrent inserts will need to
wait. This way the log can be safely used to restore data.
from mysql documentation
To ensure that the binary log can be used to re-create the original
tables, MySQL does not permit concurrent inserts for INSERT ... SELECT
The order in which rows are returned by a SELECT
<http://dev.mysql.com/doc/refman/5.7/en/select.html> statement with no ORDER
BY clause is not determined. This means that, when using replication, there
is no guarantee that such a SELECT returns rows in the same order on the
master and the slave; this can lead to inconsistencies between them. To
prevent this from occurring, you should always write INSERT ... SELECT
that are to be replicated as INSERT ... SELECT ... ORDER BY *column*. The
choice of *column* does not matter as long as the same order for returning
the rows is enforced on both the master and the slave. See also
“Replication and LIMIT”
Due to this issue, INSERT ... SELECT ON DUPLICATE KEY UPDATE
<http://dev.mysql.com/doc/refman/5.7/en/insert-on-duplicate.html> and INSERT
IGNORE ... SELECT
flagged as unsafe for statement-based replication. With this change, such
statements produce a warning in the log when using statement-based mode and
are logged using the row-based format when usingMIXED mode. (Bug #11758262,
See also Section 22.214.171.124, “Advantages and Disadvantages of Statement-Based
and Row-Based Replication”
In MySQL 5.7, an INSERT ... SELECT statement that acted on partitioned
tables using a storage engine such asMyISAM
employs table-level locks locks all partitions of the target table;
however, only those partitions that are actually read from the source table
are locked. (This does not occur with tables using storage engines such as
InnoDB <http://dev.mysql.com/doc/refman/5.7/en/innodb-storage-engine.html> that
employ row-level locking.) See Section 18.6.4, “Partitioning and Locking”
for more information.
126.96.36.199 Replication and LIMIT
Statement-based replication of LIMIT clauses in DELETE
<http://dev.mysql.com/doc/refman/5.7/en/update.html>, and INSERT ... SELECT
<http://dev.mysql.com/doc/refman/5.7/en/insert-select.html> statements is
unsafe since the order of the rows affected is not defined. (Such
statements can be replicated correctly with statement-based replication
only if they also contain an ORDER BY clause.) When such a statement is
When using STATEMENT mode, a warning that the statement is not safe for
statement-based replication is now issued.
Currently, when using STATEMENT mode, warnings are issued for DML
statements containing LIMIT even when they also have an ORDER BY clause
(and so are made deterministic). This is a known issue. (Bug #42851)
When using MIXED mode, the statement is now automatically replicated
using row-based mode.
i don't see a standard yet, any idea?