Attached is a patch that implements unique hash indexes. Regression
tests and docs have been updated (with the exception of
src/backend/access/hash/README).
This patches implements an improved version of the concurrency changes I
outlined on -hackers a couple days ago: the separate lock for
"right-of-insertion" into a bucket chain has been replaced by making use
of existing lmgr lockmodes to get the behavior we need.
I also took the opportunity to refactor the hash index code in a couple
places by moving duplicated code into separate functions, fixed some
typos in the README file, etc.
I've tested this a little bit (it survives 100,000 single-user pgbench
transactions, and 10 concurrent clients doing 1000 transactions each),
but I need to do more testing in the future.
As far as I know, the unique hash index code is functionally complete,
but don't add this to the patch queue (it is obviously for 7.5, anyway),
since I'm about to get started on some related hash index work, for
which I'll submit a mega-patch containing everything. I just posted this
here so that anyone who's interested can take a look at it -- comments
are welcome.
Thanks to Tom Lane, who was very helpful when I asked him code
questions, including suggesting the improved concurrency design I
mentioned above.
Cheers,
Neil