Mercurial > hg > orthanc-databases
comparison Framework/Plugins/IndexUnitTests.h @ 289:0868500060f3
Fix serialization of large jobs
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 30 Jun 2021 08:19:52 +0200 |
parents | 6d4d413a8797 |
children | 2447c290fc73 |
comparison
equal
deleted
inserted
replaced
288:6d4d413a8797 | 289:0868500060f3 |
---|---|
521 db.DeleteResource(*output, *manager, p2); | 521 db.DeleteResource(*output, *manager, p2); |
522 ASSERT_TRUE(db.SelectPatientToRecycle(r, *manager, p3)); | 522 ASSERT_TRUE(db.SelectPatientToRecycle(r, *manager, p3)); |
523 ASSERT_EQ(p1, r); | 523 ASSERT_EQ(p1, r); |
524 | 524 |
525 { | 525 { |
526 // Test creating a large property of 16MB | 526 // Test creating a large property of 16MB (large properties are |
527 // notably necessary to serialize jobs) | |
527 // https://groups.google.com/g/orthanc-users/c/1Y3nTBdr0uE/m/K7PA5pboAgAJ | 528 // https://groups.google.com/g/orthanc-users/c/1Y3nTBdr0uE/m/K7PA5pboAgAJ |
528 std::string longProperty; | 529 std::string longProperty; |
529 longProperty.resize(16 * 1024 * 1024); | 530 longProperty.resize(16 * 1024 * 1024); |
530 for (size_t i = 0; i < longProperty.size(); i++) | 531 for (size_t i = 0; i < longProperty.size(); i++) |
531 { | 532 { |
532 longProperty[i] = 'A' + (i % 26); | 533 longProperty[i] = 'A' + (i % 26); |
533 } | 534 } |
534 | 535 |
535 db.SetGlobalProperty(*manager, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabaseInternal8, longProperty.c_str()); | 536 db.SetGlobalProperty(*manager, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabaseInternal8, longProperty.c_str()); |
536 | 537 |
538 // The following line fails on MySQL 4.0 because the "value" | |
539 // column in "ServerProperties" is "TEXT" instead of "LONGTEXT" | |
540 db.SetGlobalProperty(*manager, "some-server", Orthanc::GlobalProperty_DatabaseInternal8, longProperty.c_str()); | |
541 | |
537 std::string tmp; | 542 std::string tmp; |
538 ASSERT_TRUE(db.LookupGlobalProperty(tmp, *manager, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabaseInternal8)); | 543 ASSERT_TRUE(db.LookupGlobalProperty(tmp, *manager, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabaseInternal8)); |
539 ASSERT_EQ(longProperty, tmp); | 544 ASSERT_EQ(longProperty, tmp); |
545 | |
546 tmp.clear(); | |
547 ASSERT_TRUE(db.LookupGlobalProperty(tmp, *manager, "some-server", Orthanc::GlobalProperty_DatabaseInternal8)); | |
548 ASSERT_EQ(longProperty, tmp); | |
540 } | 549 } |
541 | 550 |
542 manager->Close(); | 551 manager->Close(); |
543 } | 552 } |