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 1lt6vP-00056P-WD for pgsql-general@arkaria.postgresql.org; Tue, 15 Jun 2021 11:08:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lt6vO-00089W-SE for pgsql-general@arkaria.postgresql.org; Tue, 15 Jun 2021 11:08:06 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lt6vO-00089O-FO for pgsql-general@lists.postgresql.org; Tue, 15 Jun 2021 11:08:06 +0000 Received: from mail-oi1-x230.google.com ([2607:f8b0:4864:20::230]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lt6vH-0002VJ-Us for pgsql-general@lists.postgresql.org; Tue, 15 Jun 2021 11:08:05 +0000 Received: by mail-oi1-x230.google.com with SMTP id s23so17788972oiw.9 for ; Tue, 15 Jun 2021 04:07:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=d7rJ0Xvnt5ZMaYQeltR3TOdGlVNGf9bzHcefvFaCDv8=; b=uc+NQApkTURCA6geyz7j8hHmywv2In2i5AuwaTwJja/QU4ANL41Zm7eDfXvhGBIXUd 54H5do1IOiFEG6aZ9Ii6BfwT16+ld6Ugg63Pv2e8VdUkddNd0ZuOBZJa0AXCEICoQc18 msyyJH095h79Y9CFH39ZiDcKT21G5N3CExcXEpw0Vp1SXq3CMv2EYeU4j0AH8goWaVrm 6Qi3bvew8/Zo6cMnbMRgPp0FjKwZ9knpv46iL/aeSO6S6FDaFeG2TJoQgwt4O1jeA0/H gLgbkf2odgzgRiS8p6mINPjbxvJCyg49BXPYkIPx42URhzxLcLdIwt/Cr3jb5yUM5Sia ghDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=d7rJ0Xvnt5ZMaYQeltR3TOdGlVNGf9bzHcefvFaCDv8=; b=b4iXhQVRoQKPqckg/P/4xNg+hY3D+BL2gymuB/j7pkrEufCYwpRe9EUBm6yat2RNwq GmBY9rOuJ42EDjjafI62uWJ+JdgXPAtLq379ZGt2rr0lT6ElPuZM+Owvl6ZaXwRqkwrQ eCtgKGtAmHU6lXS+xTOXH9GUXDDLXpVu69TjB5RIgT1wm6iPYhTCQyqFRP2pnyvVqQbH m+pC5wL8m3uKuenNZ9lSAQ3y+7YFDAwQLmrlnqa3q/6raF9zST2DXSThLi5RLbg94xFQ zSmIq0ZXCdS+/Om+Fp8x3+t5Xm1S7MifGtJeSLx6wmDft13dTuWmm8DyxoqR1A8P1ML4 0PVA== X-Gm-Message-State: AOAM530JSmLTnBKGAJcBiB2pIHqxM+a5GXrTlZTXE5rTfHBNO95zz3Uj 9JgIlHFCGzjzqPeAHHyCYJ98ONW/6SHdLg== X-Google-Smtp-Source: ABdhPJwlHN9zEqt37BVBvMHqDKsojhcFNnvo5ees6n/LMhIjsVTS+WglZCbt4wJ8F76rvPbip6gl7Q== X-Received: by 2002:aca:2318:: with SMTP id e24mr2878844oie.179.1623755278572; Tue, 15 Jun 2021 04:07:58 -0700 (PDT) Received: from [192.168.88.10] (ip174-67-141-204.no.no.cox.net. [174.67.141.204]) by smtp.googlemail.com with ESMTPSA id w20sm4017381otl.51.2021.06.15.04.07.57 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 15 Jun 2021 04:07:58 -0700 (PDT) Subject: Re: Losing data because of problematic configuration? To: pgsql-general@lists.postgresql.org References: From: Ron Message-ID: <328bf795-e499-4272-d1f7-e273ea0d4b9a@gmail.com> Date: Tue, 15 Jun 2021 06:07:57 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------115F27E84572AD0557E44636" Content-Language: en-US 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. --------------115F27E84572AD0557E44636 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 6/15/21 5:42 AM, Holtgrewe, Manuel wrote: > > Hi, > > > I have a database that is meant to have high-performance for bulk insert > operations. I've attached my postgres.conf file. > > > However, I'm seeing the following behaviour. At around 12:04, I have > started the database. Then, I did a bulk insert and that completed. > What kind of transaction did you use? Did you commit the transaction? > I then went on to kill postgres processes at 12:33 with SIGSEGV signal. > Why? Did you CHECKPOINT beforehand? (I'm hypothesizing that data didn't get flushed to disk, and so Pg "cleaned itself up" after the crash.) > I'm getting the following log excerpt: > > > *< 2021-06-15 12:33:03.656 CEST > LOG:  database system was interrupted; > last known up at 2021-06-15 12:04:13 CEST* > < 2021-06-15 12:33:03.656 CEST > DEBUG:  removing all temporary WAL segments > < 2021-06-15 12:33:04.525 CEST > DEBUG:  checkpoint record is at 60/7C377C78 > [snip] > < 2021-06-15 12:33:04.537 CEST > DEBUG:  resetting unlogged relations: > cleanup 1 init 0 > < 2021-06-15 12:33:04.553 CEST > DEBUG:  unlinked file "base/16384/107877" > [... snip ... ] > < 2021-06-15 12:33:27.556 CEST > DEBUG:  copying base/16384/80948_init to > base/16384/80948 > < 2021-06-15 12:33:36.705 CEST > DEBUG:  performing replication slot > checkpoint > < 2021-06-15 12:33:38.394 CEST > DEBUG:  attempting to remove WAL segments > older than log file 00000000000000600000007C > < 2021-06-15 12:33:38.394 CEST > DEBUG:  removing write-ahead log file > "00000001000000600000007C" > < 2021-06-15 12:33:38.403 CEST > DEBUG:  MultiXactId wrap limit is > 2147483648, limited by database with OID 1 > < 2021-06-15 12:33:38.419 CEST > DEBUG:  oldest MultiXactId member is at > offset 1 > < 2021-06-15 12:33:38.419 CEST > DEBUG:  MultiXact member stop limit is > now 4294914944 based on MultiXact 1 > < 2021-06-15 12:33:38.428 CEST > DEBUG:  shmem_exit(0): 1 > before_shmem_exit callbacks to make > < 2021-06-15 12:33:38.428 CEST > DEBUG:  shmem_exit(0): 5 on_shmem_exit > callbacks to make > > > So it looks as if the database jumps back "half an hour" to ensure > consistent data. Everything in between is lost. > > > What would be configuration settings to look into to make this more > stable? Is there a way to "force flush state to disk" from the > application/through postgres API/SQL? > > > Thank you, > > Manuel > > -- Angular momentum makes the world go 'round. --------------115F27E84572AD0557E44636 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit On 6/15/21 5:42 AM, Holtgrewe, Manuel wrote:

Hi,


I have a database that is meant to have high-performance for bulk insert operations. I've attached my postgres.conf file.


However, I'm seeing the following behaviour. At around 12:04, I have started the database. Then, I did a bulk insert and that completed.


What kind of transaction did you use?
Did you commit the transaction?

I then went on to kill postgres processes at 12:33 with SIGSEGV signal.


Why?

Did you CHECKPOINT beforehand?

(I'm hypothesizing that data didn't get flushed to disk, and so Pg "cleaned itself up" after the crash.)

I'm getting the following log excerpt:


< 2021-06-15 12:33:03.656 CEST > LOG:  database system was interrupted; last known up at 2021-06-15 12:04:13 CEST
< 2021-06-15 12:33:03.656 CEST > DEBUG:  removing all temporary WAL segments
< 2021-06-15 12:33:04.525 CEST > DEBUG:  checkpoint record is at 60/7C377C78
[snip]
< 2021-06-15 12:33:04.537 CEST > DEBUG:  resetting unlogged relations: cleanup 1 init 0
< 2021-06-15 12:33:04.553 CEST > DEBUG:  unlinked file "base/16384/107877"
[... snip ... ]
< 2021-06-15 12:33:27.556 CEST > DEBUG:  copying base/16384/80948_init to base/16384/80948
< 2021-06-15 12:33:36.705 CEST > DEBUG:  performing replication slot checkpoint
< 2021-06-15 12:33:38.394 CEST > DEBUG:  attempting to remove WAL segments older than log file 00000000000000600000007C
< 2021-06-15 12:33:38.394 CEST > DEBUG:  removing write-ahead log file "00000001000000600000007C"
< 2021-06-15 12:33:38.403 CEST > DEBUG:  MultiXactId wrap limit is 2147483648, limited by database with OID 1
< 2021-06-15 12:33:38.419 CEST > DEBUG:  oldest MultiXactId member is at offset 1
< 2021-06-15 12:33:38.419 CEST > DEBUG:  MultiXact member stop limit is now 4294914944 based on MultiXact 1
< 2021-06-15 12:33:38.428 CEST > DEBUG:  shmem_exit(0): 1 before_shmem_exit callbacks to make
< 2021-06-15 12:33:38.428 CEST > DEBUG:  shmem_exit(0): 5 on_shmem_exit callbacks to make


So it looks as if the database jumps back "half an hour" to ensure consistent data. Everything in between is lost.


What would be configuration settings to look into to make this more stable? Is there a way to "force flush state to disk" from the application/through postgres API/SQL?


Thank you,

Manuel



--
Angular momentum makes the world go 'round.
--------------115F27E84572AD0557E44636--