diff mbox series

[bug#74058,v8,1/2] gnu: postgresql-configuration: Unset default postgresql.

Message ID 20241116134811.4660-1-ngraves@ngraves.fr
State New
Headers show
Series [bug#74058,v8,1/2] gnu: postgresql-configuration: Unset default postgresql. | expand

Commit Message

Nicolas Graves Nov. 16, 2024, 1:48 p.m. UTC
* gnu/services/databases.scm (postgresql-configuration)[postgresql]:
Unset default.
(postgresql-service-type): Remove default-value.
(postgresql-service): Revert default to postgresql-10 (rationale: We
can remove this service at the same time than postgresql-10, in
something like 6 months to a year).
* doc/guix.texi: Remove postgresql default reference in documentation.
---
 doc/guix.texi              |  2 +-
 gnu/services/databases.scm | 10 ++++++----
 2 files changed, 7 insertions(+), 5 deletions(-)

Comments

pelzflorian (Florian Pelz) Nov. 16, 2024, 5:34 p.m. UTC | #1
Nicolas Graves via Guix-patches via <guix-patches@gnu.org> writes:
> -(define-deprecated (postgresql-service #:key (postgresql postgresql)
> +(define-deprecated (postgresql-service #:key (postgresql postgresql-10)

Hello Nicolas.  Sorry, another issue.

As it should be, after createdb in `guix shell postgresql@14`, reconfigure with

(service postgresql-service-type)

gives the error

guix system: Fehler: /etc/config.scm:72:21: no value specified for service of type 'postgresql'

; I change it to

(service postgresql-service-type
         (postgresql-configuration
          (postgresql postgresql-10)))

and reconfigure works again, but after rebooting,

sudo herd status

shows postgres has failed to start.

/var/log/postgresql/pg_ctl.log contains:

2024-11-15 20:37:27.366 GMT [32375] LOG:  ending log output to stderr
2024-11-15 20:37:27.366 GMT [32375] HINT:  Future log output will go to log destination "syslog".
2024-11-16 08:06:09.690 GMT [342] LOG:  ending log output to stderr
2024-11-16 08:06:09.690 GMT [342] HINT:  Future log output will go to log destination "syslog".
2024-11-16 11:48:56.075 GMT [344] LOG:  ending log output to stderr
2024-11-16 11:48:56.075 GMT [344] HINT:  Future log output will go to log destination "syslog".
2024-11-16 16:41:19.144 GMT [347] FATAL:  database files are incompatible with server
2024-11-16 16:41:19.144 GMT [347] DETAIL:  The data directory was initialized by PostgreSQL version 14, which is not compatible with this version 10.23.


Should we set the default to postgresql-14 and change /etc/news.scm to
recommend version 14, or instead recommend looking for an error in file
/var/log/postgresql/pg_ctl.log?

I used `guix shell postgresql@14` because it’s the version I get with
`guix build -e '(@ (gnu packages databases) postgresql)'`.  Was that
wrong?

Regards,
Florian
pelzflorian (Florian Pelz) Nov. 16, 2024, 8:24 p.m. UTC | #2
Pushed as b93434e656eba4260df82158a96c295000d3ff44.

Ohh Nicolas, I just saw the guix-devel thread which caused you to make
the patch.

https://lists.gnu.org/archive/html/guix-devel/2024-10/msg00199.html

Sorry for the misunderstanding!

Regards,
Florian
diff mbox series

Patch

diff --git a/doc/guix.texi b/doc/guix.texi
index 2ab78d6237..ba4bd2cc79 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -26247,7 +26247,7 @@  Data type representing the configuration for the
 @code{postgresql-service-type}.
 
 @table @asis
-@item @code{postgresql} (default: @code{postgresql})
+@item @code{postgresql}
 PostgreSQL package to use for the service.
 
 @item @code{port} (default: @code{5432})
diff --git a/gnu/services/databases.scm b/gnu/services/databases.scm
index 0933eb5e79..e8a4acc996 100644
--- a/gnu/services/databases.scm
+++ b/gnu/services/databases.scm
@@ -167,8 +167,11 @@  (define contents
 (define-record-type* <postgresql-configuration>
   postgresql-configuration make-postgresql-configuration
   postgresql-configuration?
-  (postgresql         postgresql-configuration-postgresql ;file-like
-                      (default postgresql))
+  ;; Setting no default ensures that the user sets its current postgresql
+  ;; explicitely.  Since major upgrades currently require a manual migration
+  ;; of the database, this way the user is responsible for upgrading properly.
+  ;; MAYBE TODO: Write an action to automatically upgrade in Guix.
+  (postgresql         postgresql-configuration-postgresql) ;file-like
   (port               postgresql-configuration-port
                       (default 5432))
   (locale             postgresql-configuration-locale
@@ -343,10 +346,9 @@  (define postgresql-service-type
           (service-extension
            profile-service-type
            (compose list postgresql-configuration-postgresql))))
-   (default-value (postgresql-configuration))
    (description "Run the PostgreSQL database server.")))
 
-(define-deprecated (postgresql-service #:key (postgresql postgresql)
+(define-deprecated (postgresql-service #:key (postgresql postgresql-10)
                                        (port 5432)
                                        (locale "en_US.utf8")
                                        (config-file (postgresql-config-file))