Database vs. file system consistency check in load balancing?

Hi Sebastien and all –

I am working on reverse proxying a bunch of Orthancs in containers behind nginx to load balance a lot of incoming data.

I am using the Postgres plugin with images stored separately as files and I turned off database locking, so all of the orthanc workers will happily run in parallel and can access the images independently for read-only tasks.

However, once I start balancing tasks that add images, the simultaneous writes to the database and filesystem immediately go out of sync and all of the workers but one complain and shut down.

Orthanc: /root/orthanc/OrthancServer/ServerIndex.cpp:229: Orthanc::ServerIndex::Transaction::Transaction(Orthanc::ServerIndex&): Assertion `index_.currentStorageSize_ == index_.db_.GetTotalCompressedSize()’ failed.

I considered that I could probably get around this by either 1) storing both metadata and files in the Postgres database so the transactions become atomic or 2) commenting that line out and recompling (and rebuilding the docker containers). However, I don’t want to reingest 4TB of images on disk into Postgres tables, nor do I want to get rid of a perfectly reasonable sounding safety check. I’m curious if there is another choice, like a hidden option to defer the consistency check until the file system is stable or something like that?

Failing that, is my intuition right that if I stored both the data and images in Postgres, it would always be consistent and therefore allow parallel workers to access it? In that case, will Postgres allow simultaneous access for image storage, or am I headed right back into the single-sequential-access problem?

Any thoughts?

Thanks,

Derek-

Answered my own question. I was using an old Docker image and updated it to a newer build that was apparently compiled as RELEASE instead of DEBUG, so the asserts were off. Eliminated my consistency crash and improved runtime speed probably 10x or more. D-