From 9b84aff4b68c3cef3328c85ac12418048b169cee Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 25 Jan 2018 16:29:00 +0100 Subject: Store all BLOB properties inline. BLOB properties had a couple of intended purposes: * Allow large payloads to be streamed directly to disk, and then be handled by reference. * Allow zero-copy handling. * Keep the database values compact so we can avoid traversing large BLOBS. However, they came at the cost of code-complexity, and we lost all the benefits of our storage layer, such as transactions. Measurements showed, that for email (the intended primary usecase), the overhead is hardly measurable, with most parts performing better, or at least not worse. We additionally also gain file-system independence, which may help on other platforms. The biggest drawback is probably that large payloads need to be written to disk twice, because of the synchronizer queue (once for the queue, once for the actual data). --- tests/interresourcemovetest.cpp | 3 --- tests/mailsynctest.cpp | 2 +- tests/mailtest.cpp | 10 +++------- 3 files changed, 4 insertions(+), 11 deletions(-) (limited to 'tests') diff --git a/tests/interresourcemovetest.cpp b/tests/interresourcemovetest.cpp index 174befc..37e040e 100644 --- a/tests/interresourcemovetest.cpp +++ b/tests/interresourcemovetest.cpp @@ -106,7 +106,6 @@ private slots: auto list = Sink::Store::read(query.filter(testuid)); QCOMPARE(list.size(), 1); const auto mail = list.first(); - QVERIFY(!mail.getMimeMessagePath().isEmpty()); QCOMPARE(mail.getSubject(), subject); QCOMPARE(mail.getMimeMessage(), mimeMessage); } @@ -153,7 +152,6 @@ private slots: auto list = Sink::Store::read(query.filter(testuid)); QCOMPARE(list.size(), 1); const auto mail = list.first(); - QVERIFY(!mail.getMimeMessagePath().isEmpty()); QCOMPARE(mail.getSubject(), subject); QCOMPARE(mail.getMimeMessage(), mimeMessage); } @@ -164,7 +162,6 @@ private slots: auto list = Sink::Store::read(query.filter(testuid)); QCOMPARE(list.size(), 1); const auto mail = list.first(); - QVERIFY(!mail.getMimeMessagePath().isEmpty()); QCOMPARE(mail.getSubject(), subject); QCOMPARE(mail.getMimeMessage(), mimeMessage); } diff --git a/tests/mailsynctest.cpp b/tests/mailsynctest.cpp index 811eace..764b006 100644 --- a/tests/mailsynctest.cpp +++ b/tests/mailsynctest.cpp @@ -318,7 +318,7 @@ void MailSyncTest::testResyncMails() ASYNCCOMPARE(mails.size(), 1); auto mail = mails.first(); ASYNCVERIFY(!mail->getSubject().isEmpty()); - ASYNCVERIFY(!mail->getMimeMessagePath().isEmpty()); + ASYNCVERIFY(!mail->getMimeMessage().isEmpty()); return KAsync::null(); }); VERIFYEXEC(job); diff --git a/tests/mailtest.cpp b/tests/mailtest.cpp index 1c24268..88cacd2 100644 --- a/tests/mailtest.cpp +++ b/tests/mailtest.cpp @@ -164,7 +164,6 @@ void MailTest::testCreateModifyDeleteMail() auto mail = *mails.first(); QCOMPARE(mail.getSubject(), subject); QCOMPARE(mail.getFolder(), folder.identifier()); - QVERIFY(QFile(mail.getMimeMessagePath()).exists()); KMime::Message m; m.setContent(KMime::CRLFtoLF(mail.getMimeMessage())); m.parse(); @@ -193,7 +192,6 @@ void MailTest::testCreateModifyDeleteMail() auto mail = *mails.first(); QCOMPARE(mail.getSubject(), subject2); QCOMPARE(mail.getFolder(), folder.identifier()); - QVERIFY(QFile(mail.getMimeMessagePath()).exists()); KMime::Message m; m.setContent(KMime::CRLFtoLF(mail.getMimeMessage())); m.parse(); @@ -251,8 +249,7 @@ void MailTest::testMoveMail() auto mail = *mails.first(); modifiedMail = mail; QCOMPARE(mail.getFolder(), folder.identifier()); - SinkWarning() << "path: " << mail.getMimeMessagePath(); - QVERIFY(QFile(mail.getMimeMessagePath()).exists()); + QVERIFY(!mail.getMimeMessage().isEmpty()); }); VERIFYEXEC(job); } @@ -269,8 +266,7 @@ void MailTest::testMoveMail() QCOMPARE(mails.size(), 1); auto mail = *mails.first(); QCOMPARE(mail.getFolder(), folder1.identifier()); - QVERIFY(QFile(mail.getMimeMessagePath()).exists()); - SinkTrace() << "Mime message path: " << mail.getMimeMessagePath(); + QVERIFY(!mail.getMimeMessage().isEmpty()); }); VERIFYEXEC(job); } @@ -324,7 +320,7 @@ void MailTest::testMarkMailAsRead() auto mail = mails.first(); ASYNCVERIFY(!mail->getSubject().isEmpty()); ASYNCCOMPARE(mail->getUnread(), false); - ASYNCVERIFY(QFileInfo(mail->getMimeMessagePath()).exists()); + ASYNCVERIFY(!mail->getMimeMessage().isEmpty()); return KAsync::null(); }); VERIFYEXEC(job2); -- cgit v1.2.3