Unable to backup with error on email_logs table

Hi,

we have a discourse instance that we are unable to backup (and upgrade) for quite sometime.
When running backup we get this error

pg_dump: dumping contents of table "public.email_change_requests"
pg_dump: processing data for table "public.email_logs"
pg_dump: dumping contents of table "public.email_logs"
pg_dump: error: Dumping the contents of table "email_logs" failed: PQgetResult() failed.
pg_dump: error: Error message from server: ERROR:  could not access status of transaction 4156776275
DETAIL:  Could not open file "pg_xact/0F7C": No such file or directory.
pg_dump: error: The command was: COPY public.email_logs (id, to_address, email_type, user_id, created_at, updated_at, post_id, bounce_key, bounced, message_id, smtp_group_id, cc_addresses, cc_user_ids, raw, topic_id) TO stdout;
EXCEPTION: pg_dump failed

After reading a lot of posts here and trying a lot of things, I eventually end up trying to query that table and get this error:

discourse=# select * from email_logs;
ERROR:  could not access status of transaction 4156776275
DETAIL:  Could not open file "pg_xact/0F7C": No such file or directory.
discourse=#

this issue is going on for a long time so restoring from last backup is not really an option. Other than this ‘backup issue’ the discourse is running fine.

Email_logs seems just a log table and I have no problem of loosing eventual logs on emails if it means I get backups running again. Can I just TRUNCATE the email_logs table or the missing data will generate more errors?

thanks for your help

1 Like