pg_resetxlog defect with relative database path - Mailing list pgsql-hackers

From Hari Babu
Subject pg_resetxlog defect with relative database path
Date
Msg-id 000f01cdc8b4$6c186920$44493b60$@kommi@huawei.com
Whole thread Raw
In response to Re: PQconninfo function for libpq  (Boszormenyi Zoltan <zb@cybertec.at>)
Responses Re: pg_resetxlog defect with relative database path
List pgsql-hackers
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 start2. ./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?

Regards, 
Hari babu.




pgsql-hackers by date:

Previous
From: Boszormenyi Zoltan
Date:
Subject: Re: PQconninfo function for libpq
Next
From: Fujii Masao
Date:
Subject: Re: pg_resetxlog defect with relative database path