Bad UI design: pg_ctl and data_directory

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Bad UI design: pg_ctl and data_directory
Date: 2011-06-01 19:55:56
Message-ID: 4DE6994C.7010604@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

All,

pg_ctl -D means different things depending on whether you are calling
"start" or "stop". For "start", pg_ctl wants the directory
postgresql.conf is in, and for "stop" it wants the directory
postmaster.pid is in. This means that if your .conf files are not in
the same directory as data_directory, you have to write special-case
code for start and stop.

Given that having the .conf files in /etc is the default configuration
for both Red Hat and Debian, this seems like really poor UI design on
our part. Also, it makes the "data_directory" parameter somewhat
disingenous, because effectively that parameter doesn't work all the time.

It actually seems relatively easy to fix this without breaking
backwards-compatibility. We should add this logic to "pg_ctl stop":

1) if postmaster.pid is in -D, shut down that pid.
2) if postmaster.pid is not in -D, look for postgresql.conf
3) if postgresql.conf is found, look in data_directory for postmaster.pid

This would end the pg_ctl breakage on our most popular platforms, while
not changing any functionality for those already installed. Objections?

--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Florian Pflug 2011-06-01 19:56:25 Re: [BUGS] BUG #6034: pg_upgrade fails when it should not.
Previous Message Peter Eisentraut 2011-06-01 18:28:56 Re: [BUGS] BUG #6034: pg_upgrade fails when it should not.