Mercurial > hg > orthanc
changeset 5605:3f24eb4013d8 find-refactoring
integration mainline->find-refactoring
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 08 May 2024 10:30:57 +0200 |
parents | e4e7ca3d206e (current diff) c2a2fb8e868d (diff) |
children | 6e2dad336446 |
files | NEWS OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp OrthancServer/Sources/Database/StatelessDatabaseOperations.h |
diffstat | 5 files changed, 60 insertions(+), 64 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS Wed May 08 07:09:49 2024 +0200 +++ b/NEWS Wed May 08 10:30:57 2024 +0200 @@ -1,28 +1,6 @@ Pending changes in the mainline =============================== -Maintenance ------------ - -* In C-Find queries including GenericGroupLength tags, Orthanc was still - extracting these tags from the storage although they were already ignored - and not returned in the response. - They are now removed from the query earlier to avoid this disk access that - could slow down the response time. Note that this seems to happen mainly - when the query originates from some GE devices (AWS). -* The 0x0111 DIMSE Status is now considered as a warning instead of an error - when received as a response to a C-Store. - See https://discourse.orthanc-server.org/t/ignore-dimse-status-0x0111-when-sending-partial-duplicate-studies/4555/3 -* Removed potential PHI from the logs when Orthanc encounters an error while - creating a zip file. - -Bug Fixes ---------- - -* When working with "DicomTlsEnabled": true and "DicomTlsRemoteCertificateRequired": false, - Orthanc was refusing to start if no "DicomTlsTrustedCertificates" was provided. - - REST API -------- @@ -49,6 +27,25 @@ OrthancFramework, plugins should now use ORTHANC_PLUGINS_LOG_INFO(), ORTHANC_PLUGINS_LOG_WARNING(), and ORTHANC_PLUGINS_LOG_ERROR(). +Maintenance +----------- + +* In C-Find queries including GenericGroupLength tags, Orthanc was still + extracting these tags from the storage although they were already ignored + and not returned in the response. + They are now removed from the query earlier to avoid this disk access that + could slow down the response time. Note that this seems to happen mainly + when the query originates from some GE devices (AWS). +* The 0x0111 DIMSE Status is now considered as a warning instead of an error + when received as a response to a C-Store. + See https://discourse.orthanc-server.org/t/ignore-dimse-status-0x0111-when-sending-partial-duplicate-studies/4555/3 +* Removed potential PHI from the logs when Orthanc encounters an error while + creating a zip file. +* Monitoring of stable resources now also takes into consideration the + resource type, not only the resource identifier identifier. +* When working with "DicomTlsEnabled": true and "DicomTlsRemoteCertificateRequired": false, + Orthanc was refusing to start if no "DicomTlsTrustedCertificates" was provided. + Version 1.12.3 (2024-01-31) ===========================
--- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp Wed May 08 07:09:49 2024 +0200 +++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp Wed May 08 10:30:57 2024 +0200 @@ -998,7 +998,7 @@ type == ResourceType_Study || type == ResourceType_Series) { - target.isStable_ = !transaction.GetTransactionContext().IsUnstableResource(internalId); + target.isStable_ = !transaction.GetTransactionContext().IsUnstableResource(type, internalId); if (LookupStringMetadata(tmp, target.metadata_, MetadataType_LastUpdate)) { @@ -3555,9 +3555,9 @@ transaction.LogChange(status.patientId_, ChangeType_NewChildInstance, ResourceType_Patient, hashPatient_); // Mark the parent resources of this instance as unstable - transaction.GetTransactionContext().MarkAsUnstable(status.seriesId_, ResourceType_Series, hashSeries_); - transaction.GetTransactionContext().MarkAsUnstable(status.studyId_, ResourceType_Study, hashStudy_); - transaction.GetTransactionContext().MarkAsUnstable(status.patientId_, ResourceType_Patient, hashPatient_); + transaction.GetTransactionContext().MarkAsUnstable(ResourceType_Series, status.seriesId_, hashSeries_); + transaction.GetTransactionContext().MarkAsUnstable(ResourceType_Study, status.studyId_, hashStudy_); + transaction.GetTransactionContext().MarkAsUnstable(ResourceType_Patient, status.patientId_, hashPatient_); transaction.GetTransactionContext().SignalAttachmentsAdded(instanceSize); storeStatus_ = StoreStatus_Success;
--- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.h Wed May 08 07:09:49 2024 +0200 +++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.h Wed May 08 10:30:57 2024 +0200 @@ -159,13 +159,14 @@ virtual int64_t GetCompressedSizeDelta() = 0; - virtual bool IsUnstableResource(int64_t id) = 0; + virtual bool IsUnstableResource(Orthanc::ResourceType type, + int64_t id) = 0; virtual bool LookupRemainingLevel(std::string& remainingPublicId /* out */, ResourceType& remainingLevel /* out */) = 0; - virtual void MarkAsUnstable(int64_t id, - Orthanc::ResourceType type, + virtual void MarkAsUnstable(Orthanc::ResourceType type, + int64_t id, const std::string& publicId) = 0; virtual void SignalAttachmentsAdded(uint64_t compressedSize) = 0;
--- a/OrthancServer/Sources/ServerIndex.cpp Wed May 08 07:09:49 2024 +0200 +++ b/OrthancServer/Sources/ServerIndex.cpp Wed May 08 10:30:57 2024 +0200 @@ -185,16 +185,17 @@ } }; - virtual void MarkAsUnstable(int64_t id, - Orthanc::ResourceType type, + virtual void MarkAsUnstable(ResourceType type, + int64_t id, const std::string& publicId) ORTHANC_OVERRIDE { - context_.GetIndex().MarkAsUnstable(id, type, publicId); + context_.GetIndex().MarkAsUnstable(type, id, publicId); } - virtual bool IsUnstableResource(int64_t id) ORTHANC_OVERRIDE + virtual bool IsUnstableResource(ResourceType type, + int64_t id) ORTHANC_OVERRIDE { - return context_.GetIndex().IsUnstableResource(id); + return context_.GetIndex().IsUnstableResource(type, id); } virtual void Commit() ORTHANC_OVERRIDE @@ -239,18 +240,15 @@ class ServerIndex::UnstableResourcePayload { private: - ResourceType type_; std::string publicId_; boost::posix_time::ptime time_; public: - UnstableResourcePayload() : type_(ResourceType_Instance) + UnstableResourcePayload() { } - UnstableResourcePayload(Orthanc::ResourceType type, - const std::string& publicId) : - type_(type), + explicit UnstableResourcePayload(const std::string& publicId) : publicId_(publicId), time_(boost::posix_time::second_clock::local_time()) { @@ -260,11 +258,6 @@ { return (boost::posix_time::second_clock::local_time() - time_).total_seconds(); } - - ResourceType GetResourceType() const - { - return type_; - } const std::string& GetPublicId() const { @@ -309,10 +302,11 @@ } - bool ServerIndex::IsUnstableResource(int64_t id) + bool ServerIndex::IsUnstableResource(ResourceType type, + int64_t id) { boost::mutex::scoped_lock lock(monitoringMutex_); - return unstableResources_.Contains(id); + return unstableResources_.Contains(std::make_pair(type, id)); } @@ -460,7 +454,8 @@ for (;;) { - UnstableResourcePayload stableResource; + UnstableResourcePayload stablePayload; + ResourceType stableLevel; int64_t stableId; { @@ -471,8 +466,10 @@ { // This DICOM resource has not received any new instance for // some time. It can be considered as stable. - stableId = that->unstableResources_.RemoveOldest(stableResource); - //LOG(TRACE) << "Stable resource: " << EnumerationToString(stableResource.GetResourceType()) << " " << stableId; + std::pair<ResourceType, int64_t> stableResource = that->unstableResources_.RemoveOldest(stablePayload); + stableLevel = stableResource.first; + stableId = stableResource.second; + //LOG(TRACE) << "Stable resource: " << EnumerationToString(stablePayload.GetResourceType()) << " " << stableId; } else { @@ -490,18 +487,18 @@ * another thread, which leads to calls to "MarkAsUnstable()", * which leads to two lockings of "monitoringMutex_"). **/ - switch (stableResource.GetResourceType()) + switch (stableLevel) { case ResourceType_Patient: - that->LogChange(stableId, ChangeType_StablePatient, stableResource.GetPublicId(), ResourceType_Patient); + that->LogChange(stableId, ChangeType_StablePatient, stablePayload.GetPublicId(), ResourceType_Patient); break; case ResourceType_Study: - that->LogChange(stableId, ChangeType_StableStudy, stableResource.GetPublicId(), ResourceType_Study); + that->LogChange(stableId, ChangeType_StableStudy, stablePayload.GetPublicId(), ResourceType_Study); break; case ResourceType_Series: - that->LogChange(stableId, ChangeType_StableSeries, stableResource.GetPublicId(), ResourceType_Series); + that->LogChange(stableId, ChangeType_StableSeries, stablePayload.GetPublicId(), ResourceType_Series); break; default: @@ -519,18 +516,18 @@ } - void ServerIndex::MarkAsUnstable(int64_t id, - Orthanc::ResourceType type, + void ServerIndex::MarkAsUnstable(ResourceType type, + int64_t id, const std::string& publicId) { - assert(type == Orthanc::ResourceType_Patient || - type == Orthanc::ResourceType_Study || - type == Orthanc::ResourceType_Series); + assert(type == ResourceType_Patient || + type == ResourceType_Study || + type == ResourceType_Series); { boost::mutex::scoped_lock lock(monitoringMutex_); - UnstableResourcePayload payload(type, publicId); - unstableResources_.AddOrMakeMostRecent(id, payload); + UnstableResourcePayload payload(publicId); + unstableResources_.AddOrMakeMostRecent(std::make_pair(type, id), payload); //LOG(INFO) << "Unstable resource: " << EnumerationToString(type) << " " << id; } }
--- a/OrthancServer/Sources/ServerIndex.h Wed May 08 07:09:49 2024 +0200 +++ b/OrthancServer/Sources/ServerIndex.h Wed May 08 10:30:57 2024 +0200 @@ -43,7 +43,7 @@ boost::thread flushThread_; boost::thread unstableResourcesMonitorThread_; - LeastRecentlyUsedIndex<int64_t, UnstableResourcePayload> unstableResources_; + LeastRecentlyUsedIndex<std::pair<ResourceType, int64_t>, UnstableResourcePayload> unstableResources_; MaxStorageMode maximumStorageMode_; uint64_t maximumStorageSize_; @@ -55,11 +55,12 @@ static void UnstableResourcesMonitorThread(ServerIndex* that, unsigned int threadSleep); - void MarkAsUnstable(int64_t id, - Orthanc::ResourceType type, + void MarkAsUnstable(ResourceType type, + int64_t id, const std::string& publicId); - bool IsUnstableResource(int64_t id); + bool IsUnstableResource(ResourceType type, + int64_t id); public: ServerIndex(ServerContext& context,