Read-Only Pool

From InfiniteERP Wiki
Revision as of 15:51, 21 January 2022 by Wikiadmin (talk | contribs) (Created page with "=Introduction= {{AvailableFrom|3.0PR17Q2}} The '''read-only pool''' feature allows to retrieve connections from a secondary (backup) database which allows just read-only oper...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Introduction

Bulbgraph.png   This feature is available starting from 3.0PR17Q2.

The read-only pool feature allows to retrieve connections from a secondary (backup) database which allows just read-only operations. Typically, this will be a stand-by database that must have its data updated as much as possible.

It provides two main advantages:

  • This helps to relieve the load in the main database.
  • The reporting queries will not be executed against the main database: the standard ERP reports will be generated by taking the data from the secondary database.

Configuration

To configure the read-only pool the following property must be included in Openbravo.properties:

  • bbdd.readonly.url: this property provides the read-only database url.

Note that it is also mandatory to define the Apache JDBC Connection Pool in order to make use of the read-only pool.

Besides, for each bbdd.* and db.pool.* it is possible to add new bbdd.readonly.* and db.readonly.pool.* properties to configure the read-only database connection and specific pool properties for it. For example:

bbdd.readonly.user=ro
bbdd.readonly.password=ro
db.readonly.maxActive=10000
...

In case the read-only properties are not defined, the read-only pool will take the properties defined for the standard pool.

Supported Reports

Once the read-only pool is enabled, it will be used to generate all the standard reports of the application. Please note that for custom manual reports which are not making use of the standard reporting engine, they should be adapted in case it is desired to make use of the read-only pool to generate them.

Bulbgraph.png   See OBDal for more details about how to adapt a report to use the read-only pool.

Starting from 3.0PR17Q4 release, there are some manual reports in core that have been made compatible with the read-only pool. The full list of adapted reports is listed here.

And starting from 3.0PR18Q2 release, the documents printed with the standard print toolbar button, are never using the read-only pool (even if configured) but the standard pool. See here for additional information.

Customization

Bulbgraph.png   This feature is available starting from 3.0PR18Q3.

Once the read-only pool is configured, it is used by all supported reports (see section above) by default. However, this behavior can be overriden by a Preference value and with a manual selection if a fine-grain configuration is required.

Bulbgraph.png   For performance reasons this configuration is cached. When configuration changes, either in the Preference or the Data Pool Selection window, it is recommended to restart Tomcat to apply the changes.

Preference

Default-pool-preference.png

The preference Default DB Pool used by reports defines the database pool used by all reports that support using the read-only pool. Value should be DEFAULT or RO. If this preference is not defined or contains an invalid value, reports will use the read-only pool if configured.

Manual Selection

Data-pool-selection.png

If a finer grain configuration is required, in window General Setup|Application|Data Pool Selection is possible to configure for each report which database pool to use, overriding the preference defined in Default DB pool used by reports.

Report selector.png

The Report dropdown will show all applicable reports. That is, reports defined either in Process and Report or in Process Definition that is not used in toolbar's print button.

Report's association with database pool can be temporary disabled using the Is active flag. Once deactivated, the pool defined in Default DB pool used by reports will be used.

No-ro-pool-configured-message.png

Administrators can add entries to this Window even if RO pool is not configured yet. In that case, a message should appear to indicate that RO pool is not configured yet and that the referred report is already using the main pool.