Re: error "can only drop stats once" brings down database - Mailing list pgsql-bugs

From Michael Paquier
Subject Re: error "can only drop stats once" brings down database
Date
Msg-id ZmuQz8IN6MpLxKs8@paquier.xyz
Whole thread Raw
In response to Re: error "can only drop stats once" brings down database  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
Responses Re: error "can only drop stats once" brings down database
List pgsql-bugs
On Tue, Jun 11, 2024 at 04:44:57PM +0900, Kyotaro Horiguchi wrote:
> We don't simply allow double-drop; instead, we permit this kind of
> behavior only during recovery by signaling the redo-execution
> functions with the parameter isRedo, like smgr_unlink().

Still, the case is different here, no?  Recovery forgives unlinks as
long as we are in crash recovery, or consistency has not been reached
on a standby.  This case is different: we are in a consistent state
and a backend on the standby still holds references to the stats entry
that is transparently reused after a wraparound.

I am wondering if we should tackle this problem by adding a notion of
"age" in the stats entries for what's stored in the central dshash and
in the hold copies in the backends, so as we dump the "age" of an
existing stats entry if we find out that it gets reused in a create
path.  That requires some design and would not be backpatchable, but
it does not seem that invasive at quick glance (I had my eyes on this
code the full week).  Other thoughts are welcome.
--
Michael

Attachment

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #18479: websearch_to_tsquery inconsistent behavior for german when using parentheses
Next
From: Jeff Davis
Date:
Subject: JIT crash introduced by 6185c9737c with LLVM 14