Re: GCoS2019--pgBackRest port to Windows (2019)

From: David Steele <david(at)pgmasters(dot)net>
To: Youssef Khedher <youssefkhedher(dot)contact(at)gmail(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: GCoS2019--pgBackRest port to Windows (2019)
Date: 2019-04-02 11:32:42
Message-ID: ddcd5c2b-0f80-11da-106e-0efd9684416e@pgmasters.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello Youssef,

On 4/1/19 5:16 PM, Youssef Khedher wrote:
> Hello,
>
> I’m Youssef Khedher, 19 years old student from Tunisia.
>
> I’m a computer science student in Tunisia, and also an online student
> for Harvard CS50 Program.
>
> I’m interested in the ” pgBackRest port to Windows (2019)”.

Excellent!

> To be frank with you, I’m not an expert in C

You'll need to be able to understand and modify many areas of the C code
in order to be successful in this project. I would encourage you to
review the code and make sure you are able to follow what it's doing in
general before submitting an application:

https://github.com/pgbackrest/pgbackrest/tree/master/src

I don't think you'll be writing a bunch of new code, but anything is
possible when porting software.

> In order to achieve the project goal, all I need from you MR. Stephen
> Frost or MR. David Steele is some help to understand perfectly the task
> and to help me enter to world of software development.

For this project it's important to have knowledge about how Windows
differs from Unix, e.g. the way child processes are spawned. In the
core code we only use fork() with an immediate exec(), so this should be
straightforward enough to port:

https://github.com/pgbackrest/pgbackrest/blob/master/src/command/archive/get/get.c#L235

We also use fork() quite a bit in our testing and I was thinking the
HARNESS_FORK*() macros could be enhanced to use threads instead on Windows:

https://github.com/pgbackrest/pgbackrest/blob/master/test/src/common/harnessFork.h

If not, then the tests will need to be adjusted to accommodate whatever
testing method is developed.

pgBackRest uses SSH to communicate with remote processes:

https://github.com/pgbackrest/pgbackrest/blob/master/src/protocol/helper.c#L288

Eventually we would like to move away from requiring SSH, but for this
port I think the best idea would be to get pgBackRest working with some
open source SSH solution such as OpenSSH (which is easily installed on
recent versions of Windows, but not sure about older versions). If
there is time at the end we might look at alternate solutions.

There may be other minor areas in the code that need be adjusted or
#ifdef'd to work with Windows. We've tried to keep this to a minimum by
enforcing C99 and Posix standards, but there will be some differences.
The config code that enforces Unix path structure is an obvious area
that will need to be updated:

https://github.com/pgbackrest/pgbackrest/blob/master/src/config/parse.c#L1034

Note that we want to port to native Windows without the presence of
Cygwin (or similar) in production. My preference would be to use
something like Strawberry Perl for testing, and then as few dependencies
as possible for the production distribution.

A CI testing platform for Windows will need to be selected -- mostly
likely AppVeyor.

The documentation will also need to be updated for Windows.

You should delve into the areas mentioned above and propose possible
solutions when writing your proposal. Feel free to ask questions.

Porting code from one platform to another can be quite complicated, but
we believe this project can be accomplished over the summer by a skilled
and motivated student.

If you are interested in proceeding, you should create an issue here:

https://github.com/pgbackrest/pgbackrest/issues

We do our development on Github and issues are the way we discuss
projects, enhancements, and bugs.

Good luck!
--
-David
david(at)pgmasters(dot)net

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2019-04-02 11:48:39 Re: Ordered Partitioned Table Scans
Previous Message Kyotaro HORIGUCHI 2019-04-02 10:54:06 Re: [HACKERS] WAL logging problem in 9.4.3?