Open mrain32 opened 3 months ago
Hi @mrain32, sorry you're running into this. Just to make sure I understand: what command are you using to restore from a pg_dump backup?
I'd like to track this problem down, though it seems like you have a good workaround here -- though instead of starting a cluster with 2 replicas and deleting the data in the replica, could you restore to a cluster that only has a master, and once that restore is done, bump the number of replicas to 2?
Hi @benjaminjb , thank for your reply.
Here the command for restoring from a pg_dump backup that I used:
pg_restore --verbose --host=x.x.x.x --port=xxx --username=xxx --format=t --dbname=xxx filepath
I think if I started with 1 master only, this error would not occur. But in my case, I have some databases in the cluster and just restore 1 of them, if scale down the number of replicas pod to 0 - restoring - scale up back to 2, it would take time :)
Thank you again, Best Regards, mRain
Hi, I got data file corrupted errors with the log in postgresql-log file :
ERROR: could not read block xxx in file "base/xxx/xxx": read only 0 of 8192 bytes
Not all postgres data files were corrupted, but some of them.
I tried to detect broken fsm files as intructions in this link by running query:
SELECT oid::regclass AS relname, pg_relation_filepath(oid) || '_fsm' AS fsm FROM pg_class, CAST(current_setting('block_size') AS bigint) AS bs WHERE relkind IN ('r', 'i', 't', 'm') AND EXISTS (SELECT 1 FROM generate_series(pg_relation_size(oid) / bs, (pg_relation_size(oid, 'fsm') - 2*bs) / 2) AS blk WHERE pg_freespace(oid, blk) > 0);
and got result like below:
Reproducing steps:
Install postgres cluster by helm with config yaml:
Restore database from pg dump backup file (I tried with different pg dump backup files (different databases) but got the same issue)
Failover to change primary pod (patronictl switchover)
Got FSM broken file error in the postgres log file.
Solved by:
Is it a bug or something?
Environment
Please provide the following details: