Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d2mfn-0001ud-ON for pgsql-hackers@arkaria.postgresql.org; Mon, 24 Apr 2017 22:41:35 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1d2mfm-00039H-Oe for pgsql-hackers@arkaria.postgresql.org; Mon, 24 Apr 2017 22:41:34 +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.84_2) (envelope-from ) id 1d2mfj-00036q-Gs for pgsql-hackers@postgresql.org; Mon, 24 Apr 2017 22:41:31 +0000 Received: from mail-qk0-x243.google.com ([2607:f8b0:400d:c09::243]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1d2mfg-0000F0-Hv for pgsql-hackers@postgresql.org; Mon, 24 Apr 2017 22:41:29 +0000 Received: by mail-qk0-x243.google.com with SMTP id y63so14059865qkd.3 for ; Mon, 24 Apr 2017 15:41:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=naoZn0p88iAlpBmQX7adXtsdwU9VS3ddU5M33rUBs0k=; b=gA77TyDyR0jTIH0KYSh7KJJHwiPtxjMtUKw0Y/flwZBoaKupTlkNh28ZTqMKkM1553 vNNUBpIULROJGTm5tC9osD6ebjj2EVJMra8eXcKKhyGA15IiIg72vkaz52pMeIRf9/lA zmBoFPrscdtWT1lLnMXDObIOfzp1ilLorJieSMvuQg/sZShOj5w5PJz09uOYlsSbXprZ 6MpfORUUJgoXj/S82GqpD7XaEuMDOEWIipbcPdBrDiFZYZyYwCdBoJ9xRGKK87KcjS3r zyTbG4VZJ1G0pftIx9zfwOxEZy2uZ1zm75Z9Hq+toSk8og8QTUbTzMK3NB1kkpCpFboL 2Xsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=naoZn0p88iAlpBmQX7adXtsdwU9VS3ddU5M33rUBs0k=; b=g5Lyvobb8Wnm2RtstKYbhcmcgCT7SM0ZA0iHCloRoC7R6Iz4zUjAJg4NcHGIDRI6Ck GjBA+4hpOhFxoKLEdh5Ev0UnlXf4/XyoizUWvMk3WJX+Oxa6BqlqH/CzyKgyUG0WjufO aXLLvxC7UeaoCtc5R4ILEv8BkihYoC76gY5juD4q++eMIM0yQTAU1Ghbsv09L10zqYsI BweYNJ6PoMKSLnKNQ8LupnYnRJtFGYPMBveADpWl+hiU7Gv0CBtfUDq/kWL+A5P8a9CR Toa8OA53cKb3xphvum6K+vnvPKb07PQ90096n9CGUzeu3N72xyYp2b88jE3HhdlJ33oR p8ig== X-Gm-Message-State: AN3rC/75C1QU2dif9tMXm8fmFzTg8DPHrWozAxso+Ww63Y/Qpyqps4cg BsWO+n195kRSRA== X-Received: by 10.55.121.2 with SMTP id u2mr27125405qkc.315.1493073687536; Mon, 24 Apr 2017 15:41:27 -0700 (PDT) Received: from [192.168.2.121] (24-113-198-113.wavecable.com. [24.113.198.113]) by smtp.gmail.com with ESMTPSA id j1sm13846989qkf.57.2017.04.24.15.41.26 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Apr 2017 15:41:27 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: [COMMITTERS] pgsql: Replication lag tracking for walsenders From: Mark Dilger In-Reply-To: <10700.1493002395@sss.pgh.pa.us> Date: Mon, 24 Apr 2017 15:41:25 -0700 Cc: Thomas Munro , Alvaro Herrera , Pg Hackers , Tom Lane Content-Transfer-Encoding: quoted-printable Message-Id: <4DBA9267-A668-4DC9-8908-7183ABBA3081@gmail.com> References: <20170421190629.3srqyohjocgdvhhr@alvherre.pgsql> <27895.1492808648@sss.pgh.pa.us> <4219.1492875661@sss.pgh.pa.us> <300.1492927294@sss.pgh.pa.us> <10700.1493002395@sss.pgh.pa.us> To: Simon Riggs X-Mailer: Apple Mail (2.3124) X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org > On Apr 23, 2017, at 7:53 PM, Tom Lane wrote: >=20 > Thomas Munro writes: >> On Sun, Apr 23, 2017 at 6:01 PM, Tom Lane wrote: >>> Fair enough. But I'd still like an explanation of why only about >>> half of the population is showing a failure here. Seems like every >>> machine should be seeing the LSN as moving backwards in this test. >>> So (a) why aren't they all failing, and (b) should we change the >>> test to make sure every platform sees that happening? >=20 >> Every machine sees the LSN moving backwards, but the code path that >> had the assertion only reached if it decides to interpolate, which is >> timing dependent: there needs to be a future sample in the lag >> tracking buffer, which I guess is not the case in those runs. >=20 > I'm dissatisfied with this explanation because if it's just timing, > it doesn't seem very likely that some machines would reproduce the > failure every single time while others never would. Maybe that can be > blamed on kernel scheduler vagaries + different numbers of cores, but > I can't escape the feeling that there's something here we've not > fully understood. >=20 > While chasing after this earlier today, I turned on some debug logging > and noted that the standby's reports look like >=20 > 2017-04-23 15:46:46.206 EDT [34829] LOG: database system is ready to acc= ept read only connections > 2017-04-23 15:46:46.212 EDT [34834] LOG: fetching timeline history file = for timeline 2 from primary server > 2017-04-23 15:46:46.212 EDT [34834] LOG: started streaming WAL from prim= ary at 0/3000000 on timeline 1 > 2017-04-23 15:46:46.213 EDT [34834] LOG: sending write 0/3020000 flush 0= /3028470 apply 0/3028470 > 2017-04-23 15:46:46.214 EDT [34834] LOG: replication terminated by prima= ry server > 2017-04-23 15:46:46.214 EDT [34834] DETAIL: End of WAL reached on timeli= ne 1 at 0/3028470. > 2017-04-23 15:46:46.214 EDT [34834] LOG: sending write 0/3028470 flush 0= /3028470 apply 0/3028470 > 2017-04-23 15:46:46.214 EDT [34830] LOG: new target timeline is 2 > 2017-04-23 15:46:46.214 EDT [34834] LOG: restarted WAL streaming at 0/30= 00000 on timeline 2 > 2017-04-23 15:46:46.228 EDT [34834] LOG: sending write 0/3020000 flush 0= /3028470 apply 0/3028470 >=20 > So you're right that the standby's reported "write" position can go > backward, but it seems pretty darn odd that the flush and apply > positions didn't go backward too. Is there a bug there? >=20 > I remain of the opinion that if we can't tell from the transmitted > data whether a timeline switch has caused the position to go backward, > then that's a protocol shortcoming that ought to be fixed. The recent fix in 546c13e11b29a5408b9d6a6e3cca301380b47f7f has local variab= le overwriteOK assigned but not used in twophase.c RecoverPreparedTransactions(void). I'm= not sure if that's future-proofing or an oversight. It seems to be used in other functions. = Just FYI. Mark Dilger --=20 Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers