pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Julien Rouhaud <julien.rouhaud@dalibo.com>
To: Fujii Masao <masao.fujii@gmail.com>
Cc: Jeff Janes <jeff.janes@gmail.com>
Cc: Jaime Casanova <jaime.casanova@2ndquadrant.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: GIN pending list clean up exposure to SQL
Date: Fri, 22 Jan 2016 21:01:46 +0100
Message-ID: <56A28AAA.6050502@dalibo.com> (raw)
In-Reply-To: <CAHGQGwH=M1BAEJPQdpJjCneqwg8Xa+P8SB+ZsvhVwH6gL2J46w@mail.gmail.com>
References: <CAMkU=1x8zFkpfnozXyt40zmR3Ub_kHu58LtRmwHUKRgQss7=iQ@mail.gmail.com>
	<CAJGNTeNVBMDzxwi=QaJWbeVequf1oENF9GbFaRMfny9H6ic_Ng@mail.gmail.com>
	<CAMkU=1xdv5n8w2-n4j_ysXy6eRd69XhWiGrdxQbqDjWEpBavww@mail.gmail.com>
	<CAMkU=1wEzVkxDJSQe5gbwb7AQ7zMi3D7mr-XMQBoyPzUnzpSpQ@mail.gmail.com>
	<56924D75.7060801@dalibo.com>
	<CAMkU=1w0z86n=+N1yFfKx4-wrO1m6M9XvEFBhV6TQmV4sK1waw@mail.gmail.com>
	<569975CD.3070103@dalibo.com>
	<CAHGQGwH=M1BAEJPQdpJjCneqwg8Xa+P8SB+ZsvhVwH6gL2J46w@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

On 20/01/2016 15:17, Fujii Masao wrote:
> 
> When I compiled the PostgreSQL with the patch, I got the following error.
> ISTM that the inclusion of pg_am.h header file is missing in ginfast.c.
> 
> ginfast.c: In function 'gin_clean_pending_list':
> ginfast.c:980: error: 'GIN_AM_OID' undeclared (first use in this function)
> ginfast.c:980: error: (Each undeclared identifier is reported only once
> ginfast.c:980: error: for each function it appears in.)
> 
> gin_clean_pending_list() must check whether the server is in recovery or not.
> If it's in recovery, the function must exit with an error. That is, IMO,
> something like the following check must be added.
> 
>          if (RecoveryInProgress())
>                  ereport(ERROR,
> 
> (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
>                                   errmsg("recovery is in progress"),
>                                   errhint("GIN pending list cannot be
> cleaned up during recovery.")));
> 
> It's better to make gin_clean_pending_list() check whether the target index
> is temporary index of other sessions or not, like pgstatginindex() does.
> 
> +    Relation    indexRel = index_open(indexoid, AccessShareLock);
> 
> ISTM that AccessShareLock is not safe when updating the pending list and
> GIN index main structure. Probaby we should use RowExclusiveLock?
> 

This lock should be safe, as pointed by Alvaro and Jaime earlier in this
thread
(http://www.postgresql.org/message-id/20151119161846.GK614468@alvherre.pgsql),
as ginInsertCleanup() can be called concurrently.

Also, since 38710a374ea the ginInsertCleanup() call must be fixed:

-   ginInsertCleanup(&ginstate, false, true, &stats);
+   ginInsertCleanup(&ginstate, true, &stats);


Regards.

-- 
Julien Rouhaud
http://dalibo.com - http://dalibo.org


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (24+ messages)  latest in thread

Message-ID: <56A28AAA.6050502@dalibo.com>
Permalink:  ../56A28AAA.6050502@dalibo.com/
Also on:    postgresql.org/message-id/56A28AAA.6050502@dalibo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: julien.rouhaud@dalibo.com, masao.fujii@gmail.com, jeff.janes@gmail.com, jaime.casanova@2ndquadrant.com
  Subject: Re: GIN pending list clean up exposure to SQL
  In-Reply-To: <56A28AAA.6050502@dalibo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox