RE: pg_ctl start may return 0 even if the postmaster has been already started on Windows

From: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
To: 'Kyotaro Horiguchi' <horikyota(dot)ntt(at)gmail(dot)com>
Cc: "shlok(dot)kyal(dot)oss(at)gmail(dot)com" <shlok(dot)kyal(dot)oss(at)gmail(dot)com>, "michael(at)paquier(dot)xyz" <michael(at)paquier(dot)xyz>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: RE: pg_ctl start may return 0 even if the postmaster has been already started on Windows
Date: 2023-10-24 07:37:22
Message-ID: TYAPR01MB586640F8FFA4F87902BDF677F5DFA@TYAPR01MB5866.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dear Horiguchi-san,

Thanks for updates! I was quite not sure the Windows env, but I can post comments.
(We need reviews by windows-friendly developers...)

> Other error cases will fit to "shouldn't occur under normal
> conditions" errors.

Formatting of messages for write_stderr() seem different from others. In v3,
I slightly modified for readability like below. I wanted to let you know just in case
because you did not say anything about these changes...

```
+ /* create a process snapshot */
+ hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
+ if (hSnapshot == INVALID_HANDLE_VALUE)
+ {
+ write_stderr(_("%s: could not create a snapshot: error code %lu\n"),
+ progname, (unsigned long) GetLastError());
+ exit(1);
+ }
+
+ /* start iterating on the snapshot */
+ ppe.dwSize = sizeof(PROCESSENTRY32);
+ if (!Process32First(hSnapshot, &ppe))
+ {
+ write_stderr(_("%s: cound not retrieve information about the process: error code %lu\n"),
+ progname, GetLastError());
+ exit(1);
+ }
+
```

Best Regards,
Hayato Kuroda
FUJITSU LIMITED

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2023-10-24 07:50:02 Re: [PoC] pg_upgrade: allow to upgrade publisher node
Previous Message Peter Smith 2023-10-24 07:35:42 Re: Synchronizing slots from primary to standby