Re: problem with PG install script on Windows

From: "Igor Neyman" <ineyman(at)perceptron(dot)com>
To: "Ashesh Vashi" <ashesh(dot)vashi(at)enterprisedb(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>, "Dave Page" <dpage(at)pgadmin(dot)org>
Subject: Re: problem with PG install script on Windows
Date: 2010-10-13 12:50:36
Message-ID: F4C27E77F7A33E4CA98C19A9DC6722A2069F2911@EXCHANGE.corp.perceptron.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

________________________________

From: Ashesh Vashi [mailto:ashesh(dot)vashi(at)enterprisedb(dot)com]
Sent: Wednesday, October 13, 2010 1:32 AM
To: Igor Neyman
Cc: pgsql-general(at)postgresql(dot)org; Dave Page
Subject: Re: [GENERAL] problem with PG install script on Windows


Hi Igor Neyman,

Yeah - I agree with you.
That needs to be changed.

But, I see scope of the improvement in the script, you shared.
That is - what if the service never started, then it will never
return from the script.

We will do the required changes, Thanks for your inputs.


--
Thanks & Regards,

Ashesh Vashi
EnterpriseDB INDIA: Enterprise Postgres Company
<http://www.enterprisedb.com>

http://www.linkedin.com/in/asheshvashi
<http://www.linkedin.com/in/asheshvashi>


<http://s.wisestamp.com/pixel.png?p=mozilla&v=2.0.3&t=1286947586299&u=27
9023&e=4321>

On Tue, Oct 12, 2010 at 11:56 PM, Igor Neyman
<ineyman(at)perceptron(dot)com> wrote:

This message is CCed to Dave Page, because his name is
found in startserver.vbs script discussed later.

I think there is a (minor?) problem with 8.4.5 Windows
installer from EnterpriseDB (probably othere releases as well - didn't
check).

Here is an abstract from the "tail" of my installation
log file:


/*********************************************************/
Starting the database server...
Executing cscript //NoLogo
"C:\VectorDB\installer\server\startserver.vbs" PostgreSQL
Script exit code: 0

Script output:
Starting PostgreSQL
Service PostgreSQL started successfully
startserver.vbs ran to completion

Script stderr:


Loading additional SQL modules...
Executing cscript //NoLogo
"C:\VectorDB\installer\server\loadmodules.vbs" "postgres" "****"
"C:\VectorDB" "C:\VectorDB\data" 5432 "1"
Script exit code: 2

Script output:
Installing pl/pgsql in the template1 databases...
Start DoCmd("C:\VectorDB\bin\psql.exe" -p 5432 -U
postgres -c "CREATE LANGUAGE plpgsql;" template1)...
Executing
'C:\Users\vmwin7\AppData\Local\Temp\rad87CE4.bat'...
psql: FATAL: the database system is starting up

End DoCmd()
Failed to install pl/pgsql in the 'template1' database
Installing the adminpack module in the postgres
database...
Start DoCmd("C:\VectorDB\bin\psql.exe" -p 5432 -U
postgres -f "C:\VectorDB\share\contrib\adminpack.sql" postgres)...
Executing
'C:\Users\vmwin7\AppData\Local\Temp\rad87CE4.bat'...
psql: FATAL: the database system is starting up

End DoCmd()
Failed to install the 'adminpack' module in the
'postgres' database
loadmodules.vbs ran to completion

Script stderr:
Program ended with an error exit code


/*********************************************************/


According to this code in startserver.vbs:

/**********************/
' Find the service
Set objService =
objWMIService.Get("Win32_Service.Name='" & strServiceName & "'")

' Start it (them)
If objService.State <> "Running" Then
WScript.Echo "Starting " & objService.Name
iRetval = objService.StartService()
If iRetval = 0 Then
WScript.Echo "Service " & objService.Name & "
started successfully"
Else
WScript.Echo "Failed to start the database
server (" & iRetVal & ")"
WScript.Quit 1
End If
Else
WScript.Echo "Service " & objService.Name & " is
already running"
End If

/**********************/

here is what happened on my system:
1. startserver.vbs sends a signal to Postgresql service
to start: "iRetval = objService.StartService()"
2. Postgres accepted the signal and set iRetval = 0,
but didn't start yet (admittedely machine was busy doing something else
at the same time)
3. VB script assumes that service is started (without
actually checking it's status) and proceeds trying to connect to PG
(while running next installation VB script - loadmodules.vbs, according
to installation log).

I realize it's a rare situation when machine will be
busy with something else while installing Postgres.
But, it still can happen, and "stricter" code could
avoid this problem:6



/**********************/
' Find the service
Set objService =
objWMIService.Get("Win32_Service.Name='" & strServiceName & "'")

' Start it (them)
If objService.State <> "Running" Then
WScript.Echo "Starting " & objService.Name
iRetval = objService.StartService()
If iRetval = 0 Then
Do Until objService.State = "Running"
WScript.Sleep(5000)
Loop
WScript.Echo "Service " & objService.Name & "
started successfully"
Else
WScript.Echo "Failed to start the database
server (" & iRetVal & ")"
WScript.Quit 1
End If
Else
WScript.Echo "Service " & objService.Name & " is
already running"
End If

/**********************/

If it really waits for service to start, checking it's
status in a loop.
Same status check probably needed earlier in the script,
where it's trying to start dependencies services.


oh, and I have to admit that I have zero VB scripting
experience, so please correct me if my code modification is wrong.

Regards,
Igor Neyman

[I.N.] Hello Ashesh,

Could you tell, when this fix will get into EnterpriseDB
installer, and it'll be possible to download it?

Regards,
Igor Neyman

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2010-10-13 13:21:33 Re: Understanding PostgreSQL Storage Engines
Previous Message Dmitriy Igrishin 2010-10-13 12:48:41 Re: Gripe: bytea_output default => data corruption