Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavlo Strokov <pstrokov@gitlab.com>2020-03-31 19:35:20 +0300
committerPavlo Strokov <pstrokov@gitlab.com>2020-03-31 20:05:22 +0300
commit312b24b92707c1961e25ef26b09c5784dca556cc (patch)
tree804402103351f5262f40e9223138f4d6a8440018 /internal/praefect/config
parent6f4132638538078909c43ca7bb70405ec3267d45 (diff)
Praefect: Enable Postgres binary protocol
PgBouncer limits usage of placeholders in queries, because it prepares statement first and execute it afterwards. The problem could be if statement will be prepared using one session, but executed using another session. Binary format will issue only single operation without preparing statement. Part of: https://gitlab.com/gitlab-org/gitaly/-/issues/2166
Diffstat (limited to 'internal/praefect/config')
-rw-r--r--internal/praefect/config/config.go1
-rw-r--r--internal/praefect/config/config_test.go6
2 files changed, 4 insertions, 3 deletions
diff --git a/internal/praefect/config/config.go b/internal/praefect/config/config.go
index 7b5296234..e6d0efa3e 100644
--- a/internal/praefect/config/config.go
+++ b/internal/praefect/config/config.go
@@ -172,6 +172,7 @@ func (db DB) ToPQString() string {
{"sslcert", db.SSLCert},
{"sslkey", db.SSLKey},
{"sslrootcert", db.SSLRootCert},
+ {"binary_parameters", "yes"},
} {
if len(kv.value) == 0 {
continue
diff --git a/internal/praefect/config/config_test.go b/internal/praefect/config/config_test.go
index 81f62b863..24f2702d3 100644
--- a/internal/praefect/config/config_test.go
+++ b/internal/praefect/config/config_test.go
@@ -233,7 +233,7 @@ func TestToPQString(t *testing.T) {
in DB
out string
}{
- {desc: "empty", in: DB{}, out: ""},
+ {desc: "empty", in: DB{}, out: "binary_parameters=yes"},
{
desc: "basic example",
in: DB{
@@ -247,14 +247,14 @@ func TestToPQString(t *testing.T) {
SSLKey: "/path/to/key",
SSLRootCert: "/path/to/root-cert",
},
- out: `port=2345 host=1.2.3.4 user=praefect-user password=secret dbname=praefect_production sslmode=require sslcert=/path/to/cert sslkey=/path/to/key sslrootcert=/path/to/root-cert`,
+ out: `port=2345 host=1.2.3.4 user=praefect-user password=secret dbname=praefect_production sslmode=require sslcert=/path/to/cert sslkey=/path/to/key sslrootcert=/path/to/root-cert binary_parameters=yes`,
},
{
desc: "with spaces and quotes",
in: DB{
Password: "secret foo'bar",
},
- out: `password=secret\ foo\'bar`,
+ out: `password=secret\ foo\'bar binary_parameters=yes`,
},
}