Skip site navigation (1) Skip section navigation (2)

Re: Hash twice

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Hash twice
Date: 2013-01-14 19:12:24
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
On Sat, Jan 12, 2013 at 11:39 AM, Simon Riggs <simon(at)2ndquadrant(dot)com> wrote:
> Lock code says it calculates "hash value once and then pass around as needed".
> But it actually calculates it twice for new locks.
> Trivial patch attached to make it follow the comments in
> LockTagHashCode and save a few cycles.

Hmm.  This is a nice idea, but it doesn't look right to me, because
you're searching LockMethodLocalHash with a hash code intended to be
used in LockMethodLockHash, and the two hashing schemes are not
compatible, because the former is hashing a LOCALLOCKTAG, and the
latter is hashing a LOCKTAG, and both are just using tag_hash.

On the flip side if I'm wrong and the hashing schemes are compatible,
there are other places in the file where the same trick could be

Robert Haas
The Enterprise PostgreSQL Company

In response to

  • Hash twice at 2013-01-12 16:39:15 from Simon Riggs


pgsql-hackers by date

Next:From: Simon RiggsDate: 2013-01-14 19:50:43
Subject: Re: Hash twice
Previous:From: Alvaro HerreraDate: 2013-01-14 19:07:29
Subject: Re: erroneous restore into pg_catalog schema

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group