Deployment of orthanc in k8s with yugabyte

Hi everyone,
I’m currently trying different types of deployment for Orthanc. Right now it’s in Kubernetes(k8s).

I’m aware that korthweb exists, but I’m not a fan of the bitnami postgresql-ha.

So, I tried to use another database that should be postgresql compatible: Yugabyte.

Orthanc is able to connect to the database and create everything needed with some tweaks on the DB configuration.

Right now, I have Orthanc backed by a Yugabyte database. I can upload DICOM files, but I haven’t tried anything else yet.

My “issue” is that the logs of Orthanc are filled with

W0725 15:20:21.060745          HTTP-39 PluginsManager.cpp:157] An SQL transaction failed and will likely be retried: ERROR:  unrecognized node type: 444596495
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

E0725 15:20:21.062740          HTTP-39 StatelessDatabaseOperations.cpp:635] Maximum transactions retries reached

I’m wondering if this error above is mandatory for Orthanc to work correctly or It can be disregarded?

Sidenote: Pretty nice software that you made available for everyone. Thank you for all this awesome work.

Hello

Are you using the new ReadCommitted mode?

(sorry : I just saw the unrecognized node type: 444596495 error after posting… I don’t know what it means)

I see a bunch of errors like that and this unrecognized node type: XXXXXXX is always different even negative sometimes.

The only custom configuration that I did was “disabling” the advisory lock with

ALTER ROLE orthanc SET yb_silence_advisory_locks_not_supported_error=on;

After checking the code of these sql functions updatestatistics and updatesinglestatistic I found that it’s mostly related to update the number of studies and other orthanc related statistics. I’ll try to post on the yugabyte issues to see if they find something not supported on their side.

Update: I posted on the yugabyte discourse
And for those wondering an issue is open on their github.

I far as I can see it affects only the statistics displayed in OE2 and query through the API.

I did the suggested tests from the answer on the Yugabyte forum. Adding the ::bigint in the function make it works without any issue inside psql.

Unfortunately Orthanc does not like this addition and produce this error message

E0812 17:29:49.887425          HTTP-19 PluginsManager.cpp:153] Internal error: The returned field is not of the correct type (Integer64)
E0812 17:29:49.887587          HTTP-19 PluginsManager.cpp:153] Exception in database back-end: Internal error

When I check to postgres documentation about the bigint type it says 8 byte which is a typical int64.

Orthanc in the PostgreSQLIndex.cpp seems to read an int64, but it produces the error pasted above. Any hint about what is going on?