Set search_path when doing "SET ROLE" for shared pool connection

Description

Steps to Reproduce:

  1. Set environment variable DB_MAXSHAREDPOOLSIZE=4

  2. Set other environment variables as needed (PostgreSQL and Kafka)

  3. Start mod-inventory-storage-25.0.1: java -jar target/mod-inventory-storage-fat.jar

  4. Enable it for tenant diku with reference data using POST http://localhost:8081/_/tenant

  5. Enable it for tenant t2 with reference data using POST http://localhost:8081/_/tenant

  6. Disable it with purge option for tenant t2 using POST http://localhost:8081/_/tenant

  7. For tenant diku call GET /instance-formats?query=cql.allRecords=1%20sortby%20name

Expected Results:
GET succeeds

Actual Results:
GET fails:

Additional Information:
PostgresClient calls "SET ROLE" but doesn't call "SET SCHEMA":
https://github.com/folio-org/raml-module-builder/blob/v35.0.0/domain-models-runtime/src/main/java/org/folio/rest/persist/PostgresClient.java#L3497-L3516
"SET SCHEMA" is needed to set the search path.
When enabling tenant t2 reference data is loaded for schema t2_mod_inventory_storage using database connections that are kept open in idle state and re-used for the GET request.

Workaround:
After disabling/purging a tenant restart all (at least all RMB based) containers/pods.

CSP Request Details

None

CSP Rejection Details

None

Potential Workaround

None

Checklist

hide

TestRail: Results

Activity

Show:

Marc Johnson December 7, 2022 at 12:11 PM

As this affects all modules using RMB, at what point do we advocate that all RMB based modules should be upgraded and back ported releases made?

Julian Ladisch December 7, 2022 at 6:49 AM

Backport for Morning Glory released as v34.0.3 just in case we need it for priority P1 issue .

Julian Ladisch December 6, 2022 at 8:39 PM

No backport because workaround exists.

Done

Details

Assignee

Reporter

Labels

Priority

Story Points

Sprint

Development Team

Core: Platform

Fix versions

Release

Nolana (R3 2022) Bug Fix

RCA Group

Implementation coding issue

TestRail: Cases

Open TestRail: Cases

TestRail: Runs

Open TestRail: Runs
Created November 21, 2022 at 8:59 AM
Updated May 22, 2024 at 11:53 AM
Resolved November 21, 2022 at 3:07 PM
TestRail: Cases
TestRail: Runs