Uploaded image for project: 'RAML Module Builder'
  1. RAML Module Builder
  2. RMB-955

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

    XMLWordPrintable

Details

    • CP: Sprint 152
    • 5
    • Core: Platform
    • Nolana (R3 2022) Bug Fix
    • Implementation coding issue

    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:

      09:43:49 [] [diku] [] [mod_inventory_storage] ERROR PostgresClient       queryAndAnalyze: ERROR: function f_unaccent(text) does not exist (42883) - SELECT * FROM diku_mod_inventory_storage.instance_format WHERE true ORDER BY left(lower(f_unaccent(instance_format.jsonb->>'name')),600), lower(f_unaccent(instance_format.jsonb->>'name')) LIMIT 10 OFFSET 0
      io.vertx.pgclient.PgException: ERROR: function f_unaccent(text) does not exist (42883)
      

      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.

      TestRail: Results

        Attachments

          Issue Links

            Activity

              People

                julianladisch Julian Ladisch
                julianladisch Julian Ladisch
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  TestRail: Runs

                    TestRail: Cases