On Fri, Jul 24, 2020 at 7:32 AM Robert Haas <robertmh...@gmail.com> wrote: > > On Wed, Jul 22, 2020 at 6:03 PM Soumyadeep Chakraborty > <soumyadeep2...@gmail.com> wrote: > > So if we are not going to address those cases, we should change the > > syntax and remove the notion of read-only. It could be: > > > > ALTER SYSTEM SET wal_writes TO off|on; > > or > > ALTER SYSTEM SET prohibit_wal TO off|on; > > This doesn't really work because of the considerations mentioned in > http://postgr.es/m/ca+tgmoakctzozr0xeqalfimbcje2rgcbazf4eybpxjtnetp...@mail.gmail.com
Ah yes. We should then have ALTER SYSTEM WAL {PERMIT|PROHIBIT}. I don't think we should say "READ ONLY" if we still allow on-disk file changes after the ALTER SYSTEM command returns (courtesy dirty buffer flushes) because it does introduce confusion, especially to an audience not privy to this thread. When people hear "read-only" they may think of static on-disk files immediately. > Contrary to what you write, I don't think either #2 or #3 is > sufficient to enable checksums, at least not without some more > engineering, because the server would cache the state from the control > file, and a bunch of blocks from the database. I guess it would work > if you did a server restart afterward, but I think there are better > ways of supporting online checksum enabling that don't require > shutting down the server, or even making it read-only; and there's > been significant work done on those already. Agreed. As you mentioned, if we did do #2 or #3, we would be able to do pg_checksums on a server that was shut down or that had crashed while it was in a read-only state, which is what Michael was asking for in [1]. I think it's just cleaner if we allow for this. I don't have enough context to enumerate use cases for the advantages or opportunities that would come with an assurance that the cluster's files are frozen (and not covered by any existing utilities), but surely there are some? Like the possibility of pg_upgrade on a running server while it can entertain read-only queries? Surely, that's a nice one! Of course, some or all of these utilities would need to be taught about read-only mode. Regards, Soumyadeep [1] http://postgr.es/m/20200626095921.gf1...@paquier.xyz