Нужна помощь специалистов. Сам не силен в постгри.
Исходные данные - база engine виртуальной машины HostedEngine гипервизора Ovirt.
Предыстория - была проблема с фс и покорежилась база.
ФС починил, сделал полную реиндексацию стандартными средствами (reindexdb -a)
и в общем и целом заработало, но теперь не проходит бэкап базы - валится с ошибкой:
pg_dump -w -U engine -h localhost -p 5432 engine -E UTF8 --disable-dollar-quoting --disable-triggers --format=custom
pg_dump: Dumping the contents of table "audit_log" failed: PQgetResult() failed.
pg_dump: Error message from server: ERROR: missing chunk number 0 for toast value 43790352 in pg_toast_16457
Что делал.
Номер раз.
reindexdb -a # проходит без ошибок
/bin/engine-vacuum -f -t audit_log
vacuumdb: vacuuming of table "audit_log" in database "engine" failed: ERROR: missing chunk number 0
for toast value 43790352 in pg_toast_16457
su postgres
bash-4.2$ psql -d engine
psql (9.2.23)
Type "help" for help.
engine=# REINDEX table pg_toast.pg_toast_16457;
REINDEX
engine=# REINDEX table audit_log;
REINDEX
engine=# VACUUM ANALYZE pg_toast.pg_toast_16457;
VACUUM
engine=# VACUUM FULL pg_toast.pg_toast_16457;
VACUUM
engine=# VACUUM ANALYZE audit_log;
VACUUM
engine=# VACUUM FULL audit_log;
ERROR: missing chunk number 0 for toast value 43790352 in pg_toast_16457
su postgres
bash-4.2$ for ((i=0; i<4647; i++)); do psql engine -c "SELECT * FROM audit_log LIMIT 1 OFFSET $i" > /dev/null || echo $i; done
ERROR: missing chunk number 0 for toast value 43790352 in pg_toast_16457
486
ERROR: missing chunk number 0 for toast value 43790344 in pg_toast_16457
587
ERROR: unexpected chunk number 2 (expected 0) for toast value 43790354 in pg_toast_16457
640
psql -d engine
engine=# select table_name, column_name from information_schema.columns where table_name='audit_log';
table_name | column_name
------------+---------------------
audit_log | audit_log_id
audit_log | user_id
audit_log | user_name
.......
engine=# SELECT audit_log_id FROM audit_log LIMIT 1 OFFSET 486;
audit_log_id
--------------
33790
(1 row)
engine=# delete from audit_log where audit_log_id='33790';
DELETE 1
engine=# SELECT audit_log_id FROM audit_log LIMIT 1 OFFSET 587;
audit_log_id
--------------
33898
(1 row)
engine=# delete from audit_log where audit_log_id='33898';
DELETE 1
engine=# SELECT audit_log_id FROM audit_log LIMIT 1 OFFSET 640;
audit_log_id
--------------
33953
(1 row)
engine=# delete from audit_log where audit_log_id='33953';
DELETE 1
engine=# VACUUM FULL audit_log;
ERROR: missing chunk number 0 for toast value 43790352 in pg_toast_16457
но не знаю как правильно это сделать. Есть бэкап всей базы за 17.10.17.