Thread: cache state reset

cache state reset

From
David Lobron
Date:
Hello!

I've recently begun seeing an unusually high number of error messages
from my database, of this type:

NOTICE:  InvalidateSharedInvalid: cache state reset

I noticed in the archives that people have asked about this issue before,
but my case seems a bit different, in that my errors do not seem related
to any database vacuuming.  Tom Lane noted in one of his archived replies
that these messages can sometimes be caused by applications with very long
database access times.  I'm running a series of cron'ed Perl tools, each
of which opens a connection to Postgres for up to 5 minutes.  Could this
be the problem?  More generally: what is a cache state reset, and what
might trigger one?

Thank you very much in advance.

Sincerely,

David Lobron



Re: cache state reset

From
Tom Lane
Date:
David Lobron <dlobron@akamai.com> writes:
> I've recently begun seeing an unusually high number of error messages
> from my database, of this type:
> NOTICE:  InvalidateSharedInvalid: cache state reset

> I noticed in the archives that people have asked about this issue before,
> but my case seems a bit different, in that my errors do not seem related
> to any database vacuuming.  Tom Lane noted in one of his archived replies
> that these messages can sometimes be caused by applications with very long
> database access times.  I'm running a series of cron'ed Perl tools, each
> of which opens a connection to Postgres for up to 5 minutes.  Could this
> be the problem?

If it sits in an open transaction for a long time, then it could be the
problem.  Single queries that run for a long time might cause it too,
depending on what they're doing.

> More generally: what is a cache state reset, and what might trigger
> one?

It's not really anything to worry about, if you are using a recent
Postgres release (7.1 is probably safe).  It just means that some
backend was slow about absorbing cache-invalidation notices, leading
to overflow of the internal cache-invalidation message queue.  When
this happens we clear the queue and send a "forget *everything* you've
cached" (ie, cache reset) message instead, to ensure that nothing that
should have been invalidated fails to get invalidated.

If you see a heck of a lot of these (like, say, one every few seconds)
then you might be taking enough of a performance hit to worry about
fixing the cause.  Otherwise ignore it.

            regards, tom lane

Re: cache state reset

From
Jean-Luc Lachance
Date:
Hi all,

This is a simple request.

How about asking a function to recompile itself if it does not find an
object before reporting an error.

If I recall Sybase has a "WITH RECOMPILE" option.

JLL