mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 00:26:30 +00:00
Update "repmgr bdr --help" output
This commit is contained in:
@@ -41,7 +41,7 @@ do_bdr_register(void)
|
|||||||
RecordStatus record_status = RECORD_NOT_FOUND;
|
RecordStatus record_status = RECORD_NOT_FOUND;
|
||||||
PQExpBufferData event_details;
|
PQExpBufferData event_details;
|
||||||
bool success = true;
|
bool success = true;
|
||||||
char dbname[MAXLEN];
|
char *dbname = NULL;
|
||||||
|
|
||||||
/* sanity-check configuration for BDR-compatability */
|
/* sanity-check configuration for BDR-compatability */
|
||||||
if (config_file_options.replication_type != REPLICATION_TYPE_BDR)
|
if (config_file_options.replication_type != REPLICATION_TYPE_BDR)
|
||||||
@@ -50,6 +50,14 @@ do_bdr_register(void)
|
|||||||
exit(ERR_BAD_CONFIG);
|
exit(ERR_BAD_CONFIG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dbname = pg_malloc0(MAXLEN);
|
||||||
|
|
||||||
|
if (dbname == NULL)
|
||||||
|
{
|
||||||
|
log_error(_("unable to allocate memory; terminating."));
|
||||||
|
exit(ERR_OUT_OF_MEMORY);
|
||||||
|
}
|
||||||
|
|
||||||
/* store the database name for future reference */
|
/* store the database name for future reference */
|
||||||
get_conninfo_value(config_file_options.conninfo, "dbname", dbname);
|
get_conninfo_value(config_file_options.conninfo, "dbname", dbname);
|
||||||
|
|
||||||
@@ -60,6 +68,7 @@ do_bdr_register(void)
|
|||||||
log_error(_("database \"%s\" is not BDR-enabled"), dbname);
|
log_error(_("database \"%s\" is not BDR-enabled"), dbname);
|
||||||
log_hint(_("when using repmgr with BDR, the repmgr schema must be stored in the BDR database"));
|
log_hint(_("when using repmgr with BDR, the repmgr schema must be stored in the BDR database"));
|
||||||
PQfinish(conn);
|
PQfinish(conn);
|
||||||
|
pfree(dbname);
|
||||||
exit(ERR_BAD_CONFIG);
|
exit(ERR_BAD_CONFIG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,6 +79,7 @@ do_bdr_register(void)
|
|||||||
{
|
{
|
||||||
log_error(_("database \"%s\" is BDR-enabled but no BDR nodes were found"), dbname);
|
log_error(_("database \"%s\" is BDR-enabled but no BDR nodes were found"), dbname);
|
||||||
PQfinish(conn);
|
PQfinish(conn);
|
||||||
|
pfree(dbname);
|
||||||
exit(ERR_BAD_CONFIG);
|
exit(ERR_BAD_CONFIG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,6 +88,7 @@ do_bdr_register(void)
|
|||||||
log_error(_("repmgr can only support BDR clusters with 2 nodes"));
|
log_error(_("repmgr can only support BDR clusters with 2 nodes"));
|
||||||
log_detail(_("this BDR cluster has %i nodes"), bdr_nodes.node_count);
|
log_detail(_("this BDR cluster has %i nodes"), bdr_nodes.node_count);
|
||||||
PQfinish(conn);
|
PQfinish(conn);
|
||||||
|
pfree(dbname);
|
||||||
exit(ERR_BAD_CONFIG);
|
exit(ERR_BAD_CONFIG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,6 +126,7 @@ do_bdr_register(void)
|
|||||||
{
|
{
|
||||||
log_error(_("unable to create repmgr extension - see preceding error message(s); aborting"));
|
log_error(_("unable to create repmgr extension - see preceding error message(s); aborting"));
|
||||||
rollback_transaction(conn);
|
rollback_transaction(conn);
|
||||||
|
pfree(dbname);
|
||||||
PQfinish(conn);
|
PQfinish(conn);
|
||||||
exit(ERR_BAD_CONFIG);
|
exit(ERR_BAD_CONFIG);
|
||||||
}
|
}
|
||||||
@@ -122,6 +134,8 @@ do_bdr_register(void)
|
|||||||
commit_transaction(conn);
|
commit_transaction(conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pfree(dbname);
|
||||||
|
|
||||||
/* check for a matching BDR node */
|
/* check for a matching BDR node */
|
||||||
{
|
{
|
||||||
bool node_exists = bdr_node_exists(conn, config_file_options.node_name);
|
bool node_exists = bdr_node_exists(conn, config_file_options.node_name);
|
||||||
@@ -336,7 +350,7 @@ do_bdr_unregister(void)
|
|||||||
RecordStatus record_status = RECORD_NOT_FOUND;
|
RecordStatus record_status = RECORD_NOT_FOUND;
|
||||||
bool node_record_deleted = false;
|
bool node_record_deleted = false;
|
||||||
PQExpBufferData event_details;
|
PQExpBufferData event_details;
|
||||||
char dbname[MAXLEN];
|
char *dbname;
|
||||||
|
|
||||||
/* sanity-check configuration for BDR-compatability */
|
/* sanity-check configuration for BDR-compatability */
|
||||||
|
|
||||||
@@ -346,6 +360,14 @@ do_bdr_unregister(void)
|
|||||||
exit(ERR_BAD_CONFIG);
|
exit(ERR_BAD_CONFIG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dbname = pg_malloc0(MAXLEN);
|
||||||
|
|
||||||
|
if (dbname == NULL)
|
||||||
|
{
|
||||||
|
log_error(_("unable to allocate memory; terminating."));
|
||||||
|
exit(ERR_OUT_OF_MEMORY);
|
||||||
|
}
|
||||||
|
|
||||||
/* store the database name for future reference */
|
/* store the database name for future reference */
|
||||||
get_conninfo_value(config_file_options.conninfo, "dbname", dbname);
|
get_conninfo_value(config_file_options.conninfo, "dbname", dbname);
|
||||||
|
|
||||||
@@ -354,6 +376,7 @@ do_bdr_unregister(void)
|
|||||||
if (!is_bdr_db(conn, NULL))
|
if (!is_bdr_db(conn, NULL))
|
||||||
{
|
{
|
||||||
log_error(_("database \"%s\" is not BDR-enabled"), dbname);
|
log_error(_("database \"%s\" is not BDR-enabled"), dbname);
|
||||||
|
pfree(dbname);
|
||||||
exit(ERR_BAD_CONFIG);
|
exit(ERR_BAD_CONFIG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -361,15 +384,19 @@ do_bdr_unregister(void)
|
|||||||
if (extension_status != REPMGR_INSTALLED)
|
if (extension_status != REPMGR_INSTALLED)
|
||||||
{
|
{
|
||||||
log_error(_("repmgr is not installed on database \"%s\""), dbname);
|
log_error(_("repmgr is not installed on database \"%s\""), dbname);
|
||||||
|
pfree(dbname);
|
||||||
exit(ERR_BAD_CONFIG);
|
exit(ERR_BAD_CONFIG);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_bdr_repmgr(conn))
|
if (!is_bdr_repmgr(conn))
|
||||||
{
|
{
|
||||||
log_error(_("repmgr metadatabase contains records for non-BDR nodes"));
|
log_error(_("repmgr metadatabase contains records for non-BDR nodes"));
|
||||||
|
pfree(dbname);
|
||||||
exit(ERR_BAD_CONFIG);
|
exit(ERR_BAD_CONFIG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pfree(dbname);
|
||||||
|
|
||||||
initPQExpBuffer(&event_details);
|
initPQExpBuffer(&event_details);
|
||||||
if (runtime_options.node_id != UNKNOWN_NODE_ID)
|
if (runtime_options.node_id != UNKNOWN_NODE_ID)
|
||||||
target_node_id = runtime_options.node_id;
|
target_node_id = runtime_options.node_id;
|
||||||
@@ -445,9 +472,14 @@ do_bdr_help(void)
|
|||||||
puts("");
|
puts("");
|
||||||
printf(_(" \"bdr register\" initialises the repmgr cluster and registers the initial bdr node.\n"));
|
printf(_(" \"bdr register\" initialises the repmgr cluster and registers the initial bdr node.\n"));
|
||||||
puts("");
|
puts("");
|
||||||
|
printf(_(" -F, --force overwrite an existing node record\n"));
|
||||||
|
puts("");
|
||||||
|
|
||||||
printf(_("BDR UNREGISTER\n"));
|
printf(_("BDR UNREGISTER\n"));
|
||||||
puts("");
|
puts("");
|
||||||
printf(_(" \"bdr unregister\" unregisters an inactive BDR node.\n"));
|
printf(_(" \"bdr unregister\" unregisters an inactive BDR node.\n"));
|
||||||
puts("");
|
puts("");
|
||||||
|
printf(_(" --node-id ID node to unregister (optional, used when the node to unregister\n" \
|
||||||
|
" is offline)\n"));
|
||||||
|
puts("");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ item_list_append_format(ItemList *item_list, const char *format,...)
|
|||||||
if (cell == NULL)
|
if (cell == NULL)
|
||||||
{
|
{
|
||||||
log_error(_("unable to allocate memory; terminating."));
|
log_error(_("unable to allocate memory; terminating."));
|
||||||
exit(ERR_BAD_CONFIG);
|
exit(ERR_OUT_OF_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
cell->string = pg_malloc0(MAXLEN);
|
cell->string = pg_malloc0(MAXLEN);
|
||||||
|
|||||||
Reference in New Issue
Block a user