On Wed, Dec 7, 2016 at 6:42 AM, Amit Langote <langote_amit...@lab.ntt.co.jp> wrote: > On 2016/12/07 13:38, Robert Haas wrote: >> On Wed, Nov 30, 2016 at 10:56 AM, Amit Langote <amitlangot...@gmail.com> >> wrote: >>> The latest patch I posted earlier today has this implementation. >> >> I decided to try out these patches today with #define >> CLOBBER_CACHE_ALWAYS 1 in pg_config_manual.h, which found a couple of >> problems: >> >> 1. RelationClearRelation() wasn't preserving the rd_partkey, even >> though there's plenty of code that relies on it not changing while we >> hold a lock on the relation - in particular, transformPartitionBound. > > Oh, I thought an AccessExclusiveLock on the relation would prevent having > to worry about that, but guess I'm wrong. Perhaps, having a lock on a > table does not preclude RelationClearRelation() resetting the table's > relcache.
No, it sure doesn't. The lock prevents the table from actually being changed, so a reload will find data equivalent to what it had before, but it doesn't prevent the backend's cache from being flushed. >> 2. partition_bounds_equal() was using the comparator and collation for >> partitioning column 0 to compare the datums for all partitioning >> columns. It's amazing this passed the regression tests. > > Oops, it seems that the regression tests where the above code might be > exercised consisted only of range partition key with columns all of the > same type: create table test(a int, b int) partition by range (a, (a+b)); It doesn't seem like it; you had this: create table part1 partition of range_parted for values from ('a', 1) to ('a', 10); >> I recommend that once you fix this, you run 'make check' with #define >> CLOBBER_CACHE_ALWAYS 1 and look for other hazards. Such mistakes are >> easy to make with this kind of patch. > > With the attached latest version of the patches, I couldn't see any > failures with a CLOBBER_CACHE_ALWAYS build. Cool. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers