pg_dump "what if?"

Started by A. Mousabout 22 years ago9 messagesgeneral
Jump to latest
#1A. Mous
a.mous@shaw.ca

Hi,

I'm running pg_dump 7.3.4. I have a nightly process that dumps a database
via pg_dump, and then checks for the existence of the dumped file afterwards
to confirm that the dump actually occurred. Just wondering, however, if a
corrupt disk prevented pg_dump from executing fully, would there still be an
output file up to the point where the corruption was encountered? If so,
does anyone have any suggestions on another method to confirm whether or not
the db was successfully dumped?

BTW I'm running under Win2k using Cygwin.

Thanks in advance,

Pete

#2Dustin Sallings
dustin@spy.net
In reply to: A. Mous (#1)
Re: pg_dump "what if?"

On Mar 24, 2004, at 11:42, Anony Mous wrote:

I’m running pg_dump 7.3.4.  I have a nightly process that dumps a
database via pg_dump, and then checks for the existence of the dumped
file afterwards to confirm that the dump actually occurred.  Just
wondering, however, if a corrupt disk prevented pg_dump from executing
fully, would there still be an output file up to the point where the
corruption was encountered?  If so, does anyone have any suggestions
on another method to confirm whether or not the db was successfully
dumped?

The exit code?

--
Dustin Sallings

#3A. Mous
a.mous@shaw.ca
In reply to: Dustin Sallings (#2)
Re: pg_dump "what if?"

Thanks, but I'm calling a win32 compiled version of pg_dump, which runs
asynchronously to the rest of my code (sorry I was vague in my first
message). As such, I don't see how I can use the return value. My only
other thought was to check for the existence of the file, which would be
useless if the file represented an incomplete dump.

-----Original Message-----
From: Dustin Sallings [mailto:dustin@spy.net]
Sent: March 24, 2004 1:26 PM
To: Anony Mous
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] pg_dump "what if?"

On Mar 24, 2004, at 11:42, Anony Mous wrote:

I'm running pg_dump 7.3.4. I have a nightly process that dumps a database
via pg_dump, and then checks for the existence of the dumped file afterwards
to confirm that the dump actually occurred. Just wondering, however, if a
corrupt disk prevented pg_dump from executing fully, would there still be an
output file up to the point where the corruption was encountered? If so,
does anyone have any suggestions on another method to confirm whether or not
the db was successfully dumped?

The exit code?

--
Dustin Sallings

#4Shelby Cain
alyandon@yahoo.com
In reply to: A. Mous (#3)
Re: pg_dump "what if?"

You could spawn pg_dump via CreateProcess and call
WaitForSingleObject() on the handle that CreateProcess
returns in a worker thread. When the Wait() function
returns, you can then call GetExitCodeProcess() on the
same handle to get the process exit code.

Just a thought.

Regards,

Shelby Cain

--- Anony Mous <A.Mous@shaw.ca> wrote:

Thanks, but I'm calling a win32 compiled version of
pg_dump, which runs
asynchronously to the rest of my code (sorry I was
vague in my first
message). As such, I don't see how I can use the
return value. My only
other thought was to check for the existence of the
file, which would be
useless if the file represented an incomplete dump.

__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html

#5A. Mous
a.mous@shaw.ca
In reply to: Shelby Cain (#4)
Re: pg_dump "what if?"

That sounds like a great solution...thank you! My win API knowledge is
weak, but I'll give it a try. Thanks again.

-Pete

-----Original Message-----
From: Shelby Cain [mailto:alyandon@yahoo.com]
Sent: March 24, 2004 4:30 PM
To: Anony Mous; 'Dustin Sallings'
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] pg_dump "what if?"

You could spawn pg_dump via CreateProcess and call
WaitForSingleObject() on the handle that CreateProcess
returns in a worker thread. When the Wait() function
returns, you can then call GetExitCodeProcess() on the
same handle to get the process exit code.

Just a thought.

Regards,

Shelby Cain

--- Anony Mous <A.Mous@shaw.ca> wrote:

Thanks, but I'm calling a win32 compiled version of
pg_dump, which runs
asynchronously to the rest of my code (sorry I was
vague in my first
message). As such, I don't see how I can use the
return value. My only
other thought was to check for the existence of the
file, which would be
useless if the file represented an incomplete dump.

__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html

#6Jan Wieck
JanWieck@Yahoo.com
In reply to: A. Mous (#3)
Re: pg_dump "what if?"

Anony Mous wrote:

Thanks, but I'm calling a win32 compiled version of pg_dump, which runs
asynchronously to the rest of my code (sorry I was vague in my first

Meaning the whole "compiling pg_dump as win32 app" move wasn't such a
bright idea. Back to square one with that.

The exit code?

That is the correct way.

Jan

--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck@Yahoo.com #

#7A. Mous
a.mous@shaw.ca
In reply to: Shelby Cain (#4)
Re: pg_dump "what if?"

Thanks again. I've got it working using the API calls described.

pg_dump does return an exit code of 0 upon success. Does anyone know off
hand what is returned when the process fails?

-Pete

-----Original Message-----
From: Shelby Cain [mailto:alyandon@yahoo.com]
Sent: March 24, 2004 4:30 PM
To: Anony Mous; 'Dustin Sallings'
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] pg_dump "what if?"

You could spawn pg_dump via CreateProcess and call
WaitForSingleObject() on the handle that CreateProcess
returns in a worker thread. When the Wait() function
returns, you can then call GetExitCodeProcess() on the
same handle to get the process exit code.

Just a thought.

Regards,

Shelby Cain

--- Anony Mous <A.Mous@shaw.ca> wrote:

Thanks, but I'm calling a win32 compiled version of
pg_dump, which runs
asynchronously to the rest of my code (sorry I was
vague in my first
message). As such, I don't see how I can use the
return value. My only
other thought was to check for the existence of the
file, which would be
useless if the file represented an incomplete dump.

__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html

#8Dustin Sallings
dustin@spy.net
In reply to: A. Mous (#7)
Re: pg_dump "what if?"

On Mar 26, 2004, at 6:28, Anony Mous wrote:

Thanks again. I've got it working using the API calls described.

pg_dump does return an exit code of 0 upon success. Does anyone know
off
hand what is returned when the process fails?

Not 0. You're looking for success, right?

--
Dustin Sallings

#9Shelby Cain
alyandon@yahoo.com
In reply to: A. Mous (#7)
Re: pg_dump "what if?"

Glad I could help. As Dustin pointed out, pg_dump
will return a non-zero value to indicate an error.

Regards,

Shelby Cain

--- Anony Mous <A.Mous@shaw.ca> wrote:

Thanks again. I've got it working using the API
calls described.

pg_dump does return an exit code of 0 upon success.
Does anyone know off
hand what is returned when the process fails?

-Pete

__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html