Skip to content

Commit e284e86

Browse files
committed
[ADD] base: document cli options for replica
1 parent 797448d commit e284e86

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

content/developer/reference/cli.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,28 @@ Database
221221

222222
port the database listens on, defaults to 5432
223223

224+
.. option:: --db_replica_host <hostname>
225+
226+
host for the replica server.
227+
228+
When set, Odoo will redirect all read-only transactions to the --db_replica_host
229+
230+
The status of each request is logged:
231+
232+
- Green ``ro``: request done using a readonly cursor
233+
- Yellow ``rw``: request done using a normal read/write cursor
234+
- Red ``ro->rw``: requested attempted in readonly but failed due a write query (create/update/delete) and retried with a read/write cursor.
235+
236+
You can decorate your model methods with ``@api.readonly``, when that method will be directly accessed in RPC it's going to open a cursor
237+
on one of the replica databases instead of the primary one.
238+
239+
You can flag your controllers with ``@route(readonly=True)``, when that controller will be accessed it's gonna open a cursor on the replica.
240+
Note that for advanced usages you can also give a callback, take example on DataSet._call_kw_readonly.
241+
242+
.. option:: --db_replica_port <port>
243+
244+
port the replica database listens on, defaults to 5432
245+
224246
.. option:: --db-filter <filter>
225247

226248
hides databases that do not match ``<filter>``. The filter is a

0 commit comments

Comments
 (0)