Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fQhpo-0007Jn-4B for pgsql-bugs@arkaria.postgresql.org; Wed, 06 Jun 2018 23:27:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fQhpk-00011s-EJ for pgsql-bugs@arkaria.postgresql.org; Wed, 06 Jun 2018 23:27:16 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fQhpk-00011h-2h for pgsql-bugs@lists.postgresql.org; Wed, 06 Jun 2018 23:27:16 +0000 Received: from smtp-fw-4101.amazon.com ([72.21.198.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fQhph-0001KB-6J for pgsql-bugs@postgresql.org; Wed, 06 Jun 2018 23:27:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1528327633; x=1559863633; h=subject:to:references:from:message-id:date:mime-version: in-reply-to:content-transfer-encoding; bh=l5FPywuXDy86oLIX6qtldI/BVMdr0S4xWozibaqTWoE=; b=CQmhZOJUcmzURn9IGq836p8PufmdwtGutBxfOIc1+tfQe6qoIwWy4Pm1 64+a4SfbBseezijsZtZxzyDsnG0lx4eHW2qnwM5W30WjrAGig0oC4AjLt Ue8ns/3ifgCKpe5rKrh5lX/YAU3Wrjzi+uNXJKUj4uVygpF/+htmeaX2G A=; X-IronPort-AV: E=Sophos;i="5.49,485,1520899200"; d="scan'208";a="723103883" Received: from iad6-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-2c-6f38efd9.us-west-2.amazon.com) ([10.124.125.6]) by smtp-border-fw-out-4101.iad4.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 06 Jun 2018 23:27:11 +0000 Received: from EX13MTAUWA001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan2.pdx.amazon.com [10.236.137.194]) by email-inbound-relay-2c-6f38efd9.us-west-2.amazon.com (8.14.7/8.14.7) with ESMTP id w56NR9ER111379 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL) for ; Wed, 6 Jun 2018 23:27:10 GMT Received: from EX13D18UWA002.ant.amazon.com (10.43.160.199) by EX13MTAUWA001.ant.amazon.com (10.43.160.118) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 6 Jun 2018 23:27:10 +0000 Received: from 186590ce269b.ant.amazon.com (10.43.160.8) by EX13D18UWA002.ant.amazon.com (10.43.160.199) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 6 Jun 2018 23:27:09 +0000 Subject: Re: BUG #14820: Standby crash with "could not access status of transaction" (for track_commit_timestamp) To: References: <20170920092609.17363.35370@wrigleys.postgresql.org> <4744cb5b-8962-8f10-f729-7cfeba807fcb@amazon.com> From: Jeremy Schneider Message-ID: Date: Wed, 6 Jun 2018 16:27:08 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <4744cb5b-8962-8f10-f729-7cfeba807fcb@amazon.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.43.160.8] X-ClientProxiedBy: EX13D01UWA002.ant.amazon.com (10.43.160.74) To EX13D18UWA002.ant.amazon.com (10.43.160.199) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 5/23/18 14:20, Jeremy Schneider wrote: > On 9/20/17 02:26, matioli.matheus@gmail.com wrote: >> I have checked and the file `pg_commit_ts/E7FB` is on the data directory >> with 229376, so looks like it is trying to read the file past its end, hence >> the above error. > > I recently saw a problem that looked very similar to this, seems worth > reporting on the same thread. > > PostgreSQL version: 10.3 > Operating system: Linux > > On startup, while attempting recovery, PostgreSQL failed to startup with > the following error: > > FATAL: could not access status of transaction 68544569 > DETAIL: Could not read from file "pg_commit_ts/0A37" at offset 106496: > Success. > CONTEXT: WAL redo at 70E/E5FE2030 for Transaction/COMMIT: 2018-xx-xx > xx:xx:xx.xxxxxx-xx; subxacts: 68544570 > LOG: startup process (PID 100292) exited with exit code 1 > LOG: aborting startup due to startup process failure > LOG: database system is shut down > > This is on a primary, not a standby.  track_commit_timestamp is on, > wal_level is replica and there are no shared_preload_libraries. > > The pg_commit_ts directory was actually empty when recovery started and > in the process of recovery PostgreSQL recreated the 0A37 file.  However > it consistently created a 106496 byte file (entirely filled with > 0/nulls) and then threw the error above when trying to read beyond the > end.  If we removed the 0A37 file and restarted then it would again > recreate the 106496 byte file and error out in the same way. > > Here's the WAL it was trying to apply at failure, with preceding and > following entries: > > rmgr: Heap        len (rec/tot):     71/    71, tx:   68544569, lsn: > 70E/E5FE1FD0, prev 70E/E5FE1F98, desc: HOT_UPDATE off 2 xmax 68544569 ; > new off 10 xmax 0, blkref #0: rel 1663/3850018/16485 blk 295474 > rmgr: Transaction len (rec/tot):     46/    46, tx:   68544569, lsn: > 70E/E5FE2030, prev 70E/E5FE1FD0, desc: COMMIT 2018-xx-xx xx:xx:xx.xxxxxx > UTC; subxacts: 68544570 > rmgr: Heap        len (rec/tot):     54/    54, tx:   68539960, lsn: > 70E/E5FE2060, prev 70E/E5FE2030, desc: LOCK off 12: xid 68539960: flags > 0 LOCK_ONLY EXCL_LOCK , blkref #0: rel 1663/11038913/16866 blk 6135 > > Unfortunately the WAL files from the time of the issue are no longer > available, so I'm unable to go back and do any additional analysis of > the original crash.  (Like looking more at those transactions.)  But I > wanted to at least get a record over here of what happened. I was able to get a little more information about this. We can see that: * a vacuum was running on TABLE1 at the time of the problem * there were many transactions containing sub-transactions (inserting into TABLE1) at the time of the problem *** vacuum activity was seen on TABLE1 concurrently for quite some time before the problem * nearly all DB activity including a stream of inserts into TABLE2 stopped abruptly at TIME1 * at TIME1 there were 9 xacts in flight. 3 of these aborted around this time. * after TIME1, one new transaction started, inserting into TABLE3 (with subxact in TABLE1). that xact committed at 06:04:04.015169 UTC. * the vacuum on TABLE1 continue just past the new transaction commit. it was the last observed activity in the DB before crash. * underlying I/O system looks healthy during this entire period. Not enough information to get a root cause, but I wanted to record it in case someone hits something similar in the future. -Jeremy -- Jeremy Schneider Database Engineer Amazon Web Services