From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 8D1bMKzBdF+WLAAA0tVLHw (envelope-from ) for ; Wed, 30 Sep 2020 17:34:36 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id MOkyLKzBdF8rYwAA1q6Kng (envelope-from ) for ; Wed, 30 Sep 2020 17:34:36 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E164D940430 for ; Wed, 30 Sep 2020 17:34:35 +0000 (UTC) Received: from localhost ([::1]:48004 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kNfzu-0006e6-Q4 for larch@yhetil.org; Wed, 30 Sep 2020 13:34:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51922) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kNfzI-0006Fh-6R for guix-devel@gnu.org; Wed, 30 Sep 2020 13:33:56 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:39264) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kNfzH-0003GW-Sq for guix-devel@gnu.org; Wed, 30 Sep 2020 13:33:55 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=59274 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kNfzF-0000Mb-Q0; Wed, 30 Sep 2020 13:33:54 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Marius Bakke Subject: Re: Running service migrations during upgrades References: <87o8m062r2.fsf@gnu.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 9 =?utf-8?Q?Vend=C3=A9miaire?= an 229 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Wed, 30 Sep 2020 19:33:51 +0200 In-Reply-To: <87o8m062r2.fsf@gnu.org> (Marius Bakke's message of "Sun, 20 Sep 2020 14:39:45 +0200") Message-ID: <87imbvxj7k.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: guix-devel@gnu.org Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Spam-Score: -1.51 X-TUID: GOgYFV/E3SnB Hi! Marius Bakke skribis: > There is a patch to update MariaDB here: > > https://issues.guix.gnu.org/43355 > > Users of mysql-service-type will need to run 'mysql_upgrade' afterwards. > > I have been considering adding an AUTO-UPGRADE? parameter of > mysql-service-type that runs 'mysql_upgrade' as part of the activation > script. > > Another approach is adding a 'herd upgrade' Shepherd action along with a > news entry describing what to do. Of course it is possible to do both, > having 'auto-upgrade?' _and_ a Shepherd action for manual upgrades. Running upgrades in the activation snippet sounds reasonable. If =E2=80=98mysql_upgrade=E2=80=99 detects what version it is upgrading from, = that=E2=80=99s perfect. However, the activation snippet runs upon reconfigure even if the service is not restarted; so you could find yourself running version N but you=E2=80=99ve just upgraded the database to N+1. The safest way wou= ld be to do that in the =E2=80=98start=E2=80=99 method. But you can also add an =E2=80=98upgrade=E2=80=99 action to the service, ju= st like =E2=80=98mcron=E2=80=99 has a =E2=80=98schedule=E2=80=99 action. > While that works for MariaDB, I'm not sure what to do about Postgres. > For those unfamiliar, the procedure for upgrading from PostgreSQL 10 > (current default) to 11 (available in Guix) is roughly: > > sudo cp -a /var/lib/postgresql/data /var/lib/postgresql/data10 > sudo -u postgres $(guix build postgresql)/bin/pg_upgrade \ > --old-bindir=3D$(guix build postgresql@10)/bin \ > --new-bindir=3D$(guix build postgresql)/bin \ > --old-datadir=3D/var/lib/postgresql/data10 \ > --new-datadir=3D/var/lib/postgresql/data > > In order to automate it, we need to somehow preserve the "previous" > version of PostgreSQL so that we can reach it when the major version > changes. Or add an 'upgrade-from' parameter to > postgresql-service-type. One way would be to determine the previous generation number of /run/current-system and use, say, /var/guix/profiles/system-42-link/bin as the bindir. Not pretty. A nicer way would be to add a =E2=80=98bindir=E2=80=99 and a =E2=80=98datad= ir=E2=80=99 action to the postgresql service; the activation snippet could use it to find the right values. Thoughts? Thanks, Ludo=E2=80=99.