problem with PG install script on Windows

From: "Igor Neyman" <ineyman(at)perceptron(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Cc: "Dave Page" <dpage(at)pgadmin(dot)org>
Subject: problem with PG install script on Windows
Date: 2010-10-12 18:26:16
Message-ID: F4C27E77F7A33E4CA98C19A9DC6722A2069F26DA@EXCHANGE.corp.perceptron.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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


Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rodrigo E. De León Plicet 2010-10-12 20:28:03 Re: NoSQL -vs- SQL
Previous Message Randal L. Schwartz 2010-10-12 16:49:23 Re: NoSQL -vs- SQL