Re: pgsql: Improve performance of timezone loading, especially pg_timezone_

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-committers <pgsql-committers(at)postgresql(dot)org>
Subject: Re: pgsql: Improve performance of timezone loading, especially pg_timezone_
Date: 2017-05-07 14:58:27
Message-ID: CAA4eK1LavHN_7HB7ztn3W5EgiqiB+GR_+2+LP3qb_+_Z7MbZ1A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On Sun, May 7, 2017 at 2:33 PM, David Rowley
<david(dot)rowley(at)2ndquadrant(dot)com> wrote:
> , On 7 May 2017 at 17:19, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> writes:
>>> On Wed, May 3, 2017 at 7:21 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>>> Improve performance of timezone loading, especially pg_timezone_names view.
>>
>>> I am consistently getting below error after this commit in my Win7 machine:
>>> running bootstrap script ... 2017-05-07 05:09:13.383 GMT [7908] LOG:
>>> could not open directory "/installation/share/timezone/posixrules": No
>>> such file or directory
>>
>>> This occurs both during initdb and server start.
>>
>> You sure it wasn't there before, too?

Yes and that is confirmed by David as well.

>> That commit did not add any
>> file reads that didn't happen before.
>
> It didn't exist before either, but I don't think the error is what you
> think. Please note the error message indicated it's looking for a
> "directory" named posixrules, not the file.
>
> The error seems to be due to this code:
>
> if (canonname == NULL)
> {
> int result;
>
> fullname[fullnamelen] = '/';
> /* test above ensured this will fit: */
> strcpy(fullname + fullnamelen + 1, name);
> result = open(fullname, O_RDONLY | PG_BINARY, 0);
> if (result >= 0)
> return result;
> /* If that didn't work, fall through to do it the hard way */
> }
>
> where we append the name, then try to open the file, but since the
> file does not exist result is < 0 and we fall through to the for(;;)
> loop and try to do scan_directory_ci() on the filename rather than the
> directory.
>
>
> /* If that didn't work, fall through to do it the hard way */
> fullname[fullnamelen] = '\0';
>

Yes, that is one way of doing it, otherwise, we could save the
original fullname (before appending 'name' to it) and then use the
same in for loop.

> but I've not yet looked into why the file is missing in the first place.

I think it is better to consider that as a separate patch as that is a
different problem that exists before this commit as well.

--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Amit Kapila 2017-05-07 15:03:36 Re: pgsql: Improve performance of timezone loading, especially pg_timezone_
Previous Message Tom Lane 2017-05-07 14:57:08 Re: pgsql: Improve performance of timezone loading, especially pg_timezone_