PostgreSQL停止動作觀察


實驗過程如下:

啟動一個客戶端:

[postgres@cnrd56 bin]$ ./psql
psql (9.1.2)
Type "help" for help.

postgres=# begin;
BEGIN
postgres=# select count(*), pg_sleep(1000) from test;

然后強制停止:

pg_ctl stop -m f  -D /usr/local/pgsql/data

此時在客戶端出現如下信息:

FATAL:  terminating connection due to administrator command
The connection to the server was lost. Attempting reset: Failed.
!> 

再看后台的log:

2013-07-14 10:17:17.280 CST,,,3422,,51e209eb.d5e,2,,2013-07-14 10:16:11 CST,,0,LOG,00000,"received fast shutdown request",,,,,,,,,""
2013-07-14 10:17:17.280 CST,,,3422,,51e209eb.d5e,3,,2013-07-14 10:16:11 CST,,0,LOG,00000,"aborting any active transactions",,,,,,,,,""
2013-07-14 10:17:17.280 CST,,,3427,,51e209ec.d63,2,,2013-07-14 10:16:12 CST,1/0,0,LOG,00000,"autovacuum launcher shutting down",,,,,,,,,""
2013-07-14 10:17:17.280 CST,"postgres","postgres",3431,"[local]",51e209ff.d67,1,"SELECT",2013-07-14 10:16:31 CST,2/2,0,FATAL,57P01,"terminating connection due to administrator command",,,,,,"select count(*), pg_sleep(1000) from test;",,,"psql"
2013-07-14 10:17:17.281 CST,,,3425,,51e209ec.d61,1,,2013-07-14 10:16:12 CST,,0,LOG,00000,"shutting down",,,,,,,,,""
2013-07-14 10:17:17.281 CST,"postgres","postgres",3435,"[local]",51e20a2d.d6b,1,"",2013-07-14 10:17:17 CST,,0,FATAL,57P03,"the database system is shutting down",,,,,,,,,""
2013-07-14 10:17:17.284 CST,,,3425,,51e209ec.d61,2,,2013-07-14 10:16:12 CST,,0,LOG,00000,"database system is shut down",,,,,,,,,""

其中的:

2013-07-14 10:17:17.280 CST,"postgres","postgres",3431,"[local]",51e209ff.d67,1,"SELECT",2013-07-14 10:16:31 CST,2/2,0,FATAL,57P01,"terminating connection due to administrator command",,,,,,"select count(*), pg_sleep(1000) from test;",,,"psql"

表明,客戶端正在執行sql文 select count(*), pg_sleep(1000) from test的時候,

收到了 "terminating connection due to administrator command" 命令。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM