Skip to content

Commit

Permalink
Merge pull request #1706 from folio-org/FOLIO-873-improve-docs-274
Browse files Browse the repository at this point in the history
FOLIO-873 improve docs
  • Loading branch information
dcrossleyau authored Jul 29, 2024
2 parents 24ad713 + 0595472 commit 9d21b25
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 10 deletions.
50 changes: 44 additions & 6 deletions _data/repos.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"metadata": {
"generatedDateTime": "2024-07-15T23:48:55.230975+00:00"
"generatedDateTime": "2024-07-28T22:49:25.351455+00:00"
},
"repos": [
{
Expand All @@ -19,6 +19,26 @@
"api-schema-lint.yml"
]
},
{
"defaultBranch": "master",
"description": null,
"docDirName": null,
"name": "app-consortia",
"org": "folio-org",
"repoLanguageHint": "other",
"repoType": "app",
"snippetIntro": ""
},
{
"defaultBranch": "master",
"description": null,
"docDirName": null,
"name": "app-dcb",
"org": "folio-org",
"repoLanguageHint": "other",
"repoType": "app",
"snippetIntro": ""
},
{
"defaultBranch": "master",
"description": null,
Expand All @@ -39,6 +59,16 @@
"repoType": "app",
"snippetIntro": ""
},
{
"defaultBranch": "master",
"description": null,
"docDirName": null,
"name": "app-erm-usage",
"org": "folio-org",
"repoLanguageHint": "other",
"repoType": "app",
"snippetIntro": ""
},
{
"defaultBranch": "master",
"description": null,
Expand All @@ -59,6 +89,16 @@
"repoType": "app",
"snippetIntro": ""
},
{
"defaultBranch": "master",
"description": null,
"docDirName": null,
"name": "app-z39.50",
"org": "folio-org",
"repoLanguageHint": "other",
"repoType": "app",
"snippetIntro": ""
},
{
"defaultBranch": "master",
"description": null,
Expand Down Expand Up @@ -3557,13 +3597,11 @@
"repoType": "stripes",
"snippetIntro": "<p>This is a library of React components and utility functions for use with <a href='https://github.com/folio-org/stripes-core/'>the Stripes UI toolkit</a>, part of <a href='https://www.folio.org/'>the FOLIO project</a>.</p>",
"workflows": [
"build-npm-release.yml",
"build-npm.yml",
"build-storybook.yml"
"build-storybook.yml",
"ui.yml"
],
"workflowsFolio": [
"build-npm-release.yml",
"build-npm.yml"
"ui.yml"
]
},
{
Expand Down
14 changes: 10 additions & 4 deletions _remote/raml-module-builder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,9 @@ to a running PostgreSQL query. 0 disables this timeout and is the default.
To take effect an RMB based module must get it via PostgresClient.getConnectionConfig().getInteger("queryTimeout")
and pass it to the RMB method that starts the connection, transaction or query.

The environment variables `DB_HOST_READER` and `DB_PORT_READER` are for the [Read and write database instances setup](#read-and-write-database-instances-setup).
The environment variables `DB_HOST_READER` and `DB_PORT_READER` are for the synchronously replicated [read and write database instances setup](#read-and-write-database-instances-setup).

The environment variables `DB_HOST_ASYNC_READER` and `DB_PORT_ASYNC_READER` are for the asynchronously replicated read and write database instances setup.

`DB_ALLOW_SUPPRESS_OPTIMISTIC_LOCKING` is a timestamp in the format `2022-12-31T23:59:59Z`. Setting it disables optimistic locking when sending a record that contains `"_version":-1` before that time, after that time `"_version":-1` is rejected. This applies only to tables with `failOnConflictUnlessSuppressed`, see below. The timestamp ensures that disabling this option cannot be forgotten. Suppressing optimistic locking is known to lead to data loss in some cases, don't use in production, you have been warned!

Expand All @@ -419,13 +421,17 @@ The environment variables `DB_HOST_READER` and `DB_PORT_READER` are for the [Rea
See the [Environment Variables](https://github.com/folio-org/okapi/blob/master/doc/guide.md#environment-variables) section of the Okapi Guide for more information on how to deploy environment variables to RMB modules via Okapi.

## Read and write database instances setup
A PostgreSQL instance (the write instance) can be replicated for horizontal scaling (scale out), each replica is a read-only standby instance.
A PostgreSQL instance (the write instance) can be replicated for horizontal scaling (scale out). Each replica is a read-only standby instance.

RMB supports separating read and write requests. By default the write instance configured with `DB_HOST` and `DB_PORT` environment variables is used for reading as well, but optionally a read instance (or a load balancer for multiple read instances) can be configured by setting its host and port using the `DB_HOST_READER` and `DB_PORT_READER` environment variables. If either of these reader variables are not set then it will default to use the writer instance.

RMB only supports [synchronous standby servers](https://www.postgresql.org/docs/current/warm-standby.html#SYNCHRONOUS-REPLICATION). The write instance must list the `DB_*_READER` instance(s) in its `synchronous_standby_names` configuration. This ensures ACID for both write and read instance.
RMB supports both [synchronous standby servers](https://www.postgresql.org/docs/current/warm-standby.html#SYNCHRONOUS-REPLICATION) and asynchronously replicated standby servers (the default)[https://www.postgresql.org/docs/current/warm-standby.html#STREAMING-REPLICATION]. When using synchronous replication, write instance must list the `DB_HOST_READER` instance(s) in its `synchronous_standby_names` configuration. This ensures ACID for both write and read instance.

PostgreSQL's default asynchronous replication is supported by RMB by configuring `DB_HOST_ASYNC_READER` and `DB_PORT_ASYNC_READER`. Asynchronous replication is eventually consistent and suitable for read-only applications like reporting, analytics, and data warehousing. To use the async read host in queries, get an instance of `PostgresClient` using `PostgresClientWithAsyncReadConn.getInstance(...)`. If no async read host is configured, it falls back to the sync read host if configured, otherwise it uses the write host.

AWS RDS does not support synchronous replication. For AWS it is recommended to only use `DB_HOST` and `DB_HOST_ASYNC_READER` in a given deployment.

PostgreSQL's default asynchronous replication is not supported by RMB and will result in errors caused by outdated data the replica may return. Asynchronous replication is eventual consistency suitable for read-only applications like reporting, analytics, and data warehouse.
APIs using the async client should provide a warning in the API documentation that the API uses stale data (for performance reasons).

## Local development server

Expand Down

0 comments on commit 9d21b25

Please sign in to comment.