changeset 84:b96446b8718b

Fix serialization of jobs if many of them
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 10 Jan 2019 15:25:02 +0100
parents ff2d56d37bfd
children d16e94157efe 1bd538a5a783
files MySQL/NEWS MySQL/Plugins/MySQLIndex.cpp
diffstat 2 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MySQL/NEWS	Thu Jan 10 14:51:51 2019 +0100
+++ b/MySQL/NEWS	Thu Jan 10 15:25:02 2019 +0100
@@ -2,6 +2,7 @@
 ===============================
 
 * Characters "$" and "_" are allowed in MySQL database identifiers
+* Fix serialization of jobs if many of them
 
 
 Release 1.1 (2018-07-18)
--- a/MySQL/Plugins/MySQLIndex.cpp	Thu Jan 10 14:51:51 2019 +0100
+++ b/MySQL/Plugins/MySQLIndex.cpp	Thu Jan 10 15:25:02 2019 +0100
@@ -116,7 +116,19 @@
         SetGlobalIntegerProperty(*db, t, Orthanc::GlobalProperty_DatabasePatchLevel, revision);
       }
 
-      if (revision != 1)
+      if (revision == 1)
+      {
+        // The serialization of jobs as a global property can lead to
+        // very long values => switch to the LONGTEXT type that can
+        // store up to 4GB:
+        // https://stackoverflow.com/a/13932834/881731
+        db->Execute("ALTER TABLE GlobalProperties MODIFY value LONGTEXT", false);
+
+        revision = 2;
+        SetGlobalIntegerProperty(*db, t, Orthanc::GlobalProperty_DatabasePatchLevel, revision);
+      }
+
+      if (revision != 2)
       {
         LOG(ERROR) << "MySQL plugin is incompatible with database schema revision: " << revision;
         throw Orthanc::OrthancException(Orthanc::ErrorCode_Database);