[bug fix] pg_rewind takes long time because it mistakenly copies data files

Tsunakawa, Takayuki <tsunakawa.takay@jp.fujitsu.com>

From: "Tsunakawa, Takayuki" <tsunakawa.takay@jp.fujitsu.com>
To: "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2018-02-26T06:01:43Z
Lists: pgsql-hackers

Attachments

Hello,

Our customer reported that pg_rewind took many hours to synchronize 400GB of data, even if the new primary doesn't perform any updates.  The attached patch fixes that.

The cause was that pg_rewind failed to recognize data files in tablespace directories, resulting in the full copy of those files instead of WAL replay.

Regards
Takayuki Tsunakawa



Commits

  1. Fix pg_rewind to handle relation data files in tablespaces properly.