Re: database is not accepting commands to avoid wraparound data loss in database

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: pedrovlf <pedrovlf(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: database is not accepting commands to avoid wraparound data loss in database
Date: 2016-04-07 01:17:10
Message-ID: CAMkU=1xD3exdgYtsRJ_3wDb9UbpKcu_0rptoMs6TAvr4MO4nDA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Apr 6, 2016 at 8:13 AM, pedrovlf <pedrovlf(at)gmail(dot)com> wrote:
> Hi,
>
> I'm following error in my DBMS,
>
> < 2016-04-05 17:02:42.053 BRT >ERROR: database is not accepting commands to
> avoid wraparound data loss in database "zabbix"
> < 2016-04-05 17:02:42.053 BRT >HINT: Stop the postmaster and vacuum that
> database in single-user mode.
>
>
> I'm running the vacuum in single mode, but is taking too long ... you can
> retrieve the base otherwise? Perhaps with truncate on a table ...

Sure. Find the single-user process with top, and then strace it to
see what it is doing:

strace -p 28465 -y

read(11</home/jjanes/pgsql/data/base/16384/18837>,
"\1\0\0\0hP\352=\0\0\0\0\214\2\220\2\0 \4
\0\0\0\0\320\237`\0\240\237`\0"..., 8192) = 8192
lseek(11</home/jjanes/pgsql/data/base/16384/18837>, 124485632,
SEEK_SET) = 124485632

So the problem is file 18837.

Interrupt the vacuum, and run:

select * from pg_class where relfilenode=18786;

(I see I actually messed up my example, the strace I showed was
actually form a different session, but the principle still applies.
Pretend that 18837 and 18786 are the same thing)

...
1: relname = "foo_md5_idx" (typeid = 19, len = 64, typmod
= -1, byval = f)

So I see that in my case, it is a index which is holding things up
(and I happen to know this index is a gin index. This make sense,
because gin and gist indexes are horribly slow to vacuum.) So in my
case I can just drop the index, rather than truncate the table. You
might not be so lucky.

So, still in single user mode, I drop the index, redo the vacuum, and
abracadabra.

Cheers,

Jeff

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Janes 2016-04-07 01:31:46 Re: Trying to understand page structures in PG
Previous Message Bill Moran 2016-04-06 23:24:26 Re: what database schema version management system to use?