mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-22 22:56:29 +00:00
161 lines
3.8 KiB
Plaintext
161 lines
3.8 KiB
Plaintext
-- minimal SQL tests
|
|
--
|
|
-- comprehensive tests will require a working replication cluster
|
|
-- set up using the "repmgr" binary and with "repmgrd" running
|
|
-- extension
|
|
CREATE EXTENSION repmgr;
|
|
-- tables
|
|
SELECT * FROM repmgr.nodes;
|
|
node_id | upstream_node_id | active | node_name | type | location | priority | conninfo | repluser | slot_name | config_file
|
|
---------+------------------+--------+-----------+------+----------+----------+----------+----------+-----------+-------------
|
|
(0 rows)
|
|
|
|
SELECT * FROM repmgr.events;
|
|
node_id | event | successful | event_timestamp | details
|
|
---------+-------+------------+-----------------+---------
|
|
(0 rows)
|
|
|
|
SELECT * FROM repmgr.monitoring_history;
|
|
primary_node_id | standby_node_id | last_monitor_time | last_apply_time | last_wal_primary_location | last_wal_standby_location | replication_lag | apply_lag
|
|
-----------------+-----------------+-------------------+-----------------+---------------------------+---------------------------+-----------------+-----------
|
|
(0 rows)
|
|
|
|
-- views
|
|
SELECT * FROM repmgr.replication_status;
|
|
primary_node_id | standby_node_id | standby_name | node_type | active | last_monitor_time | last_wal_primary_location | last_wal_standby_location | replication_lag | replication_time_lag | apply_lag | communication_time_lag
|
|
-----------------+-----------------+--------------+-----------+--------+-------------------+---------------------------+---------------------------+-----------------+----------------------+-----------+------------------------
|
|
(0 rows)
|
|
|
|
SELECT * FROM repmgr.show_nodes;
|
|
node_id | node_name | active | upstream_node_id | upstream_node_name | type | priority | conninfo
|
|
---------+-----------+--------+------------------+--------------------+------+----------+----------
|
|
(0 rows)
|
|
|
|
-- functions
|
|
SELECT repmgr.am_bdr_failover_handler(-1);
|
|
am_bdr_failover_handler
|
|
-------------------------
|
|
|
|
(1 row)
|
|
|
|
SELECT repmgr.am_bdr_failover_handler(NULL);
|
|
am_bdr_failover_handler
|
|
-------------------------
|
|
|
|
(1 row)
|
|
|
|
SELECT repmgr.get_new_primary();
|
|
get_new_primary
|
|
-----------------
|
|
|
|
(1 row)
|
|
|
|
SELECT repmgr.get_voting_status();
|
|
get_voting_status
|
|
-------------------
|
|
|
|
(1 row)
|
|
|
|
SELECT repmgr.notify_follow_primary(-1);
|
|
notify_follow_primary
|
|
-----------------------
|
|
|
|
(1 row)
|
|
|
|
SELECT repmgr.notify_follow_primary(NULL);
|
|
notify_follow_primary
|
|
-----------------------
|
|
|
|
(1 row)
|
|
|
|
SELECT repmgr.other_node_is_candidate(-1,-1);
|
|
other_node_is_candidate
|
|
-------------------------
|
|
|
|
(1 row)
|
|
|
|
SELECT repmgr.other_node_is_candidate(-1,NULL);
|
|
other_node_is_candidate
|
|
-------------------------
|
|
|
|
(1 row)
|
|
|
|
SELECT repmgr.other_node_is_candidate(NULL,-1);
|
|
other_node_is_candidate
|
|
-------------------------
|
|
|
|
(1 row)
|
|
|
|
SELECT repmgr.other_node_is_candidate(NULL,NULL);
|
|
other_node_is_candidate
|
|
-------------------------
|
|
|
|
(1 row)
|
|
|
|
SELECT repmgr.request_vote(-1,-1);
|
|
request_vote
|
|
--------------
|
|
|
|
(1 row)
|
|
|
|
SELECT repmgr.request_vote(-1,NULL);
|
|
request_vote
|
|
--------------
|
|
|
|
(1 row)
|
|
|
|
SELECT repmgr.request_vote(NULL,-1);
|
|
request_vote
|
|
--------------
|
|
|
|
(1 row)
|
|
|
|
SELECT repmgr.request_vote(NULL,NULL);
|
|
request_vote
|
|
--------------
|
|
|
|
(1 row)
|
|
|
|
SELECT repmgr.reset_voting_status();
|
|
reset_voting_status
|
|
---------------------
|
|
|
|
(1 row)
|
|
|
|
SELECT repmgr.set_local_node_id(-1);
|
|
set_local_node_id
|
|
-------------------
|
|
|
|
(1 row)
|
|
|
|
SELECT repmgr.set_local_node_id(NULL);
|
|
set_local_node_id
|
|
-------------------
|
|
|
|
(1 row)
|
|
|
|
SELECT repmgr.set_voting_status_initiated();
|
|
set_voting_status_initiated
|
|
-----------------------------
|
|
|
|
(1 row)
|
|
|
|
SELECT repmgr.standby_get_last_updated();
|
|
standby_get_last_updated
|
|
--------------------------
|
|
|
|
(1 row)
|
|
|
|
SELECT repmgr.standby_set_last_updated();
|
|
standby_set_last_updated
|
|
--------------------------
|
|
|
|
(1 row)
|
|
|
|
SELECT repmgr.unset_bdr_failover_handler();
|
|
unset_bdr_failover_handler
|
|
----------------------------
|
|
|
|
(1 row)
|
|
|