简体   繁体   中英

What happens to a running PHP script with MySQL queries during a server restart?

I'm running a PHP script that converts a few hundred thousand records from a remote MySQL server to the local one. A few times during the transfer, the error_logs shows ...

[Wed Jul 03 17:02:36 2013] [notice] Graceful restart requested, doing restart
[Wed Jul 03 17:02:37 2013] [notice] SSL FIPS mode disabled
[Wed Jul 03 17:02:37 2013] [notice] Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/1.0.0-fips mod_bwlimited/1.4 PHP/5.3.16 configured -- resuming normal operations

It's rare, and I can't find a reason for it, but the script seems to continue as though nothing happened. Testing if data was lost would be very cumbersome. So I'm wondering, what happens if a MySQL query is interrupted? And why does PHP seems to ignore the restart entirely, and just continue running as though nothing happened? Any thoughts on how/what to test?

That's an Apache log, not a PHP log. Your script is probably running in CLI (command line) so an Apache restart won't affect it. Otherwise it may have been restarted with -k graceful which will allow child processes to complete.

So I'm wondering, what happens if a MySQL query is interrupted

If MySQL is restarted, the script will fail (unless the programmer incorporated some extra robust error handling to deal with that situation).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM