RE: feature request: prevent linking of email

2021-03-17 Thread Marc
> 
> diff --git a/src/lib-storage/index/dbox-multi/mdbox-save.c b/src/lib-
> storage/index/dbox-multi/mdbox-save.c
> index ff6e4f77b0..b522951b1d 100644
> --- a/src/lib-storage/index/dbox-multi/mdbox-save.c
> +++ b/src/lib-storage/index/dbox-multi/mdbox-save.c
> @@ -440,7 +440,7 @@ int mdbox_copy(struct mail_save_context *_ctx,
> struct mail *mail)
> ctx->ctx.finished = TRUE;
> 
> if (mail->box->storage != _ctx->transaction->box->storage ||
> -   _ctx->transaction->box->disable_reflink_copy_to)
> +   _ctx->transaction->box->disable_reflink_copy_to || TRUE)
> return mail_storage_copy(_ctx, mail);
> src_mbox = MDBOX_MAILBOX(mail->box);

I think you also have to adapt doveadm force-resync so it convert links to 
copies of old emails.



RE: feature request: prevent linking of email

2021-03-17 Thread Marc
> 
> mdbox is intended to be high performance mail storage, and this would
> make copying significantly slower.

1. But copying does not happen that often.
2. You already have this copy between namespaces (with different storage)
3. If this really is an issue you could also use a command to schedule the 
copying, first a link, and then run some command like doveadm purge to convert 
the link into a copy.


> If you care more about reliability,
> maybe switch to sdbox or maildir instead?

sdbox and maildir is having that mails are stored as individual files. If you 
use ceph for distributed storage, you will create a considerable storage 
overhead when storing these small files. 
Currently I am using the mdbox_rotate_size = 4M this so it is matching the 
default chunk/stripe size of ceph. 

> It would be easy enough to patch though:
> 
> diff --git a/src/lib-storage/index/dbox-multi/mdbox-save.c b/src/lib-
> storage/index/dbox-multi/mdbox-save.c
> index ff6e4f77b0..b522951b1d 100644
> --- a/src/lib-storage/index/dbox-multi/mdbox-save.c
> +++ b/src/lib-storage/index/dbox-multi/mdbox-save.c
> @@ -440,7 +440,7 @@ int mdbox_copy(struct mail_save_context *_ctx,
> struct mail *mail)
> ctx->ctx.finished = TRUE;
> 
> if (mail->box->storage != _ctx->transaction->box->storage ||
> -   _ctx->transaction->box->disable_reflink_copy_to)
> +   _ctx->transaction->box->disable_reflink_copy_to || TRUE)
> return mail_storage_copy(_ctx, mail);
> src_mbox = MDBOX_MAILBOX(mail->box);

I would offer a config option:

mdbox_message_linking = no (copy message on request)
mdbox_message_linking = delayed (schedule the copying of messages)

:)




Re: feature request: prevent linking of email

2021-03-17 Thread Timo Sirainen
On 17. Mar 2021, at 13.39, Marc  wrote:
> 
> The reason for copying an email to a different folder is that it is 
> important. You do not want to loose it, and you want to be able to find it 
> there.
> It is wrong to assume that a user will notice that these emails are missing 
> and should look for them elsewhere. 
> Say you have folder for a court case, and you copy emails there relevant for 
> the court case. How can you ever know after a restore that a few email are 
> missing from the folder, and which ones.
> 
> I think it is bad this email is currently 'lost'. I rather have an option in 
> dovecot that disables this hidden 'deduplication' feature. I think this 
> should be the default setting also.
> 
> This current deduplication feature also is hazardous because if this one copy 
> of the email gets corrupted on the storage, you have no copies left. That is 
> exactly the opposite of what user wants to accomplish with creating a copy.
> 
> Feature request: disable this automatic linking of emails between mailboxes.
> Feature request: set this as a default.

mdbox is intended to be high performance mail storage, and this would make 
copying significantly slower. If you care more about reliability, maybe switch 
to sdbox or maildir instead?

It would be easy enough to patch though:

diff --git a/src/lib-storage/index/dbox-multi/mdbox-save.c 
b/src/lib-storage/index/dbox-multi/mdbox-save.c
index ff6e4f77b0..b522951b1d 100644
--- a/src/lib-storage/index/dbox-multi/mdbox-save.c
+++ b/src/lib-storage/index/dbox-multi/mdbox-save.c
@@ -440,7 +440,7 @@ int mdbox_copy(struct mail_save_context *_ctx, struct mail 
*mail)
ctx->ctx.finished = TRUE;

if (mail->box->storage != _ctx->transaction->box->storage ||
-   _ctx->transaction->box->disable_reflink_copy_to)
+   _ctx->transaction->box->disable_reflink_copy_to || TRUE)
return mail_storage_copy(_ctx, mail);
src_mbox = MDBOX_MAILBOX(mail->box);