# HG changeset patch # User Sebastien Jodogne # Date 1547130302 -3600 # Node ID b96446b8718ba9998abd52b283a85a5506fc0143 # Parent ff2d56d37bfd8c2eb7a32e3683f6a6a783765bd6 Fix serialization of jobs if many of them diff -r ff2d56d37bfd -r b96446b8718b MySQL/NEWS --- 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) diff -r ff2d56d37bfd -r b96446b8718b MySQL/Plugins/MySQLIndex.cpp --- 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);