I see there’s a checkbox for “readonly mode during backup” which is not checked by default. I suppose backups work fine without it - when might this feature be needed?
AI-generated summary
The discussion revolves around the purpose of the “readonly mode during backup” feature in Discourse. Ed_S initiates the conversation, questioning the necessity of this feature. itsbhanusharma shares their experience of using the global read-only mode for forum migration, but notes that the backup setting is not useful for this purpose.
gerhard explains that the setting is off by default and is unlikely to cause inconsistent backups, as pg_dump runs in a serializable transaction. They suggest removing the setting, citing that it’s not useful for migrations and only causes annoyance. codinghorror agrees with the removal of the setting.
However, Ed_S proposes an alternative, suggesting that transactions should always be used to prevent inconsistent backups. They suggest keeping the “readonly mode during backup” option for users with large and busy forums who want extra assurance.
The discussion concludes with Roman_Rizzi announcing that the site setting has been removed, as seen in the Discourse review.
The only time I’ve used the read only mode is when I’m migrating a forum from one host to another.
There can be other use cases but that’s the only one I’ve found useful.
I imagine the global ‘read only mode’ is useful for the case of migration. (The setting in question, presumably, makes the forum read-write again when the backup is done, which makes it not so useful for migration.)
Maybe we can remove this setting @eviltrout?
I’m quite sure we can remove the readonly_mode_during_backup setting. It’s off by default anyway. The chance of creating a backup in an inconsistent state is negligible compared to the annoyance of showing a read-only banner to all users everytime a backup is created.
pg_dump runs in a serializable transaction, so an inconsistent state can only happen when Discourse is in the middle of persisting data into multiple tables without using a transaction exactly at the beginning of the database dump. That should be quite rare.
Enabling that setting enables read-only mode only for the duration of database backup. Not a second longer, so it’s not really usable for migrating to another host. You’d be better of in using the “Enable read-only” button in /admin/backups.
Sounds good to me! Did you want to take that?
Hmm… Would it be better, and possible, to ensure that transactions are always used? In the meantime, those with very large and busy forums and a deep sense of anxiety can use this “readonly mode during backup” option.
The site setting was removed here:
https://review.discourse.org/t/drop-unnecessary-readonly-during-backup-setting-9112/9599