[FOLIO-2447] Remove gen_random_uuid(), it fails in pgpool native replication Created: 05/Feb/20  Updated: 16/Aug/21

Status: Open
Project: FOLIO
Components: None
Affects versions: None
Fix versions: None

Type: Bug Priority: P4
Reporter: Julian Ladisch Assignee: Julian Ladisch
Resolution: Unresolved Votes: 0
Labels: keep-bug, platform-backlog
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original estimate: Not Specified

Issue links:
Blocks
is blocked by RMB-347 Remove gen_random_uuid() as it fails ... Closed
is blocked by MODINVSTOR-483 Remove gen_random_uuid(), it fails in... Closed
is blocked by MODPERMS-75 Remove gen_random_uuid(), it fails in... Closed
Defines
is defined by MODEXPS-21 Remove gen_random_uuid(), it fails in... Closed
Relates
relates to FOLIO-2978 Remove uuid_generate_v4(), it fails i... Open
Sprint: CP: Non-roadmap backlog
Development Team: Core: Platform

 Description   

gen_random_uuid() creates a different UUID in each node of a replicated PostgreSQL environment when Pgpool-II is used in native replication mode.
This has been reported for mod-configuration and Pgpool-II replication in #sys-ops on Slack. From the Pgpool-II manual:
https://www.pgpool.net/docs/latest/en/html/restrictions.html

There is no guarantee that any data provided using a context-dependent mechanism (e.g. random number, transaction ID, OID, SERIAL, sequence), will be replicated correctly on multiple backends.

RMB documentation mentions it in the upgrading guide for RMB 25 and in connection with "generateId": https://github.com/folio-org/raml-module-builder/#the-post-tenant-api

Tasks:

After all modules have removed gen_random_uuid RMB and Spring base should add this function that takes precedence over the function from pgcrypto:

CREATE OR REPLACE FUNCTION public.gen_random_uuid() RETURNS uuid
language plpgsql as $$
BEGIN
  RAISE 'FOLIO doesn''t allow gen_random_uuid() because it doesn''t work with a replicated database like Pgpool-II'
    USING ERRCODE = 'feature_not_supported';
END;
$$;

Note:

Pgpool-II streaming replication mode is NOT affected by this issue, only Pgpool-II native replication mode.



 Comments   
Comment by Adam Dickmeiss [ 13/Aug/21 ]

Can't we close this Julian Ladisch?

Comment by Julian Ladisch [ 13/Aug/21 ]

No, this hasn't been fixed, see https://github.com/search?q=org%3Afolio-org+gen_random_uuid&type=Code .

This issue is the umbrella for all these subtasks.

Generated at Thu Feb 08 23:20:42 UTC 2024 using Jira 1001.0.0-SNAPSHOT#100246-sha1:7a5c50119eb0633d306e14180817ddef5e80c75d.