In my previous post I talked about a transaction
which blocked other transactions without doing anything. I talked
about finding data from the blocking transaction using SYS and
performance_schema.
But what are the possible solutions?
The first solution is to (automatically) kill the blocking
transactions. Long running transactions can also stall the
purging in InnoDB. See this blog post by Mark Leith about a possible
solution.
The second solution would be make the application end the
transaction sooner and/or to commit more often. Depending on your
application this might or might not work. I consider this the
best solution.
The …
When I queried information_schema.innodb_trx (introduced in 5.1
with the InnoDB Plugin) I noticed there were a few transactions
in LOCK WAIT state.
Example:
mysql [information_schema] > select trx_id,trx_state
-> from information_schema.innodb_trx;
+--------+-----------+
| trx_id | trx_state |
+--------+-----------+
| 7974 | LOCK WAIT |
| 7962 | RUNNING |
+--------+-----------+
2 rows in set (0.00 sec)
Then I made a query to join a few information_schema and
performance_schema tables to find out which query was blocking my
transactions. It turned out that the blocking transaction had a
trx_query=NONE. So my query was block by a transaction doing
nothing. That's not really helpful.
Let's try to recreate the situation and see exactly what
happened. I'll use two sessions for the transactions and a third
to monitor the server.
…
Yesterday (Oct. 22) I gave a presentation titled “MySQL 5.6 Full Text Search Throwdown.” If you missed it, you can still register to view the recording and my slides.
Thanks to everyone who attended, and especially to folks who asked the great questions. I answered as many as we had time for during the session, but here are all the questions with my complete answers:
Q: Does Solr automatically maintain its index against MySQL? Do you have to hit the Solr server with a specific query to keep the index ‘warm’?
There are several strategies for updating a Solr …
[Read more]As a part of improving the error handling, in MySQL 5.7.5 we have re-implemented STRICT sql mode.
STRICT mode in MySQL affects the errors that arise from invalid, missing, or out of range values in DML statements such as INSERT, UPDATE, and DELETE. The new implementation aims to make the behavior of STRICT mode more consistent, yet maintain backward compatibility as much as possible.
In MySQL 5.7.5, we have made three general improvements to STRICT mode behavior:
1. STRICT mode got simpler
It was observed that having a large number of sql modes dependent on STRICT mode creates confusion among users. Specifically, we are talking about NO_ZERO_DATE, NO_ZERO_IN_DATE and ERROR_FOR_DIVISION_BY_ZERO modes. You can se further details on the above sql modes here. These modes only …
[Read more]With a last minute change to the host_summary_by_stages view for the 1.2.0 release of the sys schema, I managed to break the views without noticing it.
So, in the shortest release cycle for the sys schema ever (less than 24 hours), 1.3.0 has now been released.
This comes with a bonus though, there was also a new view that was contributed by Jesper Wisborg Krogh waiting to be merged as well, so I’ve added that to the 1.3.0 version (hence the 1.3.0 instead of 1.2.1).
This is the innodb_lock_waits view, which shows all sessions that are waiting for a lock within InnoDB, as well as the details of who is blocking them, here’s an example output:
mysql> SELECT * FROM innodb_lock_waits\G
*************************** 1. row ***************************
waiting_trx_id: 805505 …[Read more]
MySQL sys version 1.2.0 has just been released.
All views now work with MySQL 5.7.5, and the ONLY_FULL_GROUP_BY changes.
There is also a new script available (generate_sql_file.sh) that will allow RDS users to easily generate a single SQL file, using a specified user, that can be loaded in to an RDS instance. See the README for details on how to use that.
Here’s a full summary of the other changes:
Backwards Incompatible Changes
- The host_summary_by_stages and user_summary_by_stages wait_sum and wait_avg columns were renamed to total_latency and avg_latency respectively, for consistency. …
So as you may know, my new position involves the MySQL world, so I’m in the task of picking up the language and whereabouts of this DBMS, and my teamate Alkin Tezuysal (@ask_dba on Twitter) has a very cool break and fix lab which you should check out if you are going to Percona Live London 2014, he will be running this lab, so be sure to don’t miss out.
So the first thing I tried was to bring up the service, but to my surprise, the MySQL user didn’t exist. So the first thing I did was create the user.
Note: Whenever you see “…”, it is to …
[Read more]We have come a long way since the first code was put down for libAttachSQL on the 4th July. It has been a fantastic project to work on so I am very pleased to announce our first GA release.
For those who haven't seen it so far libAttachSQL is a non-blocking, lightweight C API for MySQL servers. It is Apache 2.0 licensed so is compatible with most Open Source and commercial licensing. HP's Advanced Technology Group saw a need in this field not just for HP itself but for other companies and projects too.
As for the GA release itself, there are not many changes over the RC release beyond stability fixes. A full list can be seen in the version history documentation.
In addition to the GA release we have recently had a driver for …
[Read more]I reckon there’s little sense in running 2 or more Percona XtraDB Cluster (PXC) nodes in a single physical server other than for educational and testing purposes – but doing so is still useful in those cases. The most popular way of achieving this seems to be with server virtualization, such as making use of Vagrant boxes. But in the same way you can have multiple instances of MySQL running in parallel on the OS level in the form of concurrent mysqld processes, so too can you have multiple Percona XtraDB Cluster nodes. And the way to achieve this is precisely the same: using dedicated datadirs and different ports for each node.
Which ports?4 tcp ports are used by Pecona …
[Read more]In 5.7.5, as a part of the larger effort to improve error handling, we re-implemented the IGNORE clause (WL#6614). The IGNORE clause is a MySQL extension to the SQL standard. It affects the errors which occur for each row. The new implementation aims to make the behavior of the IGNORE clause more consistent.
Statements which support the IGNORE clause are:
- INSERT [ IGNORE ]
- UPDATE [ IGNORE ]
- DELETE [ IGNORE ]
- LOAD DATA [ IGNORE ]
- LOAD XML [ IGNORE ]
- CREATE TABLE… [ IGNORE ] SELECT
When the INSERT statement is used to insert a number of rows into a table, an exception during processing would normally abort the statement and return an error message. With the IGNORE keyword, rows that cause certain exceptions are ignored, but the remaining rows are inserted and the …
[Read more]