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

Concurrent module install/upgrade fails with "tuple concurrently updated"

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: P2
    • Resolution: Won't Do
    • Affects Version/s: 29.4.0
    • Fix Version/s: None
    • Template:
    • Sprint:
      CP: sprint 86
    • Story Points:
      2
    • Development Team:
      Core: Platform

      Description

      Concurrently running "CREATE OR REPLACE FUNCTION" for the same function multiple times succeeds for one only. Postgres rolls back the transaction for all others with "tuple concurrently updated":

      02 Apr 2020 11:40:37:623 INFO  PostgresClient [68855821eqId] trying to execute: CREATE OR REPLACE FUNCTION f_unaccent(text) 
         RETURNS text AS $func$ SELECT public.unaccent('public.unaccent', $1)  -- schema-qualify function and dictionary $func$  LANGUAGE sql IMMUTABLE 
      02 Apr 2020 11:40:37:774 ERROR PostgresClient [68855972eqId] ERROR: tuple concurrently updated 
      org.postgresql.util.PSQLException: ERROR: tuple concurrently updated
      

      When concurrently creating or upgrading several RMB based modules for one or several tenants they may try to "CREATE OR REPLACE" these functions in the shared public schema at the same time:

      • f_unaccent
      • concat_space_sql
      • concat_array_object_values
      • concat_array_object

      The roll back fails creating or upgrading the tenant.

      This has been fixed by creating the functions in the module-tenant schema and not in the shared public schema.

      Fix for f_unaccent since RMB 29.5.0 (not yet released): https://github.com/folio-org/raml-module-builder/commit/c6ee111bdea98b4b09ddd2405fb11d3ff14e17ab (f_unaccent has always been in the shared public schema in all versions before 29.5.0: https://github.com/folio-org/raml-module-builder/commit/dc08efc4936bf1ae91534d2b0dfc3644df97066c#diff-8338122a000356f61273ee33471eae20R45 )

      Fix for concat_* since RMB 29.3.0: https://github.com/folio-org/raml-module-builder/commit/872c1f80da4c8d49e6836ca9221f637dc5e7420b

      This issue is about a hot fix for Fameflower b29.4.

      Solution: Repeatedly try to "CREATE OR REPLACE" f_unaccent in public schema until it succeeds (up to 100 times).

        TestRail: Results

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                julianladisch Julian Ladisch
                Reporter:
                julianladisch Julian Ladisch
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:

                    TestRail: Runs

                      TestRail: Cases