php - How does a mysql server restart affect the currently running jobs
On my virtual dedicated linux server, there are always some php jobs running. These jobs keep writing data in different tables. I was wondering, what happens if i need to restart my mysql server as i have made some config changes? Will all the running jobs be killed if i restart my mysql server ? or will they be on hold for a while , throwing error while the server is being restarted?
Thanks for your help
Answer
Solution:
Depends on how well those php jobs were written. They may hold data until a connection is re-established, they mail fail and 'call for help' or they may fail horribly leaving data in a state of disarray because transaction logic wasn't used.
You could have the best possible outcome, or the worst it entirely depends on how well those php jobs were developed.
Answer
Solution:
If you put a bit of code around the actual mysql php calls, you can catch the errors and deal with them.
} // end mquery
If you find that you have other errors that may succeed if you wait a little while, then add them.
For errors that won't succeed no matter how long you wait, add them to the 'break' block of code.
Answer
Solution:
Depends how they were written.
In all likelihood, as they're written in PHP, they will get a massive load of errors in the database, which will trigger PHP E_WARNINGs, which the application will completely ignore and generate junk data in its output file, enter an infinite loop, or some other completely useless behaviour.
They certainly won't get killed. However, they might die (which may be reasonable behaviour, provided they can restart and do the right thing).