zodb / relstorage

A backend for ZODB that stores pickles in a relational database.
Other
54 stars 46 forks source link

Read-Only config not working with read-only postgres database #506

Open Nimo-19 opened 1 month ago

Nimo-19 commented 1 month ago

I am currently toying around with postgres and some strategies to backup and restore the database. During testing I noticed that during the restore the database is in a read-only mode so I wanted to see if I can view the result by by starting my plone instance with the read-only relstorage config. But I seems something wants to write or at least set a read-write mode.

Don't know If I'm missing something or if this is even a bug. My relstorage and postgres knowledge is limited atm.

excerpt from my postgres log, when I tried to start my plone instance:

[...]
2024-08-01 08:36:19.492 GMT [56] LOG:  database system is ready to accept read-only connections
INFO: 2024/08/01 08:36:19.551463 Files will be read from storages: [default]                   
2024-08-01 08:36:19.554 GMT [80] LOG:  restored log file "000000010000000000000026" from archive
INFO: 2024/08/01 08:36:19.615954 Files will be read from storages: [default]                    
2024-08-01 08:36:19.619 GMT [80] LOG:  restored log file "000000010000000000000027" from archive
INFO: 2024/08/01 08:36:19.686305 Files will be read from storages: [default]                    
2024-08-01 08:36:19.689 GMT [80] LOG:  restored log file "000000010000000000000028" from archive
INFO: 2024/08/01 08:36:19.817807 Files will be read from storages: [default]                    
2024-08-01 08:36:19.821 GMT [80] LOG:  restored log file "000000010000000000000029" from archive
2024-08-01 08:36:19.854 GMT [80] LOG:  recovery stopping before commit of transaction 867, time 2024-07-30 06:36:30.713379+00
2024-08-01 08:36:19.855 GMT [80] LOG:  pausing at the end of recovery                                     
2024-08-01 08:36:19.855 GMT [80] HINT:  Execute pg_wal_replay_resume() to promote.
%2024-08-01 08:36:52.754 GMT [191] ERROR:  cannot set transaction read-write mode during recovery
2024-08-01 08:36:52.754 GMT [191] STATEMENT:  BEGIN ISOLATION LEVEL READ COMMITTED READ WRITE NOT DEFERRABLE
[...]
davisagli commented 1 month ago

Don't know If I'm missing something or if this is even a bug.

I don't know either. Can you explain in more detail what you did to try to start the plone instance with read-only relstorage config?

Nimo-19 commented 1 month ago

I spun up a plone classic docker container with the RELSTORAGE_READ_ONLY=on env variable. It even triggers a read only exception when I try to write something (Tested with a writable Database).