Re: Review: Patch to compute Max LSN of Data Pages - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: Review: Patch to compute Max LSN of Data Pages
Date
Msg-id 003a01cdcd53$c8d786c0$5a869440$@kapila@huawei.com
Whole thread Raw
In response to Re: Review: Patch to compute Max LSN of Data Pages  (Muhammad Usama <m.usama@gmail.com>)
List pgsql-hackers
On Wednesday, November 28, 2012 11:49 AM Muhammad Usama wrote:
On Tue, Nov 27, 2012 at 5:52 PM, Amit kapila <amit.kapila@huawei.com> wrote:
Friday, November 23, 2012 5:38 AM Muhammad Usama wrote:
 
>>> - For -p {file | dir}  option the utility expects the file path relative
to
>>> the specified data directory path which makes thing little confusing
>>> for example
>>> ./pg_computemaxlsn -p data/base/12286/12200 data
>>> pg_computemaxlsn: file or directory "data/base/12286/12200" does not
exists
>>> although data/base/12286/12200 is valid file path but we gets file does
not
>>> exists error
>> As the path of file is relative to data directory, that's why in error it
prints the path as "data/base/12286/12200".
>> Do you have any suggestion what should be done for this?
 
>I think we should expect provided path to be relative to current directory
or may consider it to be relative to either one of Data or CWD.
>Because normally we expect path to be relative to CWD if some program is
asking for path in command line. And also tab-complete doesn't >works on
terminal if path is not absolute or relative to the current directory.
>To handle this I think we should not change current directory to the data
directory and generate the file path (like for postmaster.pid) >where
required by appending data directory path.
>And before throwing an error should check if path is valid for either DATA
or CWD something like

Apart from that, I think it needs to also check if the path is under data
directory path in either case, else it can get LSN for some running server
as pointed in your other point.

Also shouldn't we support relative to one of CWD or data directory rather
than both?

Any opinions from others what is the best to support in such a use case.
a. File/Folder path Relative to CWD (Current working directory)
b. File/Folder path Relative to data directory
c. to both a and b

With Regards,
Amit Kapila.




pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: plpgsql_check_function - rebase for 9.3
Next
From: Kohei KaiGai
Date:
Subject: Re: FDW for PostgreSQL