Gentoo Archives: gentoo-dev

From: "Canek Peláez Valdés" <caneko@×××××.com>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] systemd + postgresql is non-obvious to me
Date: Fri, 22 Aug 2014 18:42:50
Message-Id: CADPrc82=UCC+mDA8cG4Yo+E7fA0B-kne+m-G5jBeFrG1f3uuCQ@mail.gmail.com
In Reply to: Re: [gentoo-dev] systemd + postgresql is non-obvious to me by Rich Freeman
1 On Fri, Aug 22, 2014 at 1:07 PM, Rich Freeman <rich0@g.o> wrote:
2 > On Fri, Aug 22, 2014 at 1:23 PM, Aaron W. Swenson <titanofold@g.o> wrote:
3 >> On the whole, I'm displeased with the systemd alternative for
4 >> controlling PostgreSQL. It's significantly hampered and doesn't allow
5 >> as much flexibility as the initscript. The major issue being trying to
6 >> nicely shut down the server instead of jumping straight to murder.
7 >>
8 >
9 > It looks like the package installs a service file provided by
10 > upstream, so you might want to direct your complaint there unless it
11 > really is a systemd limitation.
12 >
13 > Checking the latest version in portage it calls:
14 > ExecStop=/usr/@LIBDIR@/postgresql-@SLOT@/bin/pg_ctl stop -D
15 > ${DATA_DIR} -s -m fast
16 >
17 > I'm no postresql expert, but according to the manpage that should
18 > bring the server to a screeching, but still controlled, halt. Perhaps
19 > you would prefer setting it to -m smart instead of -m fast.
20 >
21 > If so override it in /etc/systemd/system. I generally recommend using
22 > drop-ins for this, but I'm not sure if doing a drop-in for ExecStop
23 > will override the existing value, or simply cause systemd to run both
24 > commands (which means that whichever runs first will control how it
25 > stops).
26
27 It's the same as with ExecStart=; it gets added to a list, and all of
28 them are executed in the same order as they appear in the unit file.
29 In a drop-in, you can reset the list like this:
30
31 ExecStop=
32 ExecStop=new_and_only_command_to_be_executed
33
34 > Systemd shouldn't begin killing processes without mercy until the
35 > process invoked in ExecStop terminates, so it should not terminate
36 > until the process has finished graceful shutdown.
37
38 If ExecStop= wasn't specified, systemd would immediaely kill all the
39 service processes; from [1]: "If this option [ExecStop] is not
40 specified, the process is terminated immediately when service stop is
41 requested", which kinda sounds like "jumping straight to murder."
42
43 That the upstream unit file is configured otherwise, shows that
44 PostgreSQL upstream itself thinks that's a bad idea. No fault on
45 systemd's part.
46
47 Regards.
48
49 [1] http://www.freedesktop.org/software/systemd/man/systemd.service.html
50 --
51 Canek Peláez Valdés
52 Profesor de asignatura, Facultad de Ciencias
53 Universidad Nacional Autónoma de México