Ramsons (R2 2024) Required manual migrations

Ramsons (R2 2024) Required manual migrations

Module

Instructions

Comments

Contact person,
automation Jira

Module

Instructions

Comments

Contact person,
automation Jira

Proxy (nginx, …)

If using the “same host” configuration with a path like /okapi then add proxy_cookie_path configuration, see https://ramsons.docs.folio.org/docs/getting-started/installation/hostnames/#same-host-name

If the proxy adds a path like /okapi then it must be added to the cookie path as well. Otherwise the access token refresh will fail after a few minutes.

@Julian Ladisch

MinIO

If using MinIO upgrade to latest version.

MinIO supports the latest version only (support policy).

@Julian Ladisch

Kafka

Upgrade to a supported Kafka version.

FOLIO works with any supported Kafka version:

Apache Kafka publishes three minor versions per year and supports the latest three minor versions (end-of-life policy) resulting in about a year of support for a minor version. As of 2025-02-07 Apache Kafka supports 3.7.*, 3.8.*, 3.9.*.

Amazon Managed Streaming for Apache Kafka (Amazon MSK) supports a minor version for about two years (supported versions). As of 2025-02-07 Amazon MSK supports 3.6.0, 3.7.*, 3.8.*, 3.9.*.

FOLIO’s snapshot reference environments always use the latest Apache Kafka version (docker-compose).

@Julian Ladisch

mod-search

Shut down all mod-search instances with version 4.0.0-4.0.8.

It it not sufficient to disable versions 4.0.0-4.0.8 for all tenants.

Run mod-search 4.0.* instances with version >= 4.0.9 only.

Each mod-search instance processes Kafka messages for all tenants, including tenants it is not enabled for.

mod-search versions 4.0.0-4.0.8 have a bug when processing instance records Kafka messages.

See fix MSEARCH-951: Non-ECS: "Number of titles" has not updated after link was deleted via "Data import" app (changed MARC tag)Closed = https://github.com/folio-org/mod-search/commit/8e682f1e97f2a7d44e9421286b417da9fd6460ff

 

mod-inventory-storage

Analyze all tenants

The analyze script iterates over all tenants and displays how many holdings records lack the sourceId field and therefore require migration: https://raw.githubusercontent.com/folio-org/mod-inventory-storage/refs/tags/v28.0.14/migration/ramsons-sourceid-migration-analyze.sql

Analyze a single tenant

The single tenant script checks if there is at least one holding record without a sourceId field. If so, the migration script should be executed for that tenant.

SELECT 1 FROM ${myuniversity}_mod_inventory_storage.holdings_record WHERE NOT jsonb ? 'sourceId' OR jsonb->'sourceId' IS NULL OR jsonb->>'sourceId' = '' LIMIT 1;

Migration

Pick one of the following migration methods.

Manual migration using official script

Please replace each of the six <strong>${myuniversity}</strong> with the tenant name.

-- Migration Script DO $$ DECLARE trigger VARCHAR; triggers VARCHAR[] DEFAULT ARRAY[ 'audit_holdings_record', 'set_holdings_record_md_json_trigger', 'set_holdings_record_md_trigger', 'set_holdings_record_ol_version_trigger', 'set_id_in_jsonb', 'update_holdings_record_references', 'updatecompleteupdateddate_holdings_record_delete', 'updatecompleteupdateddate_holdings_record_insert_update' ]; arr UUID[] DEFAULT ARRAY[ '10000000-0000-0000-0000-000000000000', '20000000-0000-0000-0000-000000000000', '30000000-0000-0000-0000-000000000000', '40000000-0000-0000-0000-000000000000', '50000000-0000-0000-0000-000000000000', '60000000-0000-0000-0000-000000000000', '70000000-0000-0000-0000-000000000000', '80000000-0000-0000-0000-000000000000', '90000000-0000-0000-0000-000000000000', 'a0000000-0000-0000-0000-000000000000', 'b0000000-0000-0000-0000-000000000000', 'c0000000-0000-0000-0000-000000000000', 'd0000000-0000-0000-0000-000000000000', 'e0000000-0000-0000-0000-000000000000', 'f0000000-0000-0000-0000-000000000000', 'ffffffff-ffff-ffff-ffff-ffffffffffff' ]; lower UUID; cur UUID; rowcount BIGINT; need_migration BOOLEAN; BEGIN -- STEP 0: Check if migration is required SELECT EXISTS ( SELECT 1 FROM <strong>${myuniversity}</strong>_mod_inventory_storage.holdings_record WHERE NOT jsonb ? 'sourceId' OR jsonb->'sourceId' IS NULL OR jsonb->>'sourceId' = '' LIMIT 1 ) INTO need_migration; IF need_migration THEN -- STEP 1: Disable triggers FOREACH trigger IN ARRAY triggers LOOP EXECUTE 'ALTER TABLE <strong>${myuniversity}</strong>_mod_inventory_storage.holdings_record DISABLE TRIGGER ' || trigger; END LOOP; -- STEP 2: Do updates lower := '00000000-0000-0000-0000-000000000000'; FOREACH cur IN ARRAY arr LOOP RAISE INFO 'range: % - %', lower, cur; -- Update holding records EXECUTE format($q$ UPDATE <strong>${myuniversity}</strong>_mod_inventory_storage.holdings_record h SET jsonb = jsonb_set(h.jsonb, '{sourceId}', CASE -- MARC HOLDING WHEN sub.external_id IS NOT NULL THEN '"036ee84a-6afd-4c3c-9ad3-4a12ab875f59"'::jsonb -- FOLIO HOLDING WHEN sub.external_id IS NULL THEN '"f32d531e-df79-46b3-8932-cdd35f7a2264"'::jsonb END ) FROM ( SELECT DISTINCT ON (hr.id) hr.id, r.record_type, r.external_id FROM <strong>${myuniversity}</strong>_mod_inventory_storage.holdings_record hr LEFT JOIN <strong>${myuniversity}</strong>_mod_source_record_storage.records_lb r ON r.external_id = hr.id WHERE ( (NOT hr.jsonb ? 'sourceId' OR hr.jsonb->>'sourceId' IS NULL OR hr.jsonb->>'sourceId' = '') AND hr.id > %L AND hr.id <= %L ) ) sub WHERE h.id = sub.id; $q$, lower, cur); GET DIAGNOSTICS rowcount = ROW_COUNT; RAISE INFO 'updated % holding records', rowcount; lower := cur; END LOOP; -- STEP 3: Enable triggers FOREACH trigger IN ARRAY triggers LOOP EXECUTE 'ALTER TABLE <strong>${myuniversity}</strong>_mod_inventory_storage.holdings_record ENABLE TRIGGER ' || trigger; END LOOP; END IF; END; $$ LANGUAGE 'plpgsql';

Manual migration using inofficial script

Download populateHoldingsSourceId.sql from https://raw.githubusercontent.com/gbv/mod-inventory-storage/refs/tags/28.0.13/src/main/resources/templates/db_scripts/populateHoldingsSourceId.sql

It does not have the known bugs of the official script, see the bug report MODINVSTOR-1424.

Set search path to the tenant’s mod-inventory-storage schema, then call the script.

Example for psql and tenant diku:

SET search_path = diku_mod_inventory_storage; \i populateHoldingsSourceId.sql

Automated migration using inofficial fork

Replace the folio-org mod-inventory-storage module with the gbv version from https://github.com/gbv/mod-inventory-storage/releases

When a tenant gets migrated from a mod-inventory-storage version before 28.0.13 the gbv version automatically executes the sourceId migration.

If at least one holdings record lacks the sourceId the database user configured using environment variable DB_USER must have read permission to <tenant>_mod_source_record_storage.records_lb table. After the module has been enabled this permission is no longer needed.

In the Ramsons release, the sourceId field is a required field for a holding record. This affects existing holding records that are missing the sourceId field. The user will not be able to update such a holding record:

ERROR : {"errors":[{"message":"must not be null","type":"1","code":"jakarta.validation.constraints.NotNull.message","parameters":[{"key":"sourceId","value":"null"}]}]}
image-20250509-133509.png

The migration script adds sourceId field to holding records to fix them.

@Khalilah Gambrell @Viacheslav Kolesnyk @Svitlana Kovalova

Official script.


@Julian Ladisch

MODINVSTOR-1423: Sysops SQL to show how many holdings records need sourceId migrationClosed

Inofficial script: MODINVSTOR-1424: Ramsons: Automate sourceId migration for holdings recordsClosed