Re: Database stuck in a state where vacuum and vacuumdb is not working - Mailing list pgsql-general

From Laurenz Albe
Subject Re: Database stuck in a state where vacuum and vacuumdb is not working
Date
Msg-id 15a3ac69cc575c1b544fd6aaf63a5840896af95b.camel@cybertec.at
Whole thread Raw
In response to Database stuck in a state where vacuum and vacuumdb is not working  (jonathaan67 <jonathaan67@protonmail.com>)
List pgsql-general
On Mon, 2022-01-10 at 13:19 +0000, jonathaan67 wrote:
> My database server stuck in a state where vacuum and vacuumdb is not working. Yesterday saw this error:
> 
> > HINT: To avoid a database shutdown, execute a full-database VACUUM in "production_services"
> > WARNING: database "production_services" must be vacuumed within 10059807 transactions
> 
> Stopped all services using database and tried to launch vacuumdb and it immediately failed with this error message:
> 
> > vacuumdb: error: processing of database "production_services" failed: ERROR:  invalid page in block 38919 of
relationbase/31893/272925691
 
> 
> I continued with manually executing vacuum on:
> 
> > SET zero_damaged_pages=on;
> > VACUUM(FULL, VERBOSE, ANALYZE) queue;
> 
> It was running good for some time until connection was terminated and I stopped/started
> server and after that nothing is working. vacuumdb is giving same error about invalid page,
> but manually running vacuum sql command with zero_damaged_pages is giving error:
> 
> > ERROR:  database is not accepting commands to avoid wraparound data loss in database "production_services"
> > HINT:  Stop the postmaster and vacuum that database in single-user mode.
> > You might also need to commit or roll back old prepared transactions, or drop stale replication slots.
> > SQL state: 54000
>  
> And postgre log is filling with this error now:
> 
> > WARNING:  database "production_services" must be vacuumed within 999999 transactions
> 
> So vacuumdb and vacuum with zero_damaged_pages=on is not working anymore.
> 
> How can I get out of this state and force database to accept incoming command for vacuum and
> zeroing damaged pages on vacuum?  Is there any way to make vacuumdb command line do "zero_damaged_pages=on"?
> Some data loss on that table is acceptable and its not a problem.
> 
> Running "PostgreSQL 13.2, compiled by Visual C++ build 1914, 64-bit" on Windows 10, Database size is over 1,5 TB,
> damaged table ~350 GB

You should use single-user mode, like the error message recommends.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com




pgsql-general by date:

Previous
From: jonathaan67
Date:
Subject: Database stuck in a state where vacuum and vacuumdb is not working
Next
From: Devrim Gündüz
Date:
Subject: Re: Install pg_dump and pg_restore on UBI8 and UBI8-minimal