How do I suppress MySQL errors? - mysql

I have an issue where our database is receiving ~1000 updates a minute, and often we get an error response:
TAF: 1297 (HY000) at line 1: Got temporary error 899 'Rowid already allocated' from NDBCLUSTER
which appears in our application to our customer.
Is there any way to suppress these errors at the MySQL level? As I am not the developer of this application, I am not sure what language is performing the updates, but I presume either shell script or a C program.
I am using MySQL: 5.1.44-ndb-7.1.3-cluster-log (2 cluster nodes and 1 cluster mgmt node)

Have you tried using the 'IGNORE' clause in your SQL statements, the documentation for this is here
Using the IGNORE clause will downgrade errors to warnings, these warnings are displayed using the 'SHOW WARNINGS;' command

Related

View MySQL *query* errors/warnings in AWS RDS

How do I view MySQL query errors and warnings in RDS? I am still using MySQL 5.6.
I have looked in the log files (under Log & Events), but they remain empty even when I do a query that generates an error in the console. For example, I ran a query that gave me error 1054 (unknown column), but nothing appeared in the error log. I've realized that this isn't the type of errors that get logged.
The log_warnings parameter is set to 1. I've tried setting general_log=1, but that generates way to much info, and still doesn't log the errors.
The reason that I need this is that I am upgrading from 5.6 to 5.7. I need like to see what warnings I'm currently getting since some warning will become errors in 5.7, and need to be fixed.
You can run SHOW WARNINGS immediately after the query, to get all conditions (errors, warnings, and notes). You have to do this in the client that ran the query. It's not a log.
There is no log for error, warnings, or notes for each query. The errors and warnings in the MySQL Server error log are for server errors, not for individual queries.
Queries that can't be parsed are not written to the general log or the slow query log by default. If you set the global option log_raw=1 then the general log will log erroneous queries, but still won't log the error itself. Even with that option, the slow query log won't log queries that can't be parsed.
A free tool from Percona may be helpful for your testing. pt-upgrade allows you to use a query log file as input, and it runs the query against two instances of MySQL, and reports any difference in errors or warnings, or results.
I thought of another partial solution: the PERFORMANCE_SCHEMA has tables for statement events. The statement event tables have columns for error number and message caused by each query, if any. But only a count of the warnings, not the warning message(s) themselves.

Running a MySQL Script - with zero knowledge

A client has just supplied me with two long files which are (apparently) scripts that I can run in MySQL to generate a bunch of database tables.
I've installed MySQL (+ workbench) on my PC. From within the Workbench environment I found "run SQL script" under the File menu so I went with that and tried to run the two script files I have. They both fell over partway though giving me error messages:
Finished executing script
ERROR 2006 (HY000) at line 1930: MySQL server has gone away
Operation failed with exitcode 1
and
Finished executing script
ERROR 2006 (HY000) at line 20201: MySQL server has gone away
Operation failed with exitcode 1
I can however see two schemas, both of which contain a bunch of tables, etc. (some of which are populated) so it seems to have been a partial success at least.
Can anyway suggest what might be wrong please?
Thank you.
I can point you at a solved example on stackoverflow for this MySQL error, but the simplest solution is to edit your sql file(s) placing this query at the top:
set SESSION max_allowed_packet=64*1024*1024

Google MySQL fails with ERROR 2013 HY000 system error 2

I have a D8 google mysql instance. I'm running an etl process trying to push about 100GB of data in but the script keep stopping because of the error.
In order to get it working I have to restart the mysql instance and then re run the process from where it failed. Any help is greatly appreciated. I haven't found anything on google.
This error tends to mean the connection to the MySQL server was lost at some point. As mentioned in this 'Lost connection to MySQL server' article, this error may be encountered when writing a significant number or rows.
The article suggests setting the net_read_timeout to something greater than the default value of 30 seconds. You may also want to consider breaking up your write tasks as well.

MySQL 5.5 : "Got an error reading communication packets"

I just upgraded MySQL from 5.1 to 5.5.
I fixed few issues running mysql_upgrade, and changing some deprecated configurations...
I also updated PHP, from 5.3.3-7 to 5.3.29-1.
But, since that, I'm having a reccurent problem (always thrown in this order) :
1. Client* - PHP Warning
Warning: Packets out of order. Expected 1 received 0. Packet size=1 in
/home/www/www.mywebsite.com/shared/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php
line 694
2. Client* - PHP Warning
Warning: PDOStatement::execute() [pdostatement.execute]: Error reading
result set's header in
/home/www/www.mywebsite.com/shared/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php
line 694
3. Server* - MySQL Warning :
150127 17:25:15 [Warning] Aborted connection 309 to db:
'my_database' user: 'root' host: '127.0.0.1' (Got an error
reading communication packets)
4. Client* - PHP Error
PDOStatement::execute() [pdostatement.execute]: MySQL server
has gone away in
/home/www/www.mywebsite.com/shared/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php
line 694
*NB: What I call "Client" is the PHP Application, and "Server" is the MySQL Server, even if they're both on the same localhost Server.
So, apparently, the origin of all those problems is the first one : "Packets out of order".
But when I search for this error I can't find many answers, and they are most of the time not related to my problem : I use Doctrine as an abstraction, so I don't write any query or fetch any result myself. Plus, it's almost never the same values as me, but in my case I always get those values ("Expected 1 received 0. Packet size=1").
The closest result would be this MySQL bug report, but "No feedback was provided for this bug for over a month, so it is
being suspended automatically"...
Plus, some of the "2." errors aren't thrown by my PHP Doctrine code (they're not executed from my localhost, but from another known external service, probably using some old PHP Propel code).
So that might mean there is a problem with my MySQL configuration itself, but I tried changing some parameters without obtaining any obvious effect (sometimes it takes more time after restarting MySQL to get the first errors for example).
Any help would be very much appreciated !
And here is my current configuration (I've got 2 MySQL instances, the second one using replication is mostly for read only).
I also checked most of the system resources with Munin and didn't see anything abnormal (the RAM usage for example is pretty high, but as there is 50Go on the server it's not full at all).
UPDATE
I isolated an SQL query that was repeatedly failing from my PHP Client. When I executed from my local with MySQL Workbench, it did exactly the same (closed the connexion with a MySQL server has gone away message). When I did it from the sql command line it also did the same. Then I executed it from the sql command line on the server host, and it succeded. But some time after when I tried again from Workbench/whatever it worked... So it looks like those "corrupted packets" are cached and disapear after some time.
Thanks, I fixed this issue doing :
RESET QUERY CACHE;
FLUSH QUERY CACHE;

Recipe for creating a corrupt mysql table

We had a process that crashed while trying to manipulate an expected mysql record set, running the offending query from the mysql cli showed the following.
mysql> SELECT ...;
ERROR 1030: Got error 127 from table handler
Is there a way to easily recreate this condition so we can validate our fix ? (production DB was already repaired).
$ perror 127
OS error code 127: Key has expired
MySQL error code 127: Record file is crashed
The cause is most probably a corrupted MyISAM table ... I don't think it's possible to reproduce, unless you actually know how to provoke that corruption :/