diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-01-25 16:29:00 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-02-06 08:38:08 +0100 |
commit | 9b84aff4b68c3cef3328c85ac12418048b169cee (patch) | |
tree | 7014f685e6a8c850f0be7965e1e656d3de72a15d /tests | |
parent | 0a0c197ed487c343675b62dff8456932c8d5ff7f (diff) | |
download | sink-9b84aff4b68c3cef3328c85ac12418048b169cee.tar.gz sink-9b84aff4b68c3cef3328c85ac12418048b169cee.zip |
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).
Diffstat (limited to 'tests')
-rw-r--r-- | tests/interresourcemovetest.cpp | 3 | ||||
-rw-r--r-- | tests/mailsynctest.cpp | 2 | ||||
-rw-r--r-- | tests/mailtest.cpp | 10 |
3 files changed, 4 insertions, 11 deletions
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: | |||
106 | auto list = Sink::Store::read<Mail>(query.filter<Mail::MessageId>(testuid)); | 106 | auto list = Sink::Store::read<Mail>(query.filter<Mail::MessageId>(testuid)); |
107 | QCOMPARE(list.size(), 1); | 107 | QCOMPARE(list.size(), 1); |
108 | const auto mail = list.first(); | 108 | const auto mail = list.first(); |
109 | QVERIFY(!mail.getMimeMessagePath().isEmpty()); | ||
110 | QCOMPARE(mail.getSubject(), subject); | 109 | QCOMPARE(mail.getSubject(), subject); |
111 | QCOMPARE(mail.getMimeMessage(), mimeMessage); | 110 | QCOMPARE(mail.getMimeMessage(), mimeMessage); |
112 | } | 111 | } |
@@ -153,7 +152,6 @@ private slots: | |||
153 | auto list = Sink::Store::read<Mail>(query.filter<Mail::MessageId>(testuid)); | 152 | auto list = Sink::Store::read<Mail>(query.filter<Mail::MessageId>(testuid)); |
154 | QCOMPARE(list.size(), 1); | 153 | QCOMPARE(list.size(), 1); |
155 | const auto mail = list.first(); | 154 | const auto mail = list.first(); |
156 | QVERIFY(!mail.getMimeMessagePath().isEmpty()); | ||
157 | QCOMPARE(mail.getSubject(), subject); | 155 | QCOMPARE(mail.getSubject(), subject); |
158 | QCOMPARE(mail.getMimeMessage(), mimeMessage); | 156 | QCOMPARE(mail.getMimeMessage(), mimeMessage); |
159 | } | 157 | } |
@@ -164,7 +162,6 @@ private slots: | |||
164 | auto list = Sink::Store::read<Mail>(query.filter<Mail::MessageId>(testuid)); | 162 | auto list = Sink::Store::read<Mail>(query.filter<Mail::MessageId>(testuid)); |
165 | QCOMPARE(list.size(), 1); | 163 | QCOMPARE(list.size(), 1); |
166 | const auto mail = list.first(); | 164 | const auto mail = list.first(); |
167 | QVERIFY(!mail.getMimeMessagePath().isEmpty()); | ||
168 | QCOMPARE(mail.getSubject(), subject); | 165 | QCOMPARE(mail.getSubject(), subject); |
169 | QCOMPARE(mail.getMimeMessage(), mimeMessage); | 166 | QCOMPARE(mail.getMimeMessage(), mimeMessage); |
170 | } | 167 | } |
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() | |||
318 | ASYNCCOMPARE(mails.size(), 1); | 318 | ASYNCCOMPARE(mails.size(), 1); |
319 | auto mail = mails.first(); | 319 | auto mail = mails.first(); |
320 | ASYNCVERIFY(!mail->getSubject().isEmpty()); | 320 | ASYNCVERIFY(!mail->getSubject().isEmpty()); |
321 | ASYNCVERIFY(!mail->getMimeMessagePath().isEmpty()); | 321 | ASYNCVERIFY(!mail->getMimeMessage().isEmpty()); |
322 | return KAsync::null(); | 322 | return KAsync::null(); |
323 | }); | 323 | }); |
324 | VERIFYEXEC(job); | 324 | 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() | |||
164 | auto mail = *mails.first(); | 164 | auto mail = *mails.first(); |
165 | QCOMPARE(mail.getSubject(), subject); | 165 | QCOMPARE(mail.getSubject(), subject); |
166 | QCOMPARE(mail.getFolder(), folder.identifier()); | 166 | QCOMPARE(mail.getFolder(), folder.identifier()); |
167 | QVERIFY(QFile(mail.getMimeMessagePath()).exists()); | ||
168 | KMime::Message m; | 167 | KMime::Message m; |
169 | m.setContent(KMime::CRLFtoLF(mail.getMimeMessage())); | 168 | m.setContent(KMime::CRLFtoLF(mail.getMimeMessage())); |
170 | m.parse(); | 169 | m.parse(); |
@@ -193,7 +192,6 @@ void MailTest::testCreateModifyDeleteMail() | |||
193 | auto mail = *mails.first(); | 192 | auto mail = *mails.first(); |
194 | QCOMPARE(mail.getSubject(), subject2); | 193 | QCOMPARE(mail.getSubject(), subject2); |
195 | QCOMPARE(mail.getFolder(), folder.identifier()); | 194 | QCOMPARE(mail.getFolder(), folder.identifier()); |
196 | QVERIFY(QFile(mail.getMimeMessagePath()).exists()); | ||
197 | KMime::Message m; | 195 | KMime::Message m; |
198 | m.setContent(KMime::CRLFtoLF(mail.getMimeMessage())); | 196 | m.setContent(KMime::CRLFtoLF(mail.getMimeMessage())); |
199 | m.parse(); | 197 | m.parse(); |
@@ -251,8 +249,7 @@ void MailTest::testMoveMail() | |||
251 | auto mail = *mails.first(); | 249 | auto mail = *mails.first(); |
252 | modifiedMail = mail; | 250 | modifiedMail = mail; |
253 | QCOMPARE(mail.getFolder(), folder.identifier()); | 251 | QCOMPARE(mail.getFolder(), folder.identifier()); |
254 | SinkWarning() << "path: " << mail.getMimeMessagePath(); | 252 | QVERIFY(!mail.getMimeMessage().isEmpty()); |
255 | QVERIFY(QFile(mail.getMimeMessagePath()).exists()); | ||
256 | }); | 253 | }); |
257 | VERIFYEXEC(job); | 254 | VERIFYEXEC(job); |
258 | } | 255 | } |
@@ -269,8 +266,7 @@ void MailTest::testMoveMail() | |||
269 | QCOMPARE(mails.size(), 1); | 266 | QCOMPARE(mails.size(), 1); |
270 | auto mail = *mails.first(); | 267 | auto mail = *mails.first(); |
271 | QCOMPARE(mail.getFolder(), folder1.identifier()); | 268 | QCOMPARE(mail.getFolder(), folder1.identifier()); |
272 | QVERIFY(QFile(mail.getMimeMessagePath()).exists()); | 269 | QVERIFY(!mail.getMimeMessage().isEmpty()); |
273 | SinkTrace() << "Mime message path: " << mail.getMimeMessagePath(); | ||
274 | }); | 270 | }); |
275 | VERIFYEXEC(job); | 271 | VERIFYEXEC(job); |
276 | } | 272 | } |
@@ -324,7 +320,7 @@ void MailTest::testMarkMailAsRead() | |||
324 | auto mail = mails.first(); | 320 | auto mail = mails.first(); |
325 | ASYNCVERIFY(!mail->getSubject().isEmpty()); | 321 | ASYNCVERIFY(!mail->getSubject().isEmpty()); |
326 | ASYNCCOMPARE(mail->getUnread(), false); | 322 | ASYNCCOMPARE(mail->getUnread(), false); |
327 | ASYNCVERIFY(QFileInfo(mail->getMimeMessagePath()).exists()); | 323 | ASYNCVERIFY(!mail->getMimeMessage().isEmpty()); |
328 | return KAsync::null<void>(); | 324 | return KAsync::null<void>(); |
329 | }); | 325 | }); |
330 | VERIFYEXEC(job2); | 326 | VERIFYEXEC(job2); |