Mercurial > hg > orthanc-databases
comparison MySQL/Plugins/MySQLIndex.cpp @ 289:0868500060f3
Fix serialization of large jobs
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 30 Jun 2021 08:19:52 +0200 |
parents | 29d2b76516f6 |
children | 2790bafe3b3d |
comparison
equal
deleted
inserted
replaced
288:6d4d413a8797 | 289:0868500060f3 |
---|---|
259 revision = 5; | 259 revision = 5; |
260 SetGlobalIntegerProperty(manager, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabasePatchLevel, revision); | 260 SetGlobalIntegerProperty(manager, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabasePatchLevel, revision); |
261 | 261 |
262 t.Commit(); | 262 t.Commit(); |
263 } | 263 } |
264 | 264 |
265 if (revision != 5) | 265 if (revision == 5) |
266 { | |
267 // Added new table "ServerProperties" since release 4.0 to deal with multiple writers | |
268 DatabaseManager::Transaction t(manager, TransactionType_ReadWrite); | |
269 | |
270 if (t.GetDatabaseTransaction().DoesTableExist("ServerProperties")) | |
271 { | |
272 /** | |
273 * Patch for MySQL plugin 4.0, where the column "value" was | |
274 * "TEXT" instead of "LONGTEXT", which prevented | |
275 * serialization of large jobs. This was giving error "MySQL | |
276 * error (1406,22001): Data too long for column 'value' at | |
277 * row 1" after log message "Serializing the content of the | |
278 * jobs engine" (in --trace mode). | |
279 * https://groups.google.com/g/orthanc-users/c/1Y3nTBdr0uE/m/K7PA5pboAgAJ | |
280 **/ | |
281 t.GetDatabaseTransaction().ExecuteMultiLines("ALTER TABLE ServerProperties MODIFY value LONGTEXT"); | |
282 } | |
283 else | |
284 { | |
285 t.GetDatabaseTransaction().ExecuteMultiLines("CREATE TABLE ServerProperties(server VARCHAR(64) NOT NULL, " | |
286 "property INTEGER, value LONGTEXT, PRIMARY KEY(server, property))"); | |
287 } | |
288 | |
289 // Revision 6 indicates that "value" of "ServerProperties" is | |
290 // "LONGTEXT", whereas revision 5 corresponds to "TEXT" | |
291 revision = 6; | |
292 SetGlobalIntegerProperty(manager, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabasePatchLevel, revision); | |
293 | |
294 t.Commit(); | |
295 } | |
296 | |
297 if (revision != 6) | |
266 { | 298 { |
267 LOG(ERROR) << "MySQL plugin is incompatible with database schema revision: " << revision; | 299 LOG(ERROR) << "MySQL plugin is incompatible with database schema revision: " << revision; |
268 throw Orthanc::OrthancException(Orthanc::ErrorCode_Database); | 300 throw Orthanc::OrthancException(Orthanc::ErrorCode_Database); |
269 } | |
270 | |
271 | |
272 { | |
273 // New in release 4.0 to deal with multiple writers | |
274 DatabaseManager::Transaction t(manager, TransactionType_ReadWrite); | |
275 | |
276 if (!t.GetDatabaseTransaction().DoesTableExist("ServerProperties")) | |
277 { | |
278 t.GetDatabaseTransaction().ExecuteMultiLines("CREATE TABLE ServerProperties(server VARCHAR(64) NOT NULL, " | |
279 "property INTEGER, value TEXT, PRIMARY KEY(server, property))"); | |
280 } | |
281 | |
282 t.Commit(); | |
283 } | 301 } |
284 } | 302 } |
285 | 303 |
286 | 304 |
287 /** | 305 /** |