Re: [PATCH] fix GIN index search sometimes losing results

From: Pavel Borisov <pashkin(dot)elfe(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pavel Borisov <pashkin(dot)elfe(at)gmail(dot)com>
Subject: Re: [PATCH] fix GIN index search sometimes losing results
Date: 2020-07-13 15:32:24
Message-ID: 159465434400.807.10131381884446945337.pgcf@coridan.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The following review has been posted through the commitfest application:
make installcheck-world: tested, passed
Implements feature: tested, passed
Spec compliant: not tested
Documentation: not tested

Hi, all!

It seems that as of now we have two sets of patches for this bug:
1. Tom Lane's: 0001-make-callbacks-ternary.patch and 0002-remove-calc-not-flag.patch
2. My: gin-gist-weight-patch-v4.diff

There was a quite long discussion above and I suppose that despite the difference both of them suit and will do the necessary fix.
So I decided to make a review of both Tom Lane's patches.

Both of them apply clean. Checks are sucessful. There are regression tests included and they cover the bug. Also I made checks on my PgList database and I suppose the bug is indeed fixed.

For 0001-make-callbacks-ternary.patch
As it was mentioned in discussion, the issue was that in certain cases compare function of a single operand in a query should give undefined meaning "MAYBE" which should remain towards to the root of a tree. So the patch in my opinion adresses the problem in a right way.

Possible dangers of changed callback from binary to ternary is that any side modules which still use binary interface will get warnings on compile and will need minor modifications of code to comply with new interface. I checked it with RUM index and indeed get warnings on compile. In discussion above it was noted that anyway there is no way to get right results in tsearch with NOT without modification of this so I'd recommend committing patch 0001.

For 0002-remove-calc-not-flag.patch
The patch changes the behavior which is now considered default. This is true in RUM module and maybe in some other tsearch side modules. Applying the patch can make code more beautiful but possibly will not give some performance gain and bug is anyway fixed by patch 0001.

Overall I'd recommend patch 0001-make-callbacks-ternary.patch and close the issue.

--
Best regards,
Pavel Borisov

Postgres Professional: http://postgrespro.com

The new status of this patch is: Ready for Committer

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2020-07-13 15:33:38 Re: proposal: possibility to read dumped table's name from file
Previous Message Peter Eisentraut 2020-07-13 15:12:30 Re: Default setting for enable_hashagg_disk