> Why didn't rsync made the copies on master and replica same?
Because rsync was running with —size-only flag.
> I haven't looked in detail, but it sounds slightly risky proposition
> to manipulate the tuples by writing C functions of the form you have
> in your code. I would have preferred some way to avoid this problem
> by ensuring that replicas are properly synced (complete data of master
> via WAL) or by disabling autovacuum.
Avoiding this problem is a good way. But what to do with already corrupted data?
Can you explain more what do you mean?