Custom postgresql configuration setting

30 views
Skip to first unread message

Ivan Kurnosov

unread,
Jul 5, 2023, 10:36:43 AM7/5/23
to Postgres Operator
Hi, 

how would one set an arbitrary postgresql configuration setting that is NOT supported by patrony dynamic reload (https://patroni.readthedocs.io/en/latest/dynamic_configuration.html)

Eg: `lock_timeout`.

If set in spec.patroni.dynamicConfiguration then the container just responds with:

```
No PostgreSQL configuration items changed, nothing to reload.
```


it looks like there is really no way to set up a parameter manually.

The only real possibility I see is to overwrite the entire `postgresql.base.conf` but it looks dodgy.

Am I wrong and there is a simple way?

Thank you!

Ben Blattberg

unread,
Jul 7, 2023, 11:43:45 AM7/7/23
to Postgres Operator, Ivan Kurnosov
Hello Ivan, 
Hmmm, let me try this with our most recent images.

OK, I tried this with `lock_timeout` specifically, and was able to see the setting get updated both in the logs and through psql:

```
➜  ~ kubectl exec -it hippo-instance1-rwz8-0  -c database -- psql -c "show lock_timeout"
 lock_timeout
--------------
 0
(1 row)

➜  ~ kubectl edit postgrescluster hippo # <-- where I edit the spec
postgrescluster.postgres-operator.crunchydata.com/hippo edited
➜  ~ kubectl logs hippo-instance1-rwz8-0
...
2023-07-05 22:00:18,613 INFO: no action. I am (hippo-instance1-rwz8-0), the leader with the lock
2023-07-05 22:00:18,617 INFO: Changed lock_timeout from 0 to 5
2023-07-05 22:00:18,619 INFO: Reloading PostgreSQL configuration.
server signaled
➜  ~ kubectl exec -it hippo-instance1-rwz8-0 -c database -- psql -c "show lock_timeout"
 lock_timeout
--------------
 5ms
(1 row)
```

When I updated the spec, I added the following:

```
spec:
  patroni:
    dynamicConfiguration:
      postgresql:
        parameters:
          lock_timeout: 5
```

(I did have to check the docs to make sure I was updating the spec correctly.)

So why isn't it working for you? Can you share your Kubernetes and PGO version information, and also the spec you used?

yours,
Ben

Ivan Kurnosov

unread,
Jul 8, 2023, 7:54:11 AM7/8/23
to Ben Blattberg, Postgres Operator
Ben,

oh thanks a lot for that! I now see where I overlooked the docs: I configured the parameters in `spec.patroni.dynamicConfiguration`, but the correct path is `spec.patroni.dynamicConfiguration.postgresql.parameters`.

And yep, I confirm that the correct path works for me too, thanks again!
--
With best regards, Ivan Kurnosov
Reply all
Reply to author
Forward
0 new messages