Re: Compilation issues for HASH_STATISTICS and HASH_DEBUG options

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Compilation issues for HASH_STATISTICS and HASH_DEBUG options
Date: 2025-08-18 00:56:02
Message-ID: CAApHDvpzzrcZFcE4UJ=HsfREb7yxewy+26+ashTFXYFeK3aLZQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, 17 Aug 2025 at 18:54, Michael Paquier <michael(at)paquier(dot)xyz> wrote:
> -#ifdef HASH_STATISTICS
> -static long hash_accesses,
> - hash_collisions,
> - hash_expansions;
> -#endif
>
> These global counters are as old as d31084e9d111. Removing them
> should not be a problem.

Ancient!

> Side thing.. I'm wondering what prevents us from wiping out entirely
> the use of long in this file. long is 8 bytes everywhere, except on
> WIN32 where it's 4 bytes (as you say), which is a bad practice as we
> have been bitten by overflows because of this dependency in the patch.
> Not related to this patch, still seems worth cleaning up while looking
> at this code. There are a few more things like HASHCTL, of course..

No objections here. I think we're generally chipping away at that
problem anyway. At least, I did some of that recently, and I recall
Tom adjusted things to allow windows to have > 2GB work_mem, which was
a restriction imposed by 32-bit longs.

One last thing, in order to inform people of breakages sooner than a
post-commit report from the buildfarm, I wondered is if we should do:

-#ifdef HASH_DEBUG
+#if defined(HASH_DEBUG) || defined(USE_ASSERT_CHECKING)

The HASH_DEBUG does not add any extra fields, so the overhead only
amounts to the elog(DEBUG4) line. HASH_STATISTICS adds extra fields
and counter incrementing, so I don't propose the same treatment for
that.

David

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2025-08-18 01:10:40 Re: Compilation issues for HASH_STATISTICS and HASH_DEBUG options
Previous Message Kir Shatrov 2025-08-18 00:25:03 Proposal: Extending the PostgreSQL Protocol with Command Metadata