summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Singer2018-05-21 14:13:21 +0000
committerSteve Singer2018-08-01 16:23:07 +0000
commit7cf2af6f321201406eae1baf585c6bbd23745478 (patch)
tree3c501bfea12d9a8dfe53235828f8cb915479c750
parentc04124281256352b9579c38bfb0e9a0195db283a (diff)
1. Add an option to slonik to disable the version check
against the slony schema 2. Add an option to make the remote listener use a READ COMMITTED instead of a serialized deferrable transaction 3. If slonik was not compiled with pgport then allow PG_HOME to override/set the location of the share directory containing the slony .sql files Patches from Tom Tignor<ttignor@akamai.com>.
-rw-r--r--src/slon/confoptions.c23
-rw-r--r--src/slon/confoptions.h2
-rw-r--r--src/slon/dbutils.c6
-rw-r--r--src/slon/remote_listen.c29
-rw-r--r--src/slonik/slonik.c12
5 files changed, 47 insertions, 25 deletions
diff --git a/src/slon/confoptions.c b/src/slon/confoptions.c
index 56de55a7..4eb6b855 100644
--- a/src/slon/confoptions.c
+++ b/src/slon/confoptions.c
@@ -262,6 +262,29 @@ static struct config_bool ConfigureNamesBool[] =
&monitor_threads,
true
},
+ {
+ {
+ (const char *) "enable_version_check",
+ gettext_noop("Should services check release versions "
+ "and fail on differences?"),
+ NULL,
+ SLON_C_BOOL,
+ },
+ &enable_version_check,
+ true
+ },
+ {
+ {
+ (const char *) "remote_listen_serializable_transactions",
+ gettext_noop("Determines if the remote listener should use serializable transactions. "
+ "This setting trades between strict isolation and avoiding blocking "
+ "for lock management."),
+ NULL,
+ SLON_C_BOOL,
+ },
+ &remote_listen_serializable_transactions,
+ true
+ },
{{0}}
};
diff --git a/src/slon/confoptions.h b/src/slon/confoptions.h
index 75bfbfba..63c5c8f4 100644
--- a/src/slon/confoptions.h
+++ b/src/slon/confoptions.h
@@ -26,6 +26,8 @@ extern int desired_sync_time;
extern int quit_sync_provider;
extern int quit_sync_finalsync;
extern bool keep_alive;
+extern bool enable_version_check;
+extern bool remote_listen_serializable_transactions;
extern int keep_alive_idle;
extern int keep_alive_interval;
extern int keep_alive_count;
diff --git a/src/slon/dbutils.c b/src/slon/dbutils.c
index 8450b44b..f223f0c8 100644
--- a/src/slon/dbutils.c
+++ b/src/slon/dbutils.c
@@ -31,6 +31,7 @@
#include "slon.h"
bool keep_alive;
+bool enable_version_check;
int keep_alive_idle;
int keep_alive_count;
int keep_alive_interval;
@@ -389,6 +390,11 @@ db_checkSchemaVersion(PGconn *conn)
PGresult *res;
int retval = 0;
+ if (! enable_version_check)
+ {
+ return 0;
+ }
+
/*
* Select the version number from the schema
*/
diff --git a/src/slon/remote_listen.c b/src/slon/remote_listen.c
index 3ba6151a..48a103f4 100644
--- a/src/slon/remote_listen.c
+++ b/src/slon/remote_listen.c
@@ -61,6 +61,7 @@ static int poll_sleep;
extern char *lag_interval;
int remote_listen_timeout;
+bool remote_listen_serializable_transactions;
static int sel_max_events = 0;
@@ -295,30 +296,10 @@ remoteListenThread_main(void *cdata)
}
if (PQserverVersion(dbconn) >= 90100)
{
- slon_mkquery(&query1, "SET SESSION CHARACTERISTICS AS TRANSACTION read only deferrable");
- res = PQexec(dbconn, dstring_data(&query1));
- if (PQresultStatus(res) != PGRES_COMMAND_OK)
- {
- slon_log(SLON_ERROR,
- "remoteListenThread_%d: \"%s\" - %s",
- node->no_id,
- dstring_data(&query1), PQresultErrorMessage(res));
- PQclear(res);
- slon_disconnectdb(conn);
- free(conn_conninfo);
- conn = NULL;
- conn_conninfo = NULL;
- rc = sched_msleep(node, pa_connretry * 1000);
- if (rc != SCHED_STATUS_OK && rc != SCHED_STATUS_CANCEL)
- break;
-
- continue;
- }
-
- }
- if (PQserverVersion(dbconn) >= 90100)
- {
- slon_mkquery(&query1, "SET SESSION CHARACTERISTICS AS TRANSACTION read only isolation level serializable deferrable");
+ char buf[200];
+ sprintf(buf, "SET SESSION CHARACTERISTICS AS TRANSACTION read only isolation level %s",
+ remote_listen_serializable_transactions ? "serializable deferrable" : "repeatable read");
+ slon_mkquery(&query1, buf);
res = PQexec(dbconn, dstring_data(&query1));
if (PQresultStatus(res) != PGRES_COMMAND_OK)
{
diff --git a/src/slonik/slonik.c b/src/slonik/slonik.c
index 001557b9..bd125707 100644
--- a/src/slonik/slonik.c
+++ b/src/slonik/slonik.c
@@ -223,8 +223,18 @@ main(int argc, const char *argv[])
get_share_path(myfull_path, share_path);
}
#else
- strcpy(share_path, PGSHARE);
+ char *pgHome = getenv("PG_HOME");
+ if (pgHome)
+ {
+ snprintf(share_path, MAXPGPATH-1, "%s/share", pgHome);
+ share_path[MAXPGPATH-1] = '\0';
+ }
+ else
+ {
+ strcpy(share_path, PGSHARE);
+ }
#endif
+printf("Share path is %s\n",share_path);
if (optind < argc)
{