Don't fail with error when registering master if schema already defined

Registering a master creates the schema, but it may be desirable
to forcibly reregister a master without deleting the schema, so
uncouple the dependency.

Also ensure schema creation is atomic by wrapping it in a transaction.

Per GitHub issue #49.
This commit is contained in:
Ian Barwick
2015-09-24 16:00:00 +09:00
committed by Ian Barwick
parent 03b88178c1
commit c429b0b186
3 changed files with 158 additions and 74 deletions

View File

@@ -30,6 +30,9 @@ PGconn *establish_db_connection(const char *conninfo,
PGconn *establish_db_connection_by_params(const char *keywords[],
const char *values[],
const bool exit_on_error);
bool begin_transaction(PGconn *conn);
bool commit_transaction(PGconn *conn);
bool rollback_transaction(PGconn *conn);
bool check_cluster_schema(PGconn *conn);
int is_standby(PGconn *conn);
bool is_pgup(PGconn *conn, int timeout);