When to use "readonly mode during backup"

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?

6 Likes

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.

1 Like

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.)

1 Like

Maybe we can remove this setting @eviltrout?

1 Like

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.

6 Likes

Sounds good to me! Did you want to take that?

1 Like

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:

3 Likes