# Citus wants to be the first in the line with shared\_preload\_libraries in postgresql.conf

**URL:** <https://forums.percona.com/t/citus-wants-to-be-the-first-in-the-line-with-shared-preload-libraries-in-postgresql-conf/25780>\
**Category:** Percona Operator for PostgreSQL\
**Created:** [October 9, 2023, 3:34pm UTC](https://forums.percona.com/t/citus-wants-to-be-the-first-in-the-line-with-shared-preload-libraries-in-postgresql-conf/25780 "2023-10-09T15:34:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sergey\_Zhuravlev](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/sergey_zhuravlev/32/6410_2.png) [@Sergey\_Zhuravlev](https://forums.percona.com/u/Sergey_Zhuravlev)\
**Post date:** [October 9, 2023, 3:34pm UTC](https://forums.percona.com/t/citus-wants-to-be-the-first-in-the-line-with-shared-preload-libraries-in-postgresql-conf/25780/1 "2023-10-09T15:34:10Z")

</div>

## Description:

citus wants to be the first in the line with shared\_preload\_libraries in postgresql.conf  
and if this is not so, then the PG does not start with such a message:

```auto
2023-10-09 14:06:16,761 INFO: starting as a secondary
2023-10-09 14:06:16.921 UTC [354] LOG: pgaudit extension initialized
2023-10-09 14:06:16,921 INFO: postmaster pid=354
2023-10-09 14:06:16.923 UTC [354] FATAL: Citus has to be loaded first
2023-10-09 14:06:16.923 UTC [354] HINT: Place citus at the beginning of shared_preload_libraries.
2023-10-09 14:06:16.923 UTC [354] LOG: database system is shut down

```

## Steps to Reproduce:

probably just write to your cr.yaml

```auto
  patroni:
    dynamicConfiguration:
      postgresql:
        parameters:

          shared_preload_libraries: citus,pg_stat_monitor,pgaudit,pg_stat_statements

```

## Version:

PGO 2.2

The problem is that the operator himself writes “his” extensions first in this line of the config.  
In this case, the cluster configmap contains the line:

```auto
          shared_preload_libraries: citus,pg_cron,pg_stat_monitor,pgaudit,pg_stat_statements

```

but postgresql.conf contains:

```auto
bash-4.4$ grep 'citus' /pgdata/pg13/postgresql.conf
shared_preload_libraries = 'pg_stat_monitor,pgaudit,citus,pg_cron,pg_stat_monitor,pgaudit,pg_stat_statements'

```

how to fix this behavior?

---

<div class="post-metadata">

**Author:** ![Robert\_Bernier](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/robert_bernier/32/1367_2.png) [@Robert\_Bernier](https://forums.percona.com/u/Robert_Bernier)\
**Post date:** [October 9, 2023, 4:00pm UTC](https://forums.percona.com/t/citus-wants-to-be-the-first-in-the-line-with-shared-preload-libraries-in-postgresql-conf/25780/2 "2023-10-09T16:00:27Z")

</div>

Without referring to our in house K8s experts offhand I’d suggest rewriting using ALTER SYSTEM …

Try it out and see if this works for you.

---

<div class="post-metadata">

**Author:** ![Sergey\_Zhuravlev](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/sergey_zhuravlev/32/6410_2.png) [@Sergey\_Zhuravlev](https://forums.percona.com/u/Sergey_Zhuravlev)\
**Post date:** [October 10, 2023, 9:14am UTC](https://forums.percona.com/t/citus-wants-to-be-the-first-in-the-line-with-shared-preload-libraries-in-postgresql-conf/25780/3 "2023-10-10T09:14:59Z")

</div>

Thanks for the idea, it will help get out now.

For those who may be trying now, you can proceed like this:

We don’t mention citus in the shared\_preload\_libraries on cr.yaml  
After the start, we look at what we now have in the shared\_preload\_libraries  
make an ALTER SYSTEM… with citus in the first position in the line.

There are two points here:

1. currently the operator prescribes “their” shared\_preload\_libraries first ( pg\_stat\_monitor,pgaudit), although they don’t need this and it’s probably better to change this behavior.  
Do - first what is indicated in the manifesto cr.yaml after yours

2. there is still hope for Patroni, which seems to be from version 3, namely it in PGO v2.2, knows about citus and allows you to make the appropriate settings and then Patroni will be the first to register citus itself in the shared\_preload\_libraries. Well, besides this, it will give some new opportunities for the collaboration of Patroni and citus

We’re going to try the last one

---

<div class="post-metadata">

**Author:** ![Robert\_Bernier](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/robert_bernier/32/1367_2.png) [@Robert\_Bernier](https://forums.percona.com/u/Robert_Bernier)\
**Post date:** [October 10, 2023, 5:37pm UTC](https://forums.percona.com/t/citus-wants-to-be-the-first-in-the-line-with-shared-preload-libraries-in-postgresql-conf/25780/4 "2023-10-10T17:37:02Z")

</div>

Doing a followup: I checked with our people and an internal JIRA ticket has been generated assigning this issue as a bug.

> there is still hope for Patroni …

This sounds good. Keep me in the loop and tell me how it goes on your end of things.

---

<div class="post-metadata">

**Author:** ![Sergey\_Zhuravlev](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/sergey_zhuravlev/32/6410_2.png) [@Sergey\_Zhuravlev](https://forums.percona.com/u/Sergey_Zhuravlev)\
**Post date:** [October 11, 2023, 7:59am UTC](https://forums.percona.com/t/citus-wants-to-be-the-first-in-the-line-with-shared-preload-libraries-in-postgresql-conf/25780/5 "2023-10-11T07:59:04Z")

</div>

Okay - I’ll let you know

On the one hand, patroni may not know anything about the citus cluster, but only engage in their own standbys.

Then the citus cluster can be assembled approximately as in the manual for individual database servers.

But the author of patroni made sure that patroni knew about the citus cluster and could better show the state of the citus cluster as a whole and do some service things that would otherwise need to be done manually. Add a node to the cluster, etc.

It’s described here:  
[https://patroni.readthedocs.io/en/latest/citus.html](https://patroni.readthedocs.io/en/latest/citus.html)

There is a concern that without the help of Percona specialists we will be able to implement what is described in the Citus on Kubernetes section

[https://patroni.readthedocs.io/en/latest/citus.html#citus-on-kubernetes](https://patroni.readthedocs.io/en/latest/citus.html#citus-on-kubernetes)

But we are moving) – join us.  
If a operator can deploy and manage a citus cluster, providing horizontal scaling, that would be really cool.  
It’s unlikely that any operator can do this now)
