Re: New option for pg_basebackup, to specify a different directory for pg_xlog

From: Haribabu kommi <haribabu(dot)kommi(at)huawei(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Magnus Hagander <magnus(at)hagander(dot)net>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: New option for pg_basebackup, to specify a different directory for pg_xlog
Date: 2013-12-11 10:22:32
Message-ID: 8977CB36860C5843884E0A18D8747B0372BF3072@szxeml558-mbs.china.huawei.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 10 December 2013 19:55 Alvaro Herrera wrote:
> Haribabu kommi escribió:
>
> > To detect provided data and xlog directories are same or not, I
> reused
> > the Existing make_absolute_path() code as follows.
> >
> > 1. Moved the make_absolute_path() function from miscinit.c to path.c
> > and Changed all error reporting functions. And also it returns NULL
> > incase of any error.
> >
> > 2. Added a new file called fe_path.c which contains
> > make_absolute_path() only for frontend code.
>
> Whatever you do, please don't add #include lines to postgres_fe.h. Add
> them to whatever .c files that need to include the new header, instead.
> (This results in a longer patch, yes, but that consideration shouldn't
> drive anything. There is a desire to include as less headers as
> possible in each source file, and adding more include lines to
> postgres_fe.h means the new header will be included by every single
> frontend file, even those not in core.)
>
> See a nearby patch by Bruce Momjian to deal with getpwnam() and
> getpwuid() failures; perhaps the idea of returning an error string
> should be designed similarly in both these patches. Also consider
> using the psprintf stuff, which works on both backend and frontend,
> avoiding malloc etc so that code can be shared by both frontend and
> backend, eliminating the duplicity.

The make_absolute_path() function moving to port is changed in similar way as
Bruce Momjian approach. The psprintf is used to store the error string which
Occurred in the function. But psprintf is not used for storing the absolute path
As because it is giving problems in freeing the allocated memory in SelectConfigFiles.
Because the same memory is allocated in a different code branch from guc_malloc.

After adding the make_absolute_path() function with psprintf stuff in path.c file
It is giving linking problem in compilation of ecpg. I am not able to find the problem.
So I added another file abspath.c in port which contains these two functions.

Updated patches are attached in the mail. Please provide your suggestions.

Regards,
Hari babu.

Attachment Content-Type Size
same_dir_error_v2.patch application/octet-stream 1.8 KB
make_abs_path_v2.patch application/octet-stream 12.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message hubert depesz lubaczewski 2013-12-11 10:41:10 Re: Question about sorting internals
Previous Message Dimitri Fontaine 2013-12-11 10:06:24 Re: Completing PL support for Event Triggers