Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZP4Bq-0006WS-Gq for pgsql-bugs@arkaria.postgresql.org; Tue, 11 Aug 2015 07:41:42 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZP4Bq-0002Qz-30 for pgsql-bugs@arkaria.postgresql.org; Tue, 11 Aug 2015 07:41:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZP4Bp-0002Qs-K1 for pgsql-bugs@postgresql.org; Tue, 11 Aug 2015 07:41:41 +0000 Received: from mail-ig0-x229.google.com ([2607:f8b0:4001:c05::229]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1ZP4Bl-0004WG-Gs for pgsql-bugs@postgresql.org; Tue, 11 Aug 2015 07:41:40 +0000 Received: by igbij6 with SMTP id ij6so85418700igb.1 for ; Tue, 11 Aug 2015 00:41:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=STGQ8upPp3x+SIfrHCAi8GidA531gU0XTr6dkSrW4No=; b=ciVq9yyVRVts07uWDv4XPjdNjubs69G7pJfxqrYCdQZ3KPZpQIVIlYG+iFALg1p5J5 ZOf4dctefdQ0Qg5eaEgVYXfSgt/MMwziH3FZloVW1bjRKqz9m9IgAsaEIIwGPnnnPCE9 QPGp8POfvLoa1VPA5FAu9WtwcGdNqbwp8WJ3yyTFPbwqVMM4rjZ3VTJKkroxRbsJKpIt Q15jI262uAy7CohX5f1PXwopW8qr0KTKgrmq/25xZrxBnZscCKpIjiIvrHXGnfC/Kot+ rjE1z/cvWtPb7Efz5a6x/hOfaUzhPKRmNJBKdLvgZP07Na6devPu/AmC7gs1HvDepEN9 6HZw== X-Received: by 10.50.66.166 with SMTP id g6mr6839893igt.19.1439278895778; Tue, 11 Aug 2015 00:41:35 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.36.78 with HTTP; Tue, 11 Aug 2015 00:41:15 -0700 (PDT) In-Reply-To: <20150807121643.32633.60549@wrigleys.postgresql.org> References: <20150807121643.32633.60549@wrigleys.postgresql.org> From: Haribabu Kommi Date: Tue, 11 Aug 2015 17:41:15 +1000 Message-ID: Subject: Re: BUG #13541: There is a visibility issue when run some DDL and Query. The time window is very shot To: beijing_pg@163.com Cc: "pgsql-bugs@postgresql.org" Content-Type: text/plain; charset=UTF-8 X-Pg-Spam-Score: -1.7 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On Fri, Aug 7, 2015 at 10:16 PM, wrote: > The following bug has been logged on the website: > > Bug reference: 13541 > Logged by: zhangjinyu > Email address: beijing_pg@163.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 -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs