Re: BUG #13541: There is a visibility issue when run some DDL and Query. The time window is very shot

From: Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com>
To: beijing_pg(at)163(dot)com
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #13541: There is a visibility issue when run some DDL and Query. The time window is very shot
Date: 2015-08-11 07:41:15
Message-ID: CAJrrPGd--dTUoRpwiSmNVpa56sbCMMB-xB4=Qc4um1NNnt4uhQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-docs

On Fri, Aug 7, 2015 at 10:16 PM, <beijing_pg(at)163(dot)com> wrote:
> The following bug has been logged on the website:
>
> Bug reference: 13541
> Logged by: zhangjinyu
> Email address: beijing_pg(at)163(dot)com
> PostgreSQL version: 9.2.13
> Operating system: suse
> Description:
>
> There is a visibility issue when run some DDL and Query. The time window is
> very shot. Postgres is to hold relation lock after getsnapshot. Before a
> query holds relation lock, if another session run a DDL(alter table alter
> column set datatype), Once this DDL committed, select query will return zero
> row, because the DDL(alter table alter column set datatype) will rewrite all
> tuples with new transaction id.
>
> We can use the following test case to repro the issue. we add sleep(40)
> after GetTransactionSnapshot (in function exec_simple_query) to enlarge the
> time window.
> Step1: session1: select * from t; (return 3 row)
> set enable_sleep30_after_getsnapshot=on;
> select * from t;
> Step2: session2: begin transaction;
> alter table t alter c1 set type char(10);
> commit;
>
> we can see session1 "select * from t" return 0 row.
> ======================================
> session1:
> select * from t; (it returns 3 rows)
> set enable_sleep30_after_getsnapshot=on;
> select * from t; (it returns 0 row)
>
> session2:
> start transaction;
> alter table t alter c1 set type char(10);
> end;

I am not able to reproduce this issue.
I tried putting a breakpoint after GetTransactionSnapshot function
in exec_simple_query function and executed the alter table in other session.

Even if the other session data is committed, still the old data is
present in the
database. The old transaction still can see this data. Am I missing something?

Regards,
Hari Babu
Fujitsu Australia

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Meskes 2015-08-11 08:10:21 Re: BUG #13557: ESQL select issue
Previous Message manuel.pallier 2015-08-11 05:41:46 BUG #13561: "could not write to log file, Bad file descriptor" error when working with huge table

Browse pgsql-docs by date

  From Date Subject
Next Message Dmitry Igrishin 2015-08-11 09:51:17 36.1 Overview of Trigger Behavior
Previous Message Bruce Momjian 2015-08-09 00:41:06 Re: Minor typo in rules.sgml