Thread: Extension proposal to deal with existing orphaned files

Extension proposal to deal with existing orphaned files

From
"Drouvot, Bertrand"
Date:

Hi hackers,

There is an ongoing effort of cleaning up orphaned files using undo logs [1].

Until this get implemented and databases get upgraded to the version(s) that will benefit from this ongoing work, one still need to handle orphaned files (if any).

I started to work on this subject some time ago by creating an extension that is able to list the orphaned files, see [2].

I have in mind to extend the extension capability to provide 4 more APIs to:

  • move orphaned files to a dedicated backup directory (that the extension will create on the fly)
  • list the files that are part of this backup directory
  • move back the files from this backup directory to their original location
  • remove files that are located in the backup directory

That would help dealing with existing orphaned files in a more secure way (means less error prone).

Would that make sense sharing this work with you and later add this extension in the contrib directory?

Thanks in advance for your feedback,
Bertrand

[1]: https://commitfest.postgresql.org/34/3228/

[2]: https://github.com/bdrouvot/pg_orphaned