Re: pg_resetxlog defect with relative database path

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Hari Babu <haribabu(dot)kommi(at)huawei(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_resetxlog defect with relative database path
Date: 2012-11-22 14:56:52
Message-ID: CAHGQGwH79k2HT7YCNXnw0cwmk8bykZpTwShicJ1m4y0De+ud5Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Nov 22, 2012 at 10:22 PM, Hari Babu <haribabu(dot)kommi(at)huawei(dot)com> wrote:
>
> When I was testing pg_resetxlog with relative database path,
> The pg_resetxlog is doing the transaction log reset even when the server is
> running.
>
> Steps to reproduce:
> 1. ./pg_ctl -D ../../data start
> 2. ./pg_resetxlog -f ../../data -- is not able to detect as server
> is already running.
>
>
> Please find the patch for the same:
>
> *** a/src/bin/pg_resetxlog/pg_resetxlog.c
> --- b/src/bin/pg_resetxlog/pg_resetxlog.c
> ***************
> *** 254,260 **** main(int argc, char *argv[])
> */
> snprintf(path, MAXPGPATH, "%s/postmaster.pid", DataDir);
>
> ! if ((fd = open(path, O_RDONLY, 0)) < 0)
> {
> if (errno != ENOENT)
> {
> --- 254,260 ----
> */
> snprintf(path, MAXPGPATH, "%s/postmaster.pid", DataDir);
>
> ! if ((fd = open("postmaster.pid", O_RDONLY, 0)) < 0)
> {
> if (errno != ENOENT)
> {
>
> Any suggestions/comments?

Looks good to me.

Regards,

--
Fujii Masao

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2012-11-22 15:17:16 Re: MySQL search query is not executing in Postgres DB
Previous Message Hari Babu 2012-11-22 13:22:27 pg_resetxlog defect with relative database path