数据库PostrageSQL-错误处理

2021-08-30 14:40:09 浏览数 (1)

19.14. 错误处理

exit_on_error (boolean) 如果为真,任何错误将中止当前会话。默认情况下,这个值被设置为假,这样只有 FATAL 错误(致命)将中止会话。

restart_after_crash (boolean) 当被设置为真(默认值)时,PostgreSQL将在一次后端崩溃后自动重新初始化。让这个值设置为真通常是将数据库可用性最大化的最佳方法。但是在某些环境中,例如PostgreSQL被集群软件调用时,禁用重启可能很有用,这样集群软件可以得到控制并且采取它认为适当的行动。 data_sync_retry (boolean)

代码语言:javascript复制
When set to false, which is the default, PostgreSQL will raise a PANIC-level
error on failure to flush modified data files to the filesystem. This causes

the database server to crash. 当设置为false(默认值),PostgreSQL 把修改的数据文件刷新到文件系统失败,将引发PANIC级错误。 这会导致数据库服务器崩溃。

代码语言:javascript复制
On some operating systems, the status of data in the kernel's page cache is
unknown after a write-back failure. In some cases it might have been entirely
forgotten, making it unsafe to retry; the second attempt may be reported as
successful, when in fact the data has been lost. In these circumstances, the
only way to avoid data loss is to recover from the WAL after any failure is
reported, preferably after investigating the root cause of the failure and
replacing any faulty hardware.
If set to true, PostgreSQL will instead report an error but continue to run so
that the data flushing operation can be retried in a later checkpoint. Only set
it to true after investigating the operating system's treatment of buffered
data in case of write-back failure.

0 人点赞