Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ikrCx-0004i5-El for pgsql-bugs@arkaria.postgresql.org; Fri, 27 Dec 2019 15:07:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ikrCv-0001Op-V6 for pgsql-bugs@arkaria.postgresql.org; Fri, 27 Dec 2019 15:07:17 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ikrCv-0001Oi-8u for pgsql-bugs@lists.postgresql.org; Fri, 27 Dec 2019 15:07:17 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ikrCr-0003PD-J7 for pgsql-bugs@lists.postgresql.org; Fri, 27 Dec 2019 15:07:15 +0000 Received: by mail-pg1-x542.google.com with SMTP id x8so14566448pgk.8 for ; Fri, 27 Dec 2019 07:07:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=dVjatgMZR7Nd9V/DxrWemhqQQmEM+gy3zjDYxmO2/lg=; b=Pw6c8yMRuWwsruXDs3OuRAUetHfq53PZfpVt0YfRD26e0m/49a+kXoIrLbEtOhLx1Q Vv05Q8mG0LeuWv4yTKso0+DfIpsShb6LpyMvT6NgOpu8BoC0aGHuRPqiM1MWrU+TPZZJ LvA5L80RS58Zu4mz9/hr/XJJxq1tTSbZKU54Sw3QAJ7IlJN4g1mV8uo9MEeszj44sTF9 pDg2AzWyqIQ1M91xAmmp44lypg5qhqsFOMV4gk9HyvtPI0QCUkJrHcX7RQrZxFyL0+97 AsY7YSQxldbsF83Ih2QV8xIfcNKZEPa3HU0HN7/+s7cISxkJpAvBUysSOKrE8RQIW798 ZK5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=dVjatgMZR7Nd9V/DxrWemhqQQmEM+gy3zjDYxmO2/lg=; b=HGuazT9xY1SocNAHNEYBJqL2tl7ke3fL4wmwZ5UikZaHNZFxGWCaFsDPoGHnXmI5NG Ykjg29skthfCm8C0g2+oiMKWsyYw+p3KmOMouD+8VXSwALSY0MvkkjbJcRl75rIhFjd4 kRBNedkG2MSfdpr1f11kGP78PTCErx4cyK2PpvPCvIrVZ68QNy6a47UWmFb8HnlSy4YZ wck9YehOU5b8JOUG1skBJ7cg5RielYDel2TXr7QfJ8N4F2e0xXGTmfQ59ojHdkwN27GR V81aciS7YCQT5trYqawKBWKDqvUVgv4fhIXJE5xkREwwkaELAkjCXScM3lvdNoEjg0hs V6Kg== X-Gm-Message-State: APjAAAX3Uh6U4q975Zr/3msG7HeNkuu4t9Ho7BVis+YCFcIaBW+6vDsL S06sA3w6aN/VonesSBvLSkl4uw== X-Google-Smtp-Source: APXvYqwkPbVgCkePzM52SjQ3vGB9YVoTNcHO1+UqcgTcXsD+6kVun93VeYfy0OJozXOjsS+B8TngWw== X-Received: by 2002:a65:420d:: with SMTP id c13mr56312796pgq.101.1577459231454; Fri, 27 Dec 2019 07:07:11 -0800 (PST) Received: from nimloth.alvh.no-ip.org ([190.217.181.51]) by smtp.gmail.com with ESMTPSA id t63sm41399101pfb.70.2019.12.27.07.07.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Dec 2019 07:07:10 -0800 (PST) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id 55A3A3008C1; Fri, 27 Dec 2019 12:07:06 -0300 (-03) Date: Fri, 27 Dec 2019 12:07:06 -0300 From: Alvaro Herrera To: vignesh C Cc: Amit Kapila , Andres Freund , Tomas Vondra , Dilip Kumar , PostgreSQL mailing lists , PostgreSQL Hackers Subject: Re: Reorderbuffer crash during recovery Message-ID: <20191227150706.GA24311@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2019-Dec-27, vignesh C wrote: > I felt amit solution also solves the problem. Attached patch has the > fix based on the solution proposed. > Thoughts? This seems a sensible fix to me, though I didn't try to reproduce the failure. > @@ -2472,6 +2457,7 @@ ReorderBufferSerializeTXN(ReorderBuffer *rb, ReorderBufferTXN *txn) > } > > ReorderBufferSerializeChange(rb, txn, fd, change); > + txn->final_lsn = change->lsn; > dlist_delete(&change->node); > ReorderBufferReturnChange(rb, change); Should this be done insider ReorderBufferSerializeChange itself, instead of in its caller? Also, would it be sane to verify that the TXN doesn't already have a newer final_lsn? Maybe as an Assert. > @@ -188,8 +188,7 @@ typedef struct ReorderBufferTXN > * * plain abort record > * * prepared transaction abort > * * error during decoding > - * * for a crashed transaction, the LSN of the last change, regardless of > - * what it was. > + * * last serialized lsn > * ---- I propose "for a transaction with serialized changes, the LSN of the latest serialized one, unless one of the above cases." -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services