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 1ltRK4-0004Ff-3V for pgsql-general@arkaria.postgresql.org; Wed, 16 Jun 2021 08:54:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ltRK2-0005cm-TI for pgsql-general@arkaria.postgresql.org; Wed, 16 Jun 2021 08:54:54 +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 1ltRK2-0005cd-Hj for pgsql-general@lists.postgresql.org; Wed, 16 Jun 2021 08:54:54 +0000 Received: from mail-cbf-ext.charite.de ([193.175.73.208]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ltRK0-0004DT-IC for pgsql-general@lists.postgresql.org; Wed, 16 Jun 2021 08:54:54 +0000 Received: from exchange.charite.de (s-mx14-ht02.charite.de [10.32.37.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mail-cbf.charite.de (Postfix) with ESMTPS id 4G4fBx5YYhz20lN9; Wed, 16 Jun 2021 10:54:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bih-charite.de; s=jan2021; t=1623833689; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=JdKeFtG/sP4uTePwomp0sYcDj9LfvGkmPm8mZhB9Z6M=; b=qoNR3PPi68MjY6I3f5etwTcH60zF2BMYLVF00AjgNygEFaHOQBD6yJ6zXrwkbI0YrW5Bgx Guqq30DngA1tTxLy4ltPnPzYu0DFUOxOrzHVBrekDlf/KdJthrI0XNVJfoRIcORxRCADzO m7fiVI+qwUDv6rjELENk42v0Dun/0ksF6M6969hiQeOnCfJ1QlifmEX+r9gRpDhdpVaZpq voLrRpo6SrIPrDv8reDVw475KgpJ89Qo4SPui/14j7cAdfc1kyOTR7oXt/e+vfUEZip4dT 3crz9mrXUbzJjqTKrx4S8l6YbmwzUxiClXwhnkQ/lkOVUq5+6P4t4/6GSr74yw== Received: from s-mx16-bih02.charite.de (10.32.83.24) by s-mx14-ht02.charite.de (10.32.37.106) with Microsoft SMTP Server (TLS) id 14.3.487.0; Wed, 16 Jun 2021 10:54:49 +0200 Received: from s-mx16-bih01.charite.de (10.32.83.23) by s-mx16-bih02.charite.de (10.32.83.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Wed, 16 Jun 2021 10:54:49 +0200 Received: from s-mx16-bih01.charite.de ([fe80::a4ac:ef94:4cc6:8783]) by s-mx16-bih01.charite.de ([fe80::a4ac:ef94:4cc6:8783%9]) with mapi id 15.01.2242.008; Wed, 16 Jun 2021 10:54:49 +0200 From: "Holtgrewe, Manuel" To: Tom Lane CC: "pgsql-general@lists.postgresql.org" Subject: Re: [ext] Re: Losing data because of problematic configuration? Thread-Topic: [ext] Re: Losing data because of problematic configuration? Thread-Index: AQHXYdLD/rK5fCc4M0OgzI3xWiaLdasU8pCAgABGbv6AAR0vxw== Date: Wed, 16 Jun 2021 08:54:49 +0000 Message-ID: <979b9abe88e24ab989a199a312348779@bih-charite.de> References: ,<354782.1623764371@sss.pgh.pa.us>, In-Reply-To: Accept-Language: en-US, de-DE Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.32.83.241] Content-Type: multipart/alternative; boundary="_000_979b9abe88e24ab989a199a312348779bihcharitede_" MIME-Version: 1.0 ARC-Seal: i=1; s=jan2021; d=bih-charite.de; t=1623833689; a=rsa-sha256; cv=none; b=wSSBWRM4AEUcJT00I5Tb+x7pCUEc1F7mC5kAlA3/K6TdvI/VURI5NzEV8/JNmN+Pp22AHo h1Nhws3UeL7abN0omUK0tngZNoMvMRHnKMNrl1PKUpizoa1EvZUlBxI0pGPfULbstsudcD r6W+FkFPmRLR7b9C2HtocI4NFXdsVSisqL0FGE58jEIQ7TI/KMkYr2L00/2cySm0mv+Yqh kTpbXloVlYSX2fTMlVnXq9S6Kiz+hPOaBReiYsCCaGfGL5j54NXhPB2NS1q2os08jjcyeR usrcvxlmmlgHnVDF9lemU6H9n7hhRG0KMLT754s2tgggWG1eKEP9CUCfnUH8MQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=bih-charite.de; s=jan2021; t=1623833689; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=JdKeFtG/sP4uTePwomp0sYcDj9LfvGkmPm8mZhB9Z6M=; b=osyQ+nyWkypYMWCDE4qASGb3a3ZSd+SDSZHYqq/6fjCI8QDTKt39+M0RMMHo/0dEuQrIwg vSBUrnRkCqaExjmo1iKKmGDRwDSo3LdrclbrSzGPuzYG6Nz2Z4nTyCKkbXLkp8Ci0U4Ztr /8RkJVz9nSxShww1Y0ojvphA3VWU6nJTy0v4M72v6S9Q1hXyKnyYxwvNDB2xL3/hSxgxQf ZgGH09oKTXy8N/VwMz5xdBqHSrkIczhz87jxL/VLuyRoMZ66EUHXN2m9Crznep+S7O1EG2 zSD6AlZiL7dmBrNo7aUP06Z+ezrANwDJenJ3d7ZT1ZNsoRy91r2JUWL/VDmu5Q== ARC-Authentication-Results: i=1; mail-cbf.charite.de; none List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --_000_979b9abe88e24ab989a199a312348779bihcharitede_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi again, thank you for pinpointing the issue. I have now updated the table with "ALTER TABLE $table SET LOGGED" (actually= it's a partitioned table and I've altered both the main table and the part= itions). I wanted to double-check the result and what I found out using "select relp= ersistence, relname from pg_class" that, e.g., ${table_name}_383_pkey still= has its relpersistence set to "u" whereas ${table_name}_383 has its relper= sistence set to "p" now. Does anyone have an idea what I'm doing wrong here? Thank you! Manuel ________________________________ From: Holtgrewe, Manuel Sent: Tuesday, June 15, 2021 5:53:54 PM To: Tom Lane Cc: pgsql-general@lists.postgresql.org Subject: Re: [ext] Re: Losing data because of problematic configuration? >> < 2021-06-15 12:33:04.537 CEST > DEBUG: resetting unlogged relations: c= leanup 1 init 0 > > Are you perhaps keeping your data in an UNLOGGED table? If so, resetting > it to empty after a crash is exactly what's supposed to happen. The > entire point of UNLOGGED is that the performance benefits come at the > cost of losing the data on crash. D'oh! Yes, that is the case. I once used this but I was convinced that I took thi= s back in some version. It is not in my main deployment, though. Now I have= to find out (a) why I have diverging deployment and (b) how that bug came = about to be. Thanks a lot! ________________________________ From: Tom Lane Sent: Tuesday, June 15, 2021 3:39:31 PM To: Holtgrewe, Manuel Cc: pgsql-general@lists.postgresql.org Subject: [ext] Re: Losing data because of problematic configuration? "Holtgrewe, Manuel" writes: > So it looks as if the database jumps back "half an hour" to ensure consis= tent data. Everything in between is lost. Postgres does not lose committed data --- if it did, we'd consider that a fairly serious bug. (Well, there are caveats of course. But most of them have to do with operating-system crashes or power loss, neither of which are at stake here.) I am wondering about this though: > < 2021-06-15 12:33:04.537 CEST > DEBUG: resetting unlogged relations: cl= eanup 1 init 0 Are you perhaps keeping your data in an UNLOGGED table? If so, resetting it to empty after a crash is exactly what's supposed to happen. The entire point of UNLOGGED is that the performance benefits come at the cost of losing the data on crash. regards, tom lane --_000_979b9abe88e24ab989a199a312348779bihcharitede_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi again,


thank you for pinpointing the issue.


I have now updated the table with "ALTER TABLE $table SET LOGGED&qu= ot; (actually it's a partitioned table and I've altered both the main table= and the partitions).


I wanted to double-check the result and what I found out using "select relpersistence, relname from pg_class" that, e.g., ${= table_name}_383_pkey still has its relpersistence set to "= ;u" whereas ${table_name}_383 has its relpersistence set to "p" now.


Does anyone have an idea what I'm doing wrong here?


Thank you!


Manuel


From: Holtgrewe, Manuel <= ;manuel.holtgrewe@bih-charite.de>
Sent: Tuesday, June 15, 2021 5:53:54 PM
To: Tom Lane
Cc: pgsql-general@lists.postgresql.org
Subject: Re: [ext] Re: Losing data because of problematic configurat= ion?
 

>> < 2021-06-15= 12:33:04.537 CEST > DEBUG:  resetting unlogged relations: cleanup = 1 init 0
>
> Are you = perhaps keeping your data in an UNLOGGED table?  If so, resetting
> it to em= pty after a crash is exactly what's supposed to happen.  The
> entire p= oint of UNLOGGED is that the performance benefits come at the
> cost of = losing the data on crash.


D'oh!


Yes, that is the case. I once used this but I was convinced that I took = this back in some version. It is not in my main deployment, though. Now I h= ave to find out (a) why I have diverging deployment and (b) how that bug ca= me about to be.


Thanks a lot!



From: Tom Lane <tgl@ss= s.pgh.pa.us>
Sent: Tuesday, June 15, 2021 3:39:31 PM
To: Holtgrewe, Manuel
Cc: pgsql-general@lists.postgresql.org
Subject: [ext] Re: Losing data because of problematic configuration?=
 
"Holtgrewe, Manuel" <manuel.holtgrewe= @bih-charite.de> writes:
> So it looks as if the database jumps back "half an hour" to = ensure consistent data. Everything in between is lost.

Postgres does not lose committed data --- if it did, we'd consider that a fairly serious bug.  (Well, there are caveats of course.  But mos= t of them
have to do with operating-system crashes or power loss, neither of which are at stake here.)

I am wondering about this though:

> < 2021-06-15 12:33:04.537 CEST > DEBUG:  resetting unlogged= relations: cleanup 1 init 0

Are you perhaps keeping your data in an UNLOGGED table?  If so, resett= ing
it to empty after a crash is exactly what's supposed to happen.  The entire point of UNLOGGED is that the performance benefits come at the
cost of losing the data on crash.

            &nb= sp;           regards, to= m lane


--_000_979b9abe88e24ab989a199a312348779bihcharitede_--