Thread: pg_dump "what if?"

pg_dump "what if?"

From
Anony Mous
Date:

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

 

 

Re: pg_dump "what if?"

From
Dustin Sallings
Date:

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


<excerpt><fixed><fontfamily><param>Courier New</param><x-tad-bigger>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?

</x-tad-bigger></fontfamily></fixed></excerpt>

    The exit code?


--

Dustin Sallings


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

Re: pg_dump "what if?"

From
Anony Mous
Date:

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

Re: pg_dump "what if?"

From
Shelby Cain
Date:
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

Re: pg_dump "what if?"

From
Anony Mous
Date:
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


Re: pg_dump "what if?"

From
Jan Wieck
Date:
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 #


Re: pg_dump "what if?"

From
Anony Mous
Date:
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


Re: pg_dump "what if?"

From
Shelby Cain
Date:
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

Re: pg_dump "what if?"

From
Dustin Sallings
Date:
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