Re: [PERFORM] scalability issues on win32
Claudio Natoli <[email protected]>
| Newsgroups | gmane.comp.db.postgresql.devel.win32 |
|---|---|
| Message-ID | <[email protected]> |
Hi Merlin,
> On a probably unrelated note:
> Can some other win32 hacker try the following?
> Download the latest cvs sources from the server and edit configure,
> replacing all instances of '8.0beta5' with '8.0' etc. as is
> will be when released. Following that do a full make/make clean. After
> that try and start he server with pg_ctl.exe and tell me if it succeeds or
not.
I can confirm this failure.
(in my case at least) pg_ctl is not seeing the full version string of the
postmaster in find_other_exec. This is due to the single call to ReadFile in
pipe_read_line, which is not returning the entire version string (losing all
characters beyond the last decimal point in the version string). A
subsequent call to ReadFile picks up the remainder of the string. I don't
see that we can rely on a single call returning the entire version string.
If someone can run with this, I've attached initial looping changes for
pipe_read_line. However I'm not sure of the correct terminating condition
(gets into a call to ReadFile that never returns; the WaitForSingleObject
appears insufficient as a precondition for ReadFile) and just don't have
time to complete it right now.
Cheers,
Claudio
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match
pipe_read.diff
(application/octet-stream, 1.8 KB)
Index: src/port/exec.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/port/exec.c,v
retrieving revision 1.33
diff -c -r1.33 exec.c
*** src/port/exec.c 27 Nov 2004 22:44:15 -0000 1.33
--- src/port/exec.c 3 Dec 2004 01:55:07 -0000
***************
*** 486,511 ****
&si,
&pi))
{
- DWORD bytesread = 0;
-
/* Successfully started the process */
!
ZeroMemory(line, maxsize);
/* Let's see if we can read */
! if (WaitForSingleObject(childstdoutrddup, 10000) != WAIT_OBJECT_0)
{
! /* Got timeout */
! CloseHandle(pi.hProcess);
! CloseHandle(pi.hThread);
! CloseHandle(childstdoutwr);
! CloseHandle(childstdoutrddup);
! return NULL;
}
! /* We try just once */
! if (ReadFile(childstdoutrddup, line, maxsize, &bytesread, NULL) &&
! bytesread > 0)
{
/* So we read some data */
int len = strlen(line);
--- 486,519 ----
&si,
&pi))
{
/* Successfully started the process */
! DWORD bytesread = 0;
ZeroMemory(line, maxsize);
+ maxsize--; /* we need to leave room for at least one '\0' */
+
/* Let's see if we can read */
! while (bytesread < maxsize)
{
! DWORD tmpbytesread = 0;
! if (WaitForSingleObject(childstdoutrddup, 10000) != WAIT_OBJECT_0)
! {
! /* Got timeout */
! CloseHandle(pi.hProcess);
! CloseHandle(pi.hThread);
! CloseHandle(childstdoutwr);
! CloseHandle(childstdoutrddup);
! return NULL;
! }
!
! if (ReadFile(childstdoutrddup, &line[bytesread], maxsize - bytesread, &tmpbytesread, NULL)
! && tmpbytesread > 0)
! bytesread += tmpbytesread;
! else
! break;
}
! if (bytesread > 0)
{
/* So we read some data */
int len = strlen(line);