Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ptTo8-0000VJ-7T for pgsql-admin@arkaria.postgresql.org; Mon, 01 May 2023 13:43:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ptTo7-0003nc-2o for pgsql-admin@arkaria.postgresql.org; Mon, 01 May 2023 13:43:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ptTo6-0003km-M0 for pgsql-admin@lists.postgresql.org; Mon, 01 May 2023 13:43:10 +0000 Received: from mail-yb1-xb31.google.com ([2607:f8b0:4864:20::b31]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1ptTo4-006AKh-0L for pgsql-admin@lists.postgresql.org; Mon, 01 May 2023 13:43:10 +0000 Received: by mail-yb1-xb31.google.com with SMTP id 3f1490d57ef6-b9d87dffadfso1946835276.3 for ; Mon, 01 May 2023 06:43:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682948586; x=1685540586; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=Aqkj7PzdWgRCVrcAjuwN6NwQMIjN4GQMpLM6O1UrIGg=; b=AMOsepp63I9CgRa4vlUO7o3S1lQOL26ZvqFcXeqFMmHaALajgs72v8TTi541amJc07 yyIcYm5V4TLcb3z8XAWx+U6AkwjStGlBSQQIxa+IBfQQ+3xX0NZId7xZFD2LpEZUmp2J XEWudRUWDKdotvVAzWknCPUAO9y0nUrV/EysJ8tPCTBDQGECEFp4SfE37zKPmgTDvyKK 7Gb9xpJti2ZtNeUeAnLLj57OVWNeL5q6+IPVoHa3zYF+5Pb1R84iu8UmKZmG2Hn8C+B4 uXrpMLMHy13ofrngtuBSRX5iRVRtePpjt0VAAWAfPslnciXV0FuVTDSpg3Eq8VFZ/n7h asEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682948586; x=1685540586; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=Aqkj7PzdWgRCVrcAjuwN6NwQMIjN4GQMpLM6O1UrIGg=; b=cV3c6C+9MaAkSVWwcJJpflmPeDaySW4vPTeVFzkBFWsAuyFepD3PcUyUcpJ3wsB/jX scLlNxT8b5n4iKxnbqBy43Ug/eYakryapBTmmPU6RjgiWjwhWlDtwKI5GHLR4UM9Nwf0 WpnhNYwYthzjo0eCL6ewQIN5L9teLh5g4oTvmkhzO4owWVr0R7dN4n3sU9iMhN+wH1/A IG5+Wz8xMRJq3i39DibpwcbNy0IEXFeR0ng9sYMFYlGFH7y4iOhj5MP1kgT6C9C2d8W3 Qyfmj10QEHYGm11RlOhxf1pYspcp16gaFuu9vztfIsQJvjXkqMklBFkp0k/LJ1fwSswx ShRQ== X-Gm-Message-State: AC+VfDy92n19Dh7OWSISQgf930zHyBqIRVn2aZbckrFQ6O9C32+WKgHd x47eQyI3yx2wRtaP6duKY4TN3VpTf3A= X-Google-Smtp-Source: ACHHUZ6s8w782Nn5pmNaa8lWkfZuVUFa7D3C2RkGrH7SjgXKMr1U3VHtV/VJKXDoBoabVwms/NfDKQ== X-Received: by 2002:a25:89:0:b0:b9a:41ea:e8da with SMTP id 131-20020a250089000000b00b9a41eae8damr12183052yba.3.1682948585940; Mon, 01 May 2023 06:43:05 -0700 (PDT) Received: from ?IPV6:2600:1700:bd2c:b810:edd6:19bb:e3ec:a4c2? ([2600:1700:bd2c:b810:edd6:19bb:e3ec:a4c2]) by smtp.googlemail.com with ESMTPSA id r14-20020a5b06ce000000b00b7767ca7496sm6717826ybq.51.2023.05.01.06.43.05 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 01 May 2023 06:43:05 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------5X0ELJ04laURi39Ib0iK0e7Z" Message-ID: Date: Mon, 1 May 2023 08:43:05 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: pg_dump why no indicator of completion Content-Language: en-US To: pgsql-admin@lists.postgresql.org References: From: Ron In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------5X0ELJ04laURi39Ib0iK0e7Z Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 5/1/23 07:56, richard coleman wrote: > Ron, > So what you are saying is that I have to write a shell script around > pg_dump to catch the exit code of pg_dump since the developers of pg_dump > didn't have pg_dump simply write an exit message? > > Since multiple pg_dump commands are often run at the same command prompt, > and they can take hours, if not days to run, Running a days-long pg_dump at any time except special occasions isn't very wise.  Especially from a command prompt. Binary backup/restore programs are /much/ faster (if for no other reason than they let you do incremental and differential backups). > and there are a myriad of other commands the will be run in the interim, > any exit code generated by pg_dump with be lost in the flotsam and jetsam > of the multitude of exit codes created by every other command run between > the calling of pg_dump and it's eventual termination. It could have > completed successfully, crashed, been killed, etc. > > Or am I mistaken? > > thanks, > rik. > > On Sun, Apr 30, 2023 at 11:28 PM Ron wrote: > > On 4/30/23 19:18, richard coleman wrote: >> Hi all, >> >> I've been working with pg_dump and one thing that's always struck me >> as strange is that there never seems to be an indication in the log >> that the pg_dump process completed successfully. >> >> For example, I've been running a bunch of backups with pg_dump in >> directory mode with multiple jobs. When I come back several hours >> later there are no pg_dump processes running.  The log is filled with: >> >> dumping contents of foo >> finished item 123456 of TABLE DATA bar >> etc. >> >> >> Other than trying to restore the multi terabyte database somewhere >> else is there any way to know that it actually finished successfully? >> >> Why doesn't pg_dump add a line in the output like: >> >> pg_backup finished >> >> when it's completed successfully? >> >> This seems like a terrible oversight. >> >> Am I missing something obvious? > > "They" expect you to do the Unix Thing and check $?. Thus, that's what > I do; any non-zero value generates an email with a scary subject line, > the specifics of which are based on the exact code value. I'm not near > my work computer; otherwise I'd share them with you. > > -- > Born in Arizona, moved to Babylonia. > -- Born in Arizona, moved to Babylonia. --------------5X0ELJ04laURi39Ib0iK0e7Z Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

On 5/1/23 07:56, richard coleman wrote:
Ron, 
So what you are saying is that I have to write a shell script around pg_dump to catch the exit code of pg_dump since the developers of pg_dump didn't have pg_dump simply write an exit message?

Since multiple pg_dump commands are often run at the same command prompt, and they can take hours, if not days to run,

Running a days-long pg_dump at any time except special occasions isn't very wise.  Especially from a command prompt.

Binary backup/restore programs are much faster (if for no other reason than they let you do incremental and differential backups).

and there are a myriad of other commands the will be run in the interim, any exit code generated by pg_dump with be lost in the flotsam and jetsam of the multitude of exit codes created by every other command run between the calling of pg_dump and it's eventual termination. It could have completed successfully, crashed, been killed, etc.

Or am I mistaken?

thanks, 
rik. 

On Sun, Apr 30, 2023 at 11:28 PM Ron <ronljohnsonjr@gmail.com> wrote:
On 4/30/23 19:18, richard coleman wrote:
Hi all, 

I've been working with pg_dump and one thing that's always struck me as strange is that there never seems to be an indication in the log that the pg_dump process completed successfully.

For example, I've been running a bunch of backups with pg_dump in directory mode with multiple jobs.  When I come back several hours later there are no pg_dump processes running.  The log is filled with:
dumping contents of foo
finished item 123456 of TABLE DATA bar
etc.

Other than trying to restore the multi terabyte database somewhere else is there any way to know that it actually finished successfully?

Why doesn't pg_dump add a line in the output like:
pg_backup finished
when it's completed successfully? 

This seems like a terrible oversight.

Am I missing something obvious?

"They" expect you to do the Unix Thing and check $?. Thus, that's what I do; any non-zero value generates an email with a scary subject line, the specifics of which are based on the exact code value.  I'm not near my work computer; otherwise I'd share them with you.

--
Born in Arizona, moved to Babylonia.

--
Born in Arizona, moved to Babylonia.
--------------5X0ELJ04laURi39Ib0iK0e7Z--