Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/managing/read_only.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ You can control read-only mode with the Spock parameter `spock.readonly`; only a
This value can be changed using the `ALTER SYSTEM` command.

```sql
ALTER SYSTEM SET spock.readonly = 'on';
ALTER SYSTEM SET spock.readonly = 'all';
SELECT pg_reload_conf();
```

To set the cluster to read-only mode for a session, use the `SET` command. Here are the steps:

```sql
SET spock.readonly TO on;
SET spock.readonly TO all;
```

To query the current status of the cluster, you can use the following SQL command:
Expand All @@ -45,4 +45,4 @@ Notes:
- Only superusers can set and unset the `spock.readonly` parameter.
- When the cluster is in read-only mode, only non-superusers are restricted to read-only operations. Superusers can continue to perform both read and write operations.
- By using a GUC parameter, you can easily manage the cluster's read-only status through standard PostgreSQL configuration mechanisms.

- Available values for readonly are: off, user, all
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Behavior docs are now internally inconsistent after adding off, user, all.

After introducing three modes, nearby text still describes binary on/off output (Line 42) and says superusers are exempt (Lines 3/21/46). That does not match enforcement in src/spock_readonly.c:62-96 (spock_readonly >= READONLY_USER blocks non-read-only statements regardless of role) and the only user vs all distinction appears in replication apply (src/spock_apply.c:2407-2425, where all blocks apply). Please update the behavior description in this doc section to reflect actual mode semantics.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/managing/read_only.md` at line 48, Update the docs to reflect the
three-mode semantics implemented in code: replace binary "on/off" language with
the modes "off, user, all" and describe that spock_readonly (the configuration
variable) comparisons use READONLY_USER to block non-readonly statements for all
non-superuser exemptions removed—i.e., when spock_readonly >= READONLY_USER
regular sessions are prevented from executing non-readonly statements—and that
the only distinction for replication is in spock_apply.c where READONLY_ALL
additionally blocks replication apply; reference spock_readonly, READONLY_USER,
READONLY_ALL, spock_readonly.c, and spock_apply.c so the doc text matches
enforcement.