This blog post explains the cause of “ERROR 1412 (HY000): Table definition has changed, please retry transaction” with the specific Isolation level settings. Background As per the MySQL documentation, this error should occur for “operations that make a temporary copy of the original table and delete the original table when the temporary copy is built.” […]
Percona XtraBackup is an open source hot backup utility for MySQL-based servers. To take consistent and hot backup, it uses various locking methods, especially for non-transactional storage engine tables. This blog post discusses the cause and possible solution for queries with Waiting for table flush state in processlist when taking backups using Percona XtraBackup. Only MySQL 5.7 version is affected by this, as per my tests.
Type of locks taken by Percona XtraBackup
Before discussing the main issue, let’s learn about the type of locks used by Percona XtraBackup to take consistent backups. Percona XtraBackup uses backup locks as a lightweight alternative to FLUSH TABLES WITH READ LOCK. This feature is …
[Read more]
Locking is an important concept in databases. They help regulate
access to the data, so your SELECT
queries return
consistent results and DML and DDL statements leave the data and
schema in a consistent state. For the data, there are four
different transaction isolation levels that influence which locks
are taken. The most two commonly used isolation levels are
REPEATABLE READ
(the default in InnoDB) and
READ COMMITTED
(the default in some other
databases). Both of those are said to provide non-locking reads,
but there is a little more to it than that.
Selecting into a user variable causing a lock wait timeout.
One case where reads are always locking is when you explicitly requests …
[Read more]
MySQL NDB Cluster uses row level locks instead of a single shared
commit lock in order to prevent inconsistency in simultaneous
distributed transactions. This gives NDB a great advantage over
all other MySQL clustering solutions and is one reason behind
cluster’s unmatched ability to scale both reads and
writes.
NDB is a transactional data store. The lowest and only isolation
level available in NDB is Read Committed. There are no dirty
reads in NDB and only committed rows can be read by other
transactions.
All write transactions in NDB will result in exclusive row locks
of all individual rows changed during the transaction. Any other
transaction is allowed to read any committed row independent of
their lock status. Reads are lock-free reads.
The great advantage is that committed reads in NDB never block
during writes to the same data and always the latest committed
changes are read. A select doesn't block concurrent …
Introduction Last week, Burkhard Graves asked me to answer the following StackOverflow question: And, since he wasn’t convinced about my answer: I decided to turn it into a dedicated article and explain how UPSERT and MERGE work in the top 4 most common relational database systems: Oracle, SQL Server, PostgreSQL, and MySQL. Domain Model For … Continue reading How do UPSERT and MERGE work in Oracle, SQL Server, PostgreSQL and MySQL →
The post How do UPSERT and MERGE work in Oracle, SQL Server, PostgreSQL and MySQL appeared first on Vlad Mihalcea's Blog.
What is the difference between InnoDB locks and transaction isolation level? We’ll discuss it in this post.
Recently I received a question from a user about one of my earlier blog posts. Since it wasn’t sent as a comment, I will answer it here. The question:
> I am reading your article:
>
https://www.percona.com/resources/technical-presentations/troubleshooting-locking-issues-percona-mysql-webinar
> Full table scan locks whole table.
> Some bad select (read) query can do full table scan on InnoDB, does it lock whole table please?
> My understanding was that SELECT (read) blocks another DML only in MyISAM.
To answer this question, we to need understand two different concepts: locking and …
[Read more]Each day there is probably work done to improve performance of the InnoDB storage engine and remove bottlenecks and scalability issues. Hence there was another one I wanted to highlight:
Scalability issues due to tables without primary keys
This scalability issue is caused by the usage of tables without primary keys. This issue typically shows itself as contention on the InnoDB dict_sys mutex. Now the dict_sys mutex controls access to the data dictionary. This mutex is used at various places. I will only mention a few of them:
- During operations such as opening and closing table handles, or
- When accessing I_S tables, or
- During undo of a freshly inserted row, or
- During other data dictionary modification operations such as CREATE TABLE, or
- Within the “Persistent Stats” subsystem, among other things.
Of course this list is not exhaustive but should …
[Read more]Read the original article at MySQL needs single master to check data integrity
MySQL slaves can drift out of sync. Many of our clients are surprised to find some data differences in their replication topology, once we do some checking and sniffing around. Such checks require a single reliable or authoritative master to compare against. Click through to the end for multi-master solutions that work with MySQL. Reason [...]
For more articles like these go to Sean Hull's Scalable Startups
Related posts:
[Read more]While most of the talk recently has mostly been around the new changes in MySQL 5.6 (and that is understandable), I have had lately some very interesting cases to deal with, with respect to the Metadata Locking related changes that were introduced in MySQL 5.5.3. It appears that the implications of Metadata Locking have not been covered well, and since there are still a large number of MySQL 5.0 and 5.1 installations that would upgrade or are in the process of upgrading to MySQL 5.5, I thought it necessary to discuss what these implications exactly are.
The post Implications of Metadata Locking Changes in MySQL 5.5 appeared first on ovais.tariq.
As an instructor with Percona I’m sometimes asked about the
differences between the READ COMMITTED and REPEATABLE READ
transaction isolation levels. There are a few differences
between READ-COMMITTED and REPEATABLE-READ, and they are all
related to locking.
Extra locking (not gap locking)
It is important to remember that InnoDB actually locks index
entries, not rows. During the execution of a statement InnoDB
must lock every entry in the index that it traverses to find the
rows it is modifying. It must do this to prevent deadlocks and
maintain the isolation level.
If you run an UPDATE that is not well indexed you will lock many rows:
update employees set store_id = 0 where store_id = 1; ---TRANSACTION 1EAB04, ACTIVE 7 sec 633 lock struct(s), heap size 96696, 218786 row lock(s), undo log entries 1 MySQL thread id 4, OS thread handle 0x7f8dfc35d700, query id 47 localhost root …[Read more]