I'm running PHPBB (most up-to-date non-beta version) and in the last 3 months, the error appears during a search every few days:
'phpbb_search_wordmatch' is marked as crashed and last (automatic?) repair failed
To fix it, I then just run a repair on the table. I am still working on a way to figure out why this keeps crashing. The host was not helpful and it could be that the table is too large for the server (700 mb or so)
My Question: Could I create a trigger in PHPMyAdmin in the meantime to automatically repair the table whenever this error happens? You see it on the table in PMA when you go to access it, so there must be some entry that I can use to create the trigger.
Unfortunately this issue is difficult to fix for me being on a shared server, and all resources online say to contact the host, so as long as I can at least get it to fix itself when it happens.
You may be better off setting up a scheduled task. I'm not aware of how you could create a trigger that detects when the table needs repair; I don't believe there are hooks for the logic to detect that situation and cause a procedure to run.
From the database, there's an Events tab where you can enable the MySQL event scheduler and create an event which would run, say, once per week and run the SQL statement to repair the table. It's still not ideal, but I think it's better than using a trigger in this case.
Related
I'm using MySQL 8.0.21 From the MySQL Community Installer on Windows 10 updated to version2004 and for some reason if I create a event in the event scheduler, which calls a procedure once every second (regardless of what that SP actually does, I'll explain my test case) - my CPU maxes out and when I look at the active connections in MySQL Workbench, it stacks up a ton of worker threads which stall on the "Opening Tables" state. My PC freezes, I have to edit the event to be disabled, stop the MySQL process in Task Manager and Start the service again.
TEST CASE
During setup of a brand new server, I used all default settings, except I enabled the general log and I use the new 8.0+ mysql_sha2_password encryption (although I ALTER USER to mysql_native_password for phpmyadmin so that might revert it, I'm honestly not sure)
I create a new Schema called "Test"
I create one Table called
"TestTable" has only one column called "column1" INT
I then create a Stored Procedure "TestProc" which does "SELECT COUNT(*) FROM
TestTable;" Adjusts Priv.'s, DEFINER::Definer is root#localhost and
Reads SQL
And Finally I create an Event called "TestEvent" which does
"CALL TestProc()s" Reoccurring every 1/sec, preserve on Complete, and
definer is root#localhost
restart server before event is fired.
Also, if I enable the event, or create it, it'll run without issue, it's important to note that the issue begins when the event scheduler is left on, and the event is left enabled, then the server is restarted from the services in task manager. Immediately the CPU jacks up to max and active connections show threads stacking up without completing.
Any clues are appreciated, I find no actual errors nor do I have any idea where to begin debugging anymore. I've tried skipping grant tables (but obviously that's not optimal, and didn't work).
I did find a hint when reviewing the MySQL 8.0+ docs
"If a repeating event does not terminate within its scheduling interval, the result may be multiple instances of the event executing simultaneously. If this is undesirable, you should institute a mechanism to prevent simultaneous instances. For example, you could use the GET_LOCK() function, or row or table locking. " from
However, when analyzing there does not appear to be any locks, nor should I need to implement such manually just for this test case (or my actual program)
UPDATE
Up to this point, albeit a rather niche bug, I do believe that is exactly what this is, and I have posted it on MySQL bug forum. Reference post is here:
The answer actually has turned out to be a bug which is reproducible - Bug#: 100449
My mysql database gets deleted automatically
when I checked the error log I found this error
ec4 InnoDB: FTS Optimize Removing table noisepollution/#sql2-186c-1e
Anyone know how to resolve this?
#sql... is a temp table built for supporting ALTER or some other action. Normally it would be automatically removed (or renamed). But if there is a system crash, or certain other errors (maybe: out of disk space), the file is left around. The message you gave sounds as if it came from a Cloud service that is trying to clean up the mess.
In any case, please provide the actions that happens just before the problem
I'd created a Cloud SQL server for development without failover at the start.
Several days ago, I tried to create failover replica for it, and the operation had been waiting for completion whole day without further notification.
I think I should try it again today, and I cannot create it. The system is always responding with:
Could not complete the operation.
I'd changed the name or any random name for instance ID. The result is still the same.
Does anyone have such kind experience? How to solve this?
Did you choose zone?
When you create a failover, the "location" field will be auto-filled in the edit page. But the "zone" field is empty, you need to select one from the drop-down list.
Just encountered the same problem as you. And it works for me.
I need to add a column to my current table.
This table is used a lot during the day and night. i found out i need to alter using the alter command found here
http://dev.mysql.com/doc/refman/5.1/en/alter-table.html
I tested it on a development server.
i took about 2 hours to complete. Now I want to execute this on the production server?
will this stop my website?
Why not display a message on the site saying you will perform maintenance from midnight UTC time January 7 2012.
This way, you won't break any data, you will not get any mysql errors. you execute your ALTER and you start the site again once its completed (don't forget your code to make sure you have the right field etc..). Easy solution.
Stackoverflow does it, why not yours?
Yes, during an ALTER TABLE all reads and writes are blocked. If your website needs to use that table, requests will hang.
Try pt-online-schema-change. It allows reads and writes to continue, while it captures changes to be replayed against the altered table once the restructure is done.
Test carefully on your development server so you know how it works and what to expect.
It won't stop your website, but it will likely make it throw errors.
Of course there is no way to answer this without looking at all the code of your application.
The bottom line is, when in doubt schedule a maintenance window.
Make the production server to point to dev db (or) mirror of prodcution db for some time.
Alter the table in production
Deploy the code which talks to production db (with the new attributes)
P.S: I feel this is safer and a fool proof way (based on my experience).
I have developed a windows service using Delphi 2007. It connects to a remote MySql database via the internet using TAdoConnection and TAdoQuery. I have retained the default value of 30 seconds for CommandTimeout property. I also create the connection/query objects on each new query and free them when done (i.e. I don't create the database connection at startup and keep it open).
Every once in a while the service stops and the event viewer shows "Lost connection to MySQL server during query". I have everything wrapped in exceptions. My suspicion is that there is a drop in the network while the query is executing.
Anyone have any resolution/ideas?
What triggers windows to shutdown the service?
Also, I have the service "Recovery" set to restart the service but this never happens.
My next step will be to start logging when each query starts and compare this to the date/time of the shutdown. Because as of now I don't know how log this is.
This is may be not a direct answer, but I had same problem few days ago, and I have the mysql on local server, and I connect using Mydac components.
After many tries, I found the problem came from one table that has BLOB fields, I tried to query on the table like
select * from table
And I got this problem after the query fetch around 1600 rows, after few inspection I found the problem came from few records and seems they corrupted. so when I do query like
Select * from my table where id not
between 1599 and 1650
I had this problem, if I removed Not from they query which fetch only 51 records I got the error, which means there's some records are corrupted, also I did mysqlcheck but it didn't fix the problem, and I tried some other check tools and I got same result, I didn't tried to delete these records, because I need why this problem happen, but I got busy with other things so I left the server for a while.
BTW, I used MySql Query browser for trying to do the queries, because other tools will give me the errors without showing how many records fetched before mysql instance terminated unexpectedly.