From 6f4204731f30dc02de9cce67a14f30cca166a733 Mon Sep 17 00:00:00 2001 From: IceS2 Date: Thu, 22 May 2025 15:13:00 +0200 Subject: [PATCH] MINOR: Fix app marketplace migrations (#21360) * Fix app marketplace migrations * Fix test --- .../native/1.7.1/mysql/schemaChanges.sql | 12 ++++++---- .../native/1.7.1/postgres/schemaChanges.sql | 24 ++++++++++++++----- .../resources/system/SystemResourceTest.java | 4 ++-- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/bootstrap/sql/migrations/native/1.7.1/mysql/schemaChanges.sql b/bootstrap/sql/migrations/native/1.7.1/mysql/schemaChanges.sql index 190e307cc61..d76251076ec 100644 --- a/bootstrap/sql/migrations/native/1.7.1/mysql/schemaChanges.sql +++ b/bootstrap/sql/migrations/native/1.7.1/mysql/schemaChanges.sql @@ -27,11 +27,13 @@ WHERE serviceType = 'Tableau'; -- Add runtime: enabled for AutoPilot UPDATE apps_marketplace -SET json = JSON_SET( - json, - '$.runtime.enabled', - true -) +SET json = + CASE + WHEN JSON_EXTRACT(json, '$.runtime') IS NULL THEN + JSON_MERGE_PATCH(json, JSON_OBJECT('runtime', JSON_OBJECT('enabled', true))) + ELSE + JSON_SET(json, '$.runtime.enabled', true) + END WHERE name = 'AutoPilotApplication'; -- Update workflow settings with default values if present diff --git a/bootstrap/sql/migrations/native/1.7.1/postgres/schemaChanges.sql b/bootstrap/sql/migrations/native/1.7.1/postgres/schemaChanges.sql index 0f5ace2f751..d5c2e30a23a 100644 --- a/bootstrap/sql/migrations/native/1.7.1/postgres/schemaChanges.sql +++ b/bootstrap/sql/migrations/native/1.7.1/postgres/schemaChanges.sql @@ -33,12 +33,24 @@ WHERE serviceType = 'Tableau'; -- Add runtime: enabled for AutoPilot UPDATE apps_marketplace -SET json = jsonb_set( - json::jsonb, - '{runtime,enabled}', - 'true' -) -where name = 'AutoPilotApplication'; +SET json = + CASE + WHEN json::jsonb -> 'runtime' IS NULL THEN + jsonb_set( + json::jsonb, + '{runtime}', + jsonb_build_object('enabled', true), + true + ) + ELSE + jsonb_set( + json::jsonb, + '{runtime,enabled}', + 'true', + true + ) + END +WHERE name = 'AutoPilotApplication'; -- Update workflow settings with default values if present UPDATE openmetadata_settings diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/resources/system/SystemResourceTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/resources/system/SystemResourceTest.java index 9485e06e2ff..38986fdbb9f 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/resources/system/SystemResourceTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/resources/system/SystemResourceTest.java @@ -698,9 +698,9 @@ class SystemResourceTest extends OpenMetadataApplicationTest { JsonUtils.convertValue(setting.getConfigValue(), WorkflowSettings.class); // Assert default values - assertEquals(50, workflowSettings.getExecutorConfiguration().getCorePoolSize()); + assertEquals(10, workflowSettings.getExecutorConfiguration().getCorePoolSize()); assertEquals(1000, workflowSettings.getExecutorConfiguration().getQueueSize()); - assertEquals(100, workflowSettings.getExecutorConfiguration().getMaxPoolSize()); + assertEquals(20, workflowSettings.getExecutorConfiguration().getMaxPoolSize()); assertEquals(20, workflowSettings.getExecutorConfiguration().getTasksDuePerAcquisition()); assertEquals(7, workflowSettings.getHistoryCleanUpConfiguration().getCleanAfterNumberOfDays());