Hi,
Me = Not SQL Wiz, and not an Orthanc contributor.
I’m currently experimenting yugabyte as a backend for the Orthanc software (it uses PostgreSQL).
Everything seems to works fine with some fine-tuning of parameters
CREATE ROLE orthanc WITH ENCRYPTED PASSWORD 'orthanc';
CREATE DATABASE orthanc OWNER orthanc;
ALTER ROLE orthanc SET yb_silence_advisory_locks_not_supported_error=on;
GRANT yb_extension TO orthanc;
ALTER ROLE orthanc LOGIN;
And the yugabyte master and tserver are started from the charts with these specific values
...
gflags:
master:
ysql_enable_auth: true
default_memory_limit_to_ram_ratio: 0.85
yb_enable_read_committed_isolation: true
tserver:
ysql_enable_auth: true
yb_enable_read_committed_isolation: true
...
However there is one function that causes an error message. This function update some statistics and does not impact the behavior of the orthanc software to receive and send images.
W0809 13:26:02.213940 HTTP-5 PluginsManager.cpp:157] An SQL transaction failed and will likely be retried: ERROR: unrecognized node type: 8388615
CONTEXT: SQL statement "WITH deleted_rows AS (
DELETE FROM GlobalIntegersChanges
WHERE GlobalIntegersChanges.key = statistics_key
RETURNING value
)
UPDATE GlobalIntegers
SET value = value + (
SELECT COALESCE(SUM(value), 0)
FROM deleted_rows
)
WHERE GlobalIntegers.key = statistics_key
RETURNING value"
PL/pgSQL function updatesinglestatistic(integer) line 6 at SQL statement
SQL statement "SELECT UpdateSingleStatistic(0)"
PL/pgSQL function updatestatistics() line 4 at SQL statement
Is there something not supported by Yugabyte? Or something that can be fixed in the code of the function?
Function code from the DB
orthanc=> \sf+ updatestatistics
CREATE OR REPLACE FUNCTION public.updatestatistics(OUT patients_cunt bigint, OUT studies_count bigint, OUT series_count bigint, OUT instances_count bigint, OUT total_compressed_size bigint, OUT total_uncompressed_size bigint)
RETURNS record
LANGUAGE plpgsql
1 AS $function$
2 BEGIN
3
4 SELECT UpdateSingleStatistic(0) INTO total_compressed_size;
5 SELECT UpdateSingleStatistic(1) INTO total_uncompressed_size;
6 SELECT UpdateSingleStatistic(2) INTO patients_cunt;
7 SELECT UpdateSingleStatistic(3) INTO studies_count;
8 SELECT UpdateSingleStatistic(4) INTO series_count;
9 SELECT UpdateSingleStatistic(5) INTO instances_count;
10
11 END;
12 $function$
orthanc=> \sf+ updatesinglestatistic
CREATE OR REPLACE FUNCTION public.updatesinglestatistic(statistics_key integer, OUT new_value bigint)
RETURNS bigint
LANGUAGE plpgsql
1 AS $function$
2 BEGIN
3
4 -- Delete the current changes, sum them and update the GlobalIntegers row.
5 -- New rows can be added in the meantime, they won't be deleted or summed.
6 WITH deleted_rows AS (
7 DELETE FROM GlobalIntegersChanges
8 WHERE GlobalIntegersChanges.key = statistics_key
9 RETURNING value
10 )
11 UPDATE GlobalIntegers
12 SET value = value + (
13 SELECT COALESCE(SUM(value), 0)
14 FROM deleted_rows
15 )
16 WHERE GlobalIntegers.key = statistics_key
17 RETURNING value INTO new_value;
18
19 END;
20 $function$