Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cbA4q-0007LC-H6 for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Feb 2017 18:01:16 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cbA4p-00068W-Uf for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Feb 2017 18:01:15 +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 1cbA4p-00068O-Af for pgsql-hackers@postgresql.org; Tue, 07 Feb 2017 18:01:15 +0000 Received: from mail-ot0-x231.google.com ([2607:f8b0:4003:c0f::231]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1cbA4m-0007yi-4R for pgsql-hackers@postgresql.org; Tue, 07 Feb 2017 18:01:14 +0000 Received: by mail-ot0-x231.google.com with SMTP id 65so92177154otq.2 for ; Tue, 07 Feb 2017 10:01:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=oodbDVyYSgG5rooHC3xOrKAfKVpTpN3bepQDOYa1Cl8=; b=I7Htgt/M4MjmpNGgjfI7k1G8gzDOuEDStVSHN8YwzPd4K1WYyie4XaGF7X24uXBwXB 5wAEdB118P1pU04EZXjQJgM1B0BhBmua2ErACQYrfuCrqTbncFsm3zxYEkaGHbtbWdO+ oD7zqRzFoZ3tr5O+kpkO/4vBrjEbq16repWrv97rWQMCFTPndYZkl8wCZVkwy2SKsOmT zxuQ0+JCRrKIei0UhZcoE56tcFAvL6finSz+RtUYg3wtntz/Sf150cw/GvNl+SARKtmz pVw5r2Lk9we/G0kzLWcKWBLEMnLuTrqp9DkldpjUkqa8PJlW/carUjnFhd/I8NviwQeC jGRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=oodbDVyYSgG5rooHC3xOrKAfKVpTpN3bepQDOYa1Cl8=; b=q49ULjrIpT/8xXHab6ol3SzeJoaZ8YQ+EYNZU8d04pJTFzf6iYMuWFUNhTF5px5J53 f+2NYWUt51V1BCDJr0Nr4++SuC/C4NTvl7bfHhJ4DbT6kKNiJJtKstrdLEC83Pw3a6Fe SNTE7Q6Mq/a3IjV0W91se6mQ0GypJiJZvAnQRymHBH9+w1Oy1r3Re32v6rkL6Ur3LaQr IIfMSiqrNgjQKTeN0RVVzCl8LTNi9CgJ1Ob/1yEz45w32xo3zsGOZzP0Xfdyvs+n2nb8 gIwkgiJkqbAxvS88mEgfavNejQO2+VgkqyX6uDCKDYFUydtxbre+6coEdGrl/b7Pe/Vf tCwg== X-Gm-Message-State: AMke39kZaH3VYiTX07k1kEUU6W3i7AWtlmWZwWoKrgi3rzCT6VZSw18pgiOd0ki2fSZBgGiAuRd/p9luK52VyA== X-Received: by 10.157.51.19 with SMTP id f19mr9387074otc.18.1486490471054; Tue, 07 Feb 2017 10:01:11 -0800 (PST) MIME-Version: 1.0 Received: by 10.202.223.10 with HTTP; Tue, 7 Feb 2017 10:00:50 -0800 (PST) In-Reply-To: <20170207155931.vgzv5umuyfvp4bqz@alvherre.pgsql> References: <20170207152309.szeiqnprt2kzij66@alvherre.pgsql> <20170207155931.vgzv5umuyfvp4bqz@alvherre.pgsql> From: Pavan Deolasee Date: Tue, 7 Feb 2017 23:30:50 +0530 Message-ID: Subject: Re: [COMMITTERS] pgsql: Release note updates. To: Alvaro Herrera Cc: Tom Lane , pgsql-hackers Content-Type: multipart/alternative; boundary=001a113e2dc07d44a50547f48868 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 --001a113e2dc07d44a50547f48868 Content-Type: text/plain; charset=UTF-8 On Tue, Feb 7, 2017 at 9:29 PM, Alvaro Herrera wrote: > Alvaro Herrera wrote: > > > > > Hmm. Now that I think about it, it is probably possible to have a > > transaction started before CIC that inserted a bunch of rows, and then > > runs the UPDATE during the CIC race window. Maybe there's a reason the > > bug wouldn't hit in that case but I don't see it, and I'm not able to > > test it right now to verify. > > Pavan adds that it's possible to have a transaction do INSERT while CIC > is running, then some other transaction executes the UPDATE. > > Just to elaborate on that, once a backend ends up with stale cached bitmaps, AFAICS only a second relcache flush can correct that. This may not come for long time. In fact since CIC is already holding a lock on the table, I think second relcache flush will only happen at the end of phase 2. This can take a long time, especially for very large tables. In meanwhile, the compromised backend can run many transactions with the stale information. Those transactions can see not only the existing rows, but also new rows inserted by other new but now committed-good transactions. It's all theory and I haven't had time to try this out. Thanks, Pavan -- Pavan Deolasee http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services --001a113e2dc07d44a50547f48868 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


On Tue, Feb 7, 2017 at 9:29 PM, Alvaro Herrera <alvherre@2ndqua= drant.com> wrote:
Alvaro Herrera wrote:

>
> Hmm.=C2=A0 Now that I think about it, it is probably possible to have = a
> transaction started before CIC that inserted a bunch of rows, and then=
> runs the UPDATE during the CIC race window.=C2=A0 Maybe there's a = reason the
> bug wouldn't hit in that case but I don't see it, and I'm = not able to
> test it right now to verify.

Pavan adds that it's possible to have a transaction do INSERT wh= ile CIC
is running, then some other transaction executes the UPDATE.

<= br>
Just to elaborate on that, once a backend ends up with stale = cached bitmaps, AFAICS only a second relcache flush can correct that. This = may not come for long time. In fact since CIC is already holding a lock on = the table, I think second relcache flush will only happen at the end of pha= se 2. This can take a long time, especially for very large tables. In meanw= hile, the compromised backend can run many transactions with the stale info= rmation. Those transactions can see not only the existing rows, but also ne= w rows inserted by other new but now committed-good transactions.=C2=A0

It's all theory and I haven't had time = to try this out.

Thanks,
Pavan

--
=C2=A0Pavan Deolasee =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 http://www.2ndQuadrant.com/
= =C2=A0PostgreSQL Development, 24x7 Support, Training & Services
--001a113e2dc07d44a50547f48868--