# HG changeset patch # User Alain Mazy # Date 1707914764 -3600 # Node ID 15e609c439d18c01f87eb76bc1fcfc07e46ae068 # Parent d1e1cb3ab741b0a17cde275f1a9e639a30e64613 Fixed the MaximumStorageSize & MaximumPatientCount. diff -r d1e1cb3ab741 -r 15e609c439d1 PostgreSQL/NEWS --- a/PostgreSQL/NEWS Thu Feb 08 16:18:36 2024 +0100 +++ b/PostgreSQL/NEWS Wed Feb 14 13:46:04 2024 +0100 @@ -1,6 +1,10 @@ Pending changes in the mainline =============================== +DB schema revision: 2 + +* Fixed the MaximumStorageSize & MaximumPatientCount. + Release 6.0 (2024-02-08) ======================== diff -r d1e1cb3ab741 -r 15e609c439d1 PostgreSQL/Plugins/PostgreSQLIndex.cpp --- a/PostgreSQL/Plugins/PostgreSQLIndex.cpp Thu Feb 08 16:18:36 2024 +0100 +++ b/PostgreSQL/Plugins/PostgreSQLIndex.cpp Wed Feb 14 13:46:04 2024 +0100 @@ -240,9 +240,8 @@ { DatabaseManager::CachedStatement statement( STATEMENT_FROM_HERE, manager, - "SELECT value FROM GlobalIntegers WHERE key = 0"); + "SELECT * FROM UpdateSingleStatistic(0)"); - statement.SetReadOnly(true); statement.Execute(); result = static_cast(statement.ReadInteger64(0)); @@ -262,9 +261,8 @@ { DatabaseManager::CachedStatement statement( STATEMENT_FROM_HERE, manager, - "SELECT value FROM GlobalIntegers WHERE key = 1"); + "SELECT * FROM UpdateSingleStatistic(1)"); - statement.SetReadOnly(true); statement.Execute(); result = static_cast(statement.ReadInteger64(0)); @@ -622,19 +620,11 @@ uint64_t result; { - DatabaseManager::CachedStatement statement( - STATEMENT_FROM_HERE, manager, - "SELECT value FROM GlobalIntegers WHERE key = ${key}"); - - statement.SetParameterType("key", ValueType_Integer64); + DatabaseManager::StandaloneStatement statement( + manager, + std::string("SELECT * FROM UpdateSingleStatistic(") + boost::lexical_cast(resourceType + 2) + ")"); // For an explanation of the "+ 2" below, check out "PrepareIndex.sql" - Dictionary args; - - // For an explanation of the "+ 2" below, check out "FastCountResources.sql" - args.SetIntegerValue("key", static_cast(resourceType + 2)); - - statement.SetReadOnly(true); - statement.Execute(args); + statement.Execute(); result = static_cast(statement.ReadInteger64(0)); } diff -r d1e1cb3ab741 -r 15e609c439d1 TODO --- a/TODO Thu Feb 08 16:18:36 2024 +0100 +++ b/TODO Wed Feb 14 13:46:04 2024 +0100 @@ -26,9 +26,8 @@ PostgreSQL ---------- -* reported issue to validate: uploading lots of files through HTTP with: - - 1 client and IndexConnectionsCount==1 took 100s - - 2 client and IndexConnectionsCount==2 took 600s (lots of transaction replayed) +* Have a separate "thread" to UpdateStatistics to avoid large computations ? + * Seems Orthanc might deadlock when there are plenty of conflicting transactions: https://groups.google.com/g/orthanc-users/c/xQelEcKqL9U/m/HsvxwlkvAQAJ