crate/crate

Support `pg_catalog.pg_is_in_recovery()`

Open

#12,085 创建于 2022年1月28日

在 GitHub 查看
 (1 评论) (0 反应) (0 负责人)Java (3,863 star) (545 fork)batch import
complexity: no estimatefeature: integrationgood first issuetool: DataGrip

描述

Problem Statement: Although CrateDB's architecture differs from PostgreSQL in terms of high availability, replication, and recovery, many PostgreSQL tools (e.g. Jetbrains Datagrip) and applications rely on the built-in function pg_is_in_recovery to determine the recovery status of a PostgreSQL server.

To ensure better compatibility with these PostgreSQL tools and applications when working with CrateDB, it would be beneficial to have a simulated pg_is_in_recovery function.

Datagrip is running the following query on schema retrival:

select case
  when pg_catalog.pg_is_in_recovery()
    then null
  else
    pg_catalog.txid_current()::varchar::bigint
  end as current_txid

Possible Solutions: Implement a simulated pg_is_in_recovery function that provides a boolean value indicating the recovery status of the CrateDB cluster. Since CrateDB handles recovery differently, this function could return a static value (e.g., false) or be based on the health status of the CrateDB cluster (e.g., true if any nodes are recovering).

Additionally, providing documentation to clarify the differences between CrateDB and PostgreSQL recovery mechanisms would be helpful for users working with CrateDB and PostgreSQL tools.

Considered Alternatives: Users may try to query CrateDB's system tables (e.g., sys.cluster, sys.jobs, and sys.operations) to determine the cluster's health and recovery status. However, this approach might not be suitable for PostgreSQL tools that expect the pg_is_in_recovery function to be available.

Feature description:

pg_is_in_recovery () → boolean Returns true if recovery is still in progress.

https://www.postgresql.org/docs/14/functions-admin.html

closed by #12108

贡献者指南