Re: Custom map for quota

2024-01-14 Thread John Fawcett

On 15/01/2024 01:10, m87562...@gmail.com wrote:
 John Fawcett wrote:
  On 13/01/2024 14:01, Matt wrote:
   Hi,
   I'm trying to setup quota with the following
   layout
   CREATE TABLE "domain" (
   "id" INTEGER,
   "name" TEXT,
   "active" INTEGER DEFAULT 0,
   PRIMARY KEY("id"),
   UNIQUE("name")
   )
   CREATE TABLE "address" (
   "id" INTEGER,
   "localpart" TEXT NOT NULL,
   "domain_id" INTEGER NOT NULL,
   PRIMARY KEY("id"),
   UNIQUE("localpart","domain_id")
   )
   CREATE TABLE "mailbox" (
        "id" INTEGER,
   "address_id" INTEGER,
   "active" INTEGER DEFAULT 0,
   "password" TEXT,
   "quota_bytes" INTEGER DEFAULT 0,
   PRIMARY KEY("id")
   )
   As I like to update the quota and I like to use a
   dict/map I'm not sure if I
   can update this following:
   map {
  pattern = priv/quota/storage
  table = maibox
  value_field = dummy
  fields {
    value_field = quota_bytes
    id = mailbox_id
  }
   mailbox_id will be queried using password_query
   using: "mailbox.id as
   mailbox_id"
   Using such map I hope to be able to use:
   SELECT quota_bytes FROM mailbox WHERE id =
   '$mailbox_id'
   INSERT INTO mailbox (quota_bytes) VALUES
   ('$value') ON DUPLICATE KEY UPDATE
   quota_bytes='$value'
   Can someone help me with this ?
   Hi Matt
 Hi John, thank you very much for reaching out to me with your clear
 explanation, I will respond below your quoted text.
  as far as I know the quota plugin with the dict backend
  requires you to
  configure the name of your username field in the map. The
  usual way to
  configure it is to have a quota table like in the
  documentation.
  https://doc.dovecot.org/configuration_manual/quota/
  quota_dict/
  In your case where you don't have a username field in the
  table that
  stores the quotas, then depending on your database, you may
  be able to
  create a view that does include the username and configure
  that in Dovecot.
 Yes, the idea was a view from my side as well but as I try to keep
 things as clean as possible I didn't mention it yet, also because -
 you say later on in your reply - quota_dict is deprecated so I
 already implemented "count" but was not sure about quota_clone as I
 assumed I needed Redis because the manual said as "more complex
 example" dict in the MySQL part so I was confused and thought to
 implement Redis because of it; it seems I can put in almost any
 backend that uses dict it seems.

 https://doc.dovecot.org/configuration_manual/quota_clone_plugin
  The quota plugin updates the values of two fields holding
  the number of
  messages and the number of bytes used. I noticed you don't
  have the
  messages field. I suggest to add it.
 I know, I copied that part from the documentation when trying to find
 a sane config; messages will be added but thank for you notice when
 people read this thread later on. (I lots of them confused me all the
 time as this was not a major one for me actually - point taken!)

 https://doc.dovecot.org/configuration_manual/dict/#dict-sql
  You shouldn't need to write any queries to update the
  quota: Dovecot
  will generate the queries.
 True and that is what I like so the question remains what to do here,
 a dict for Mysql with a view should do the trick I believe to
 understand ?
  On a final note, before you invest time in this, it may be
  worthwhile
  keeping an eye on the future plans
  https://doc.dovecot.org/3.0/installation_guide/upgrading/
  from-2.3-to-3.0/
 Thanks for that! As I wasn't upgrading (yet) I could not find any
 roadmap; this is what I needed!
  You could use the count backend with quota plugin (which is
  the
  recommended backend for new installations) and then use the
  quota_clone
  plugin to keep your database in sync.
 Indeed, but this will be a map in combination with a (SQL) dict and
 the bespoken view in my DBMS ?
  John
 Matt
If you've already got quota working in count and you need the values available
in Mysql then the easist way to go is to use quota clone plugin. It's not
limited to redis. You can use the dict 

Re: ARM support

2024-01-14 Thread Aki Tuomi via dovecot


> On 15/01/2024 08:20 EET Michael Tokarev  wrote:
> 
>  
> 14.01.2024 17:46, peter+dovecot--- via dovecot:
> 
> > Isn't https://github.com/dovecot/docker the source for the official docker 
> > images?
> 
> Docker images of dovecot, most likely yes (I don't know).
> 
> /mjt

I ment Docker's official image library, which is bit different. We of course 
publish our own official images.

Aki
___
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org


Re: ARM support

2024-01-14 Thread Michael Tokarev

14.01.2024 18:39, Benny Pedersen:


dovecot developers do a repo, but debian maintainers could help arm64 
precompiled problem solving, why not ask ?


Well, debian doesn't work like that.

But once the package is in debian, you can ship either
the dockerfile or whole image using just the debian
components without any extra repository.

/mjt

___
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org


Re: ARM support

2024-01-14 Thread Michael Tokarev

14.01.2024 17:46, peter+dovecot--- via dovecot:


Isn't https://github.com/dovecot/docker the source for the official docker 
images?


Docker images of dovecot, most likely yes (I don't know).

/mjt
___
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org


Re: Custom map for quota

2024-01-14 Thread m87562378
John Fawcett wrote:
> On 13/01/2024 14:01, Matt wrote:
> > Hi,
> > I'm trying to setup quota with the following layout
> > CREATE TABLE "domain" (
> > "id" INTEGER,
> > "name" TEXT,
> > "active" INTEGER DEFAULT 0,
> > PRIMARY KEY("id"),
> > UNIQUE("name")
> > )
> > CREATE TABLE "address" (
> > "id" INTEGER,
> > "localpart" TEXT NOT NULL,
> > "domain_id" INTEGER NOT NULL,
> > PRIMARY KEY("id"),
> > UNIQUE("localpart","domain_id")
> > )
> > CREATE TABLE "mailbox" (
> >          "id" INTEGER,
> > "address_id" INTEGER,
> > "active" INTEGER DEFAULT 0,
> > "password" TEXT,
> > "quota_bytes" INTEGER DEFAULT 0,
> > PRIMARY KEY("id")
> > )
> > As I like to update the quota and I like to use a dict/map I'm not sure if I
> > can update this following:
> > map {
> >    pattern = priv/quota/storage
> >    table = maibox
> >    value_field = dummy
> >    fields {
> >      value_field = quota_bytes
> >      id = mailbox_id
> >    }
> > mailbox_id will be queried using password_query using: "mailbox.id as
> > mailbox_id"
> > Using such map I hope to be able to use:
> > SELECT quota_bytes FROM mailbox WHERE id = '$mailbox_id'
> > INSERT INTO mailbox (quota_bytes) VALUES ('$value') ON DUPLICATE KEY UPDATE
> > quota_bytes='$value'
> > Can someone help me with this ?
> > Hi Matt

Hi John, thank you very much for reaching out to me with your clear 
explanation, I will respond below your quoted text.

> as far as I know the quota plugin with the dict backend requires you to 
> configure the name of your username field in the map. The usual way to 
> configure it is to have a quota table like in the documentation.
> https://doc.dovecot.org/configuration_manual/quota/quota_dict/
> In your case where you don't have a username field in the table that 
> stores the quotas, then depending on your database, you may be able to 
> create a view that does include the username and configure that in Dovecot.

Yes, the idea was a view from my side as well but as I try to keep things as 
clean as possible I didn't mention it yet, also because - you say later on in 
your reply - quota_dict is deprecated so I already implemented "count" but was 
not sure about quota_clone as I assumed I needed Redis because the manual said 
as "more complex example" dict in the MySQL part so I was confused and thought 
to implement Redis because of it; it seems I can put in almost any backend that 
uses dict it seems.

https://doc.dovecot.org/configuration_manual/quota_clone_plugin

> The quota plugin updates the values of two fields holding the number of 
> messages and the number of bytes used. I noticed you don't have the 
> messages field. I suggest to add it.

I know, I copied that part from the documentation when trying to find a sane 
config; messages will be added but thank for you notice when people read this 
thread later on. (I lots of them confused me all the time as this was not a 
major one for me actually - point taken!)

https://doc.dovecot.org/configuration_manual/dict/#dict-sql

> You shouldn't need to write any queries to update the quota: Dovecot 
> will generate the queries.

True and that is what I like so the question remains what to do here, a dict 
for Mysql with a view should do the trick I believe to understand ?

> On a final note, before you invest time in this, it may be worthwhile 
> keeping an eye on the future plans
> https://doc.dovecot.org/3.0/installation_guide/upgrading/from-2.3-to-3.0/

Thanks for that! As I wasn't upgrading (yet) I could not find any roadmap; this 
is what I needed!

> You could use the count backend with quota plugin (which is the 
> recommended backend for new installations) and then use the quota_clone 
> plugin to keep your database in sync.

Indeed, but this will be a map in combination with a (SQL) dict and the 
bespoken view in my DBMS ?

> John

Matt
___
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org


Re: Custom map for quota

2024-01-14 Thread John Fawcett


On 13/01/2024 14:01, Matt wrote:

Hi,

I'm trying to setup quota with the following layout

CREATE TABLE "domain" (
"id" INTEGER,
"name" TEXT,
"active" INTEGER DEFAULT 0,
PRIMARY KEY("id"),
UNIQUE("name")
)

CREATE TABLE "address" (
"id" INTEGER,
"localpart" TEXT NOT NULL,
"domain_id" INTEGER NOT NULL,
PRIMARY KEY("id"),
UNIQUE("localpart","domain_id")
)

CREATE TABLE "mailbox" (
         "id" INTEGER,
"address_id" INTEGER,
"active" INTEGER DEFAULT 0,
"password" TEXT,
"quota_bytes" INTEGER DEFAULT 0,
PRIMARY KEY("id")
)

As I like to update the quota and I like to use a dict/map I'm not sure if I
can update this following:

map {
   pattern = priv/quota/storage
   table = maibox
   value_field = dummy
   fields {
     value_field = quota_bytes
     id = mailbox_id
   }


mailbox_id will be queried using password_query using: "mailbox.id as
mailbox_id"

Using such map I hope to be able to use:

SELECT quota_bytes FROM mailbox WHERE id = '$mailbox_id'
INSERT INTO mailbox (quota_bytes) VALUES ('$value') ON DUPLICATE KEY UPDATE
quota_bytes='$value'

Can someone help me with this ?


Hi Matt

as far as I know the quota plugin with the dict backend requires you to 
configure the name of your username field in the map. The usual way to 
configure it is to have a quota table like in the documentation.


https://doc.dovecot.org/configuration_manual/quota/quota_dict/

In your case where you don't have a username field in the table that 
stores the quotas, then depending on your database, you may be able to 
create a view that does include the username and configure that in Dovecot.


The quota plugin updates the values of two fields holding the number of 
messages and the number of bytes used. I noticed you don't have the 
messages field. I suggest to add it.


You shouldn't need to write any queries to update the quota: Dovecot 
will generate the queries.


On a final note, before you invest time in this, it may be worthwhile 
keeping an eye on the future plans


https://doc.dovecot.org/3.0/installation_guide/upgrading/from-2.3-to-3.0/

You could use the count backend with quota plugin (which is the 
recommended backend for new installations) and then use the quota_clone 
plugin to keep your database in sync.


John


___
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org


Re: Panic: file index-search-result.c: line 132 (index_search_result_update_flags): assertion failed: (result->search_args->args == _arg)

2024-01-14 Thread John Fawcett


On 09/01/2024 19:00, Markus Doits via dovecot wrote:


Am 03.01.24 um 10:14 schrieb Aki Tuomi:

namespace {
    prefix = _/
    separator = /
    location =
virtual:~/Maildir/virtual:LAYOUT=maildir++:INDEX=~/Maildir/virtual
}



You should not store virtual folders inside Maildir (assuming this is 
your mail location). Please use
~/virtual/ instead. The INDEX directive is not needed in this case as 
it points to same place anyways.


Thanks for your suggestion! I changed it and moved the virtual folders 
out of the Maildir manually:


```
location = virtual:~/virtual:LAYOUT=maildir++
```

Unfortunately the same panic ist still there.

I just noticed there is another panic with the same assertion and 
backtrace but a different file:


```
Panic: file index-search-result.c: line 174 
(index_search_result_update_appends): assertion failed: 
(result->search_args->args == _arg)

```

By the way there is nothing that seems to be broken (fts searching 
seems to work like it should), but the logs are filled with this 
panics and backtraces. 路‍♂️


Some more info: The panics happen after logging in (tested with 
Thunderbird, Roundcube, K-9 Mail on Android). I cannot trigger the 
panic when doing a fts search after login (e.g. on Thunderbird or K-9 
which holds the connection after login).


Hi Markus

my guess is that it has nothing to do with fts or flatcurve, but when 
index_search_result_update_flags is invoked from the virtual plugin.


From the comment in index_search_result_update_flags a search parameter 
is added in order to search for only changed messages. That parameter is 
added at the front of a linked list of search parameters and after a 
call to search_result_update_search, it is still expected to be there at 
the front of the list, but isn't. Presumably either another search 
parameter was added on the front of the linked list or the existing one 
was removed.


My suggestion would be to try and capture some debug logging if it is 
possible. If this is an error that other people haven't found, I am 
wondering if it's linked to soemthing specific in your dovecot-virtual 
file(s).


John


___
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org


Re: ARM support

2024-01-14 Thread Benny Pedersen

peter+dovecot--- via dovecot skrev den 2024-01-14 10:46:
I would be fantastic if dovecot could release arm64 debian packages to 
the community repo, as it would allow fixing a lot of downstream 
problems:

- release of official arm64 docker images
- fix other downstream docker images like docker mailserver and mailcow

It looks like arm64 is gaining a lot of traction with Apple M series 
cpus, AWS Graviton, Ampere on eg. Hetzner, etc.


As far as I understand the debian packaging setup is not public / 
available on https://github.com/dovecot


dovecot developers do a repo, but debian maintainers could help arm64 
precompiled problem solving, why not ask ?


i am gentoo user asking for cpanel :)

___
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org


Re: ARM support

2024-01-14 Thread peter+dovecot--- via dovecot

Thanks for your reply.

I'm now very confused. Looking at 
https://github.com/dovecot/docker/blob/main/2.3.21/Dockerfile this 
container clearly just installs the debian package from the community repo.


That's why I thought publishing a arm64 debian package would enable a 
arm64 docker image.


Isn't https://github.com/dovecot/docker the source for the official 
docker images?

___
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org


Re: ARM support

2024-01-14 Thread Michael Tokarev

14.01.2024 12:46, peter+dovecot--- via dovecot :

I would be fantastic if dovecot could release arm64 debian packages to the 
community repo, as it would allow fixing a lot of downstream problems:


Shouldn't debian packaging be part of debian, not dovecot?
Quite often (but definitely not always), upstream does not know
how to package for a given distribution, and the resulting
packages becomes quite a bit messy.  I'd expect debian to
prepare current packages of dovecot (for all architectures
it support), not dovecot itself...

/mjt
___
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org


Re: ARM support

2024-01-14 Thread Aki Tuomi via dovecot


> On 14/01/2024 11:46 EET peter+dovecot--- via dovecot  
> wrote:
> 
>  
> I would be fantastic if dovecot could release arm64 debian packages to 
> the community repo, as it would allow fixing a lot of downstream problems:
> - release of official arm64 docker images
> - fix other downstream docker images like docker mailserver and mailcow
> 

Unfortunately we haven't even gotten the AM64 docker image published officially 
yet. We have been waiting for action on this from Docker official images team 
for a long while now. So I doubt building arm64 packages would move this 
anywhere.

Aki
___
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org


Re: execute: /user/bin/checkpassword /user/libexec/dovecot/checkpassword-reply

2024-01-14 Thread Aki Tuomi via dovecot


> On 09/01/2024 17:45 EET Steve Button  wrote:
> 
>  
> Hi,
> 
> 
> 
> I have recently moved a dovecot installation from 2.2.36 on RHEL7.9 onto
> 2.3.20 on Amazon Linux 2023 and I'm now seeing the error message in the
> title relating to /usr/bin/checkpassword (which doesn't exist on either).
> This is a project that I've inherited, and I've never used dovecot
> previously. I've been searching around for a couple of days trying to
> figure this out. Running out of ideas.
> 
>

Hi!

Your checkpassword exists with code 84.

Jan 04 17:23:22 auth: Error:
checkpassword(redacted@redacted.redacted.local,127.0.0.1,<6uwL/SEOzpt/AAAB>):
Child 106455 exited with status 84

Maybe figure out why?

Aki
___
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org


Re: ARM support

2024-01-14 Thread peter+dovecot--- via dovecot
I would be fantastic if dovecot could release arm64 debian packages to 
the community repo, as it would allow fixing a lot of downstream problems:

- release of official arm64 docker images
- fix other downstream docker images like docker mailserver and mailcow

It looks like arm64 is gaining a lot of traction with Apple M series 
cpus, AWS Graviton, Ampere on eg. Hetzner, etc.


As far as I understand the debian packaging setup is not public / 
available on https://github.com/dovecot

___
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org


execute: /user/bin/checkpassword /user/libexec/dovecot/checkpassword-reply

2024-01-14 Thread Steve Button

Hi,

 

I have recently moved a dovecot installation from 2.2.36 on RHEL7.9 onto 2.3.20
on Amazon Linux 2023 and I'm now seeing the error message in the title relating
to /usr/bin/checkpassword (which doesn't exist on either). This is a project
that I've inherited, and I've never used dovecot previously. I've been
searching around for a couple of days trying to figure this out. Running out of
ideas.

 

Here's a slightly redacted snippet from dovecot.log

 

Jan 04 17:23:22 auth: Debug: checkpassword
(redacted@redacted.redacted.local,127.0.0.1,<6uwL/SEOzpt/AAAB>): Performing
passdb lookup

Jan 04 17:23:22 auth: Debug: checkpassword
(redacted@redacted.redacted.local,127.0.0.1,<6uwL/SEOzpt/AAAB>): execute: /usr/
bin/checkpassword /usr/libexec/dovecot/checkpassword-reply

Jan 04 17:23:22 auth: Fatal: execv(/usr/bin/checkpassword) failed: No such file
or directory

Jan 04 17:23:22 auth: Debug: checkpassword
(redacted@redacted.redacted.local,127.0.0.1,<6uwL/SEOzpt/AAAB>): Received
input:

Jan 04 17:23:22 auth: Debug: checkpassword
(redacted@redacted.redacted.local,127.0.0.1,<6uwL/SEOzpt/AAAB>): exit_status=84

Jan 04 17:23:22 auth: Error: checkpassword
(redacted@redacted.redacted.local,127.0.0.1,<6uwL/SEOzpt/AAAB>): Child 106455
exited with status 84

Jan 04 17:23:22 auth: Debug: checkpassword
(redacted@redacted.redacted.local,127.0.0.1,<6uwL/SEOzpt/AAAB>): Finished
passdb lookup

Jan 04 17:23:22 auth: Debug: auth
(redacted@redacted.redacted.local,127.0.0.1,<6uwL/SEOzpt/AAAB>): Auth request
finished

Jan 04 17:23:24 auth: Debug: client passdb out: FAIL 1
user=redacted@redacted.redacted.local code=temp_fail

Jan 04 17:23:24 imap-login: Info: Disconnected: Connection closed (auth service
reported temporary failure): user=redacted@redacted.redacted.local,
method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, secured, session=<6uwL/SEOzpt/AAAB>

Jan 04 17:23:24 auth: Debug: auth client connected (pid=106456)

Jan 04 17:23:24 auth: Debug: client in: AUTH 1 PLAIN service=imap secured
session=R5kq/SEO0Jt/AAAB lip=127.0.0.1 rip=127.0.0.1 lport=143 rport=39888

 

As part of the build process we overwrite the config files with ones which are
presumably from a previous version.

 

In particular there's an auth.conf file which contains :-

 

!include auth-checkpassword.conf.ext

 

and in turn that file contains the stanza :-

 

passdb {

    driver = checkpassword

    args = /usr/bin/checkpassword

}

 

which is where I guess the problem lies.

 

The thing is the config files are almost identical on both systems.

 

Here's the dovecot -n output...

 

[root@server dovecot]# dovecot -n

# 2.3.20 (xyz675d): /etc/dovecot/dovecot.conf

# OS: Linux 6.1.61-85.141.amzn2023.x86_64 x86_64 ext4

# Hostname: server...1a97d

auth_debug = yes

auth_verbose = yes

disable_plaintext_auth = no

first_valid_gid = 0

first_valid_uid = 0

listen = *

log_path = /var/project/log/dovecot/dovecot.log

mail_location = maildir:/var/mail/vhosts/%d/%n

mail_privileged_group = mail

mbox_write_locks = fcntl

passdb {

args = username_format=%u /etc/dovecot/users

driver = passwd-file

}

passdb {

args = /usr/bin/checkpassword

driver = checkpassword

}

protocols = imap

service auth {

unix_listener auth-userdb \{ group = postfix mode = 0600 user = postfix }

}

ssl_cert = ___
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org


Inconsistency in map index with dovecot v2.3.21

2024-01-14 Thread John Alex. via dovecot

Hi,

since I upgraded dovecot to version 2.3.21 on a FreeBSD 13.2 system, I've been seeing a 
few occurences of the following warnings daily:


Jan 11 13:13:25 dimokritos dovecot[33170]: lmtp(user1)<8209>: 
Warning: mdbox /var/vmail/users/user1/mdbox/storage: Inconsistency in map index (5,40 != 5,56)
Jan 11 13:13:25 dimokritos dovecot[33170]: lmtp(user1)<8209>: 
Warning: fscking index file /var/vmail/users/user1/mdbox/storage/dovecot.map.index
Jan 11 13:13:25 dimokritos dovecot[33170]: lmtp(user1)<8209>: 
Warning: mdbox /var/vmail/users/user1/mdbox/storage: rebuilding indexes
Jan 11 13:13:26 dimokritos dovecot[33170]: lmtp(user1)<8209>: 
Warning: fscking index file /var/vmail/users/user1/mdbox/storage/dovecot.map.index


The numbers in parentheses seem to always be of the format (x,40 != x,56) or 
(x,40 != x,72).

I also get such errors on some users when purging (doveadm-purge fails with 
error 75):

doveadm(user2): Warning: mdbox /var/vmail/users/user2/mdbox/storage: Inconsistency in map 
index (5,40 != 5,72)
doveadm(user2): Warning: fscking index file 
/var/vmail/users/user2/mdbox/storage/dovecot.map.index

doveadm(user2): Warning: mdbox /var/vmail/users/user2/mdbox/storage: rebuilding 
indexes
doveadm(user2): Error: Purging namespace '' failed: BUG: Unknown internal error

If I rerun doveadm purge for this user it completes successfully.

Can anyone shed some light on what might be causing these messages? I didn't have these 
with 2.3.20. Should I be worried about data loss due to these index inconsistencies?

___
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org


[PATCH 1/1] storage: remove 500 ms debounce on IMAP IDLE notifications

2024-01-14 Thread Alex
This commit removes hardcoded 500 ms debounce
from storage that delays all storage notification subscribers
such as IDLE and NOTIFY commands.

500 ms debounce constant NOTIFY_DELAY_MSECS
was added in 2009 [1]. Before that Dovecot
was only delivering notifications
when a second-resolution timer
is changed by at least 1, so IDLE notifications
were delayed by half a second on average.

[1] 
https://github.com/dovecot/core/commit/56fb5d09955b6097f77b341717fd9b70e9f13e7
---
 src/lib-storage/mail-storage-private.h |  2 +-
 src/lib-storage/mailbox-watch.c| 21 -
 2 files changed, 5 insertions(+), 18 deletions(-)

diff --git a/src/lib-storage/mail-storage-private.h 
b/src/lib-storage/mail-storage-private.h
index 0cbdf4c48a..32b337d242 100644
--- a/src/lib-storage/mail-storage-private.h
+++ b/src/lib-storage/mail-storage-private.h
@@ -455,7 +455,7 @@ struct mailbox {
/* Mailbox notification settings: */
mailbox_notify_callback_t *notify_callback;
void *notify_context;
-   struct timeout *to_notify, *to_notify_delay;
+   struct timeout *to_notify;
struct mailbox_notify_file *notify_files;
 
/* Increased by one for each new struct mailbox. */
diff --git a/src/lib-storage/mailbox-watch.c b/src/lib-storage/mailbox-watch.c
index 659cab3810..a56c5093fc 100644
--- a/src/lib-storage/mailbox-watch.c
+++ b/src/lib-storage/mailbox-watch.c
@@ -9,8 +9,6 @@
 #include 
 #include 
 
-#define NOTIFY_DELAY_MSECS 500
-
 struct mailbox_notify_file {
struct mailbox_notify_file *next;
 
@@ -19,9 +17,10 @@ struct mailbox_notify_file {
struct io *io_notify;
 };
 
-static void notify_delay_callback(struct mailbox *box)
+static void notify_callback(struct mailbox *box)
 {
-   timeout_remove(>to_notify_delay);
+   timeout_reset(box->to_notify);
+
box->notify_callback(box, box->notify_context);
 }
 
@@ -40,18 +39,7 @@ static void notify_timeout(struct mailbox *box)
}
 
if (notify)
-   notify_delay_callback(box);
-}
-
-static void notify_callback(struct mailbox *box)
-{
-   timeout_reset(box->to_notify);
-
-   if (box->to_notify_delay == NULL) {
-   box->to_notify_delay =
-   timeout_add_short(NOTIFY_DELAY_MSECS,
- notify_delay_callback, box);
-   }
+   notify_callback(box);
 }
 
 void mailbox_watch_add(struct mailbox *box, const char *path)
@@ -97,7 +85,6 @@ void mailbox_watch_remove_all(struct mailbox *box)
i_free(file);
}
 
-   timeout_remove(>to_notify_delay);
timeout_remove(>to_notify);
 }
 
-- 
2.43.0

___
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org


[PATCH 0/1] Patch removing 500 ms IDLE delay

2024-01-14 Thread Alex
I have made a patch that actually deletes 500 ms delay
from mailbox-watch.c rather than reducing it to 1 ms.

I then looked into
adding debounce to src/imap/cmd-idle.c,
but there I cannot be sure that mailbox pointer
passed to idle_callback() will not be freed
by the time debounce timer expires.
If we want to have debounce in IDLE,
it should be kept in mailbox-watch.c,
but reset via special API from cmd-idle.c
every time IDLE is started.

Then I thought about the issue again
and am pretty sure debounce is not needed for IDLE.
If an offline client gets online and synchronizes
a lot of flags, it usually can do it in one command.
If it does not, because of bad implementation
or because flags are different for different messages,
it will send multiple commands.
In this case IDLE-ing client will receive
multiple updates, but this is not bad for performance.
If IDLE-ing client does not ignore these updates
and actually processes them,
worst case it will immediately get busy
processing the first incoming update.
But by the time it finishes processing
the first update it will receive many updates
and process them in batch,
effectively debouncing on the client
even if there is no special code doing this.

So unless there is an IMAP client
that is known to benefits from debouncing,
I suggest that no debouncing is added for IDLE.

Alex (1):
  storage: remove 500 ms debounce on IMAP IDLE notifications

 src/lib-storage/mail-storage-private.h |  2 +-
 src/lib-storage/mailbox-watch.c| 21 -
 2 files changed, 5 insertions(+), 18 deletions(-)

-- 
2.43.0

___
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org


Custom map for quota

2024-01-14 Thread Matt
Hi,

I'm trying to setup quota with the following layout

CREATE TABLE "domain" (
"id" INTEGER,
"name" TEXT,
"active" INTEGER DEFAULT 0,
PRIMARY KEY("id"),
UNIQUE("name")
)

CREATE TABLE "address" (
"id" INTEGER,
"localpart" TEXT NOT NULL,
"domain_id" INTEGER NOT NULL,
PRIMARY KEY("id"),
UNIQUE("localpart","domain_id")
)

CREATE TABLE "mailbox" (
        "id" INTEGER,
"address_id" INTEGER,
"active" INTEGER DEFAULT 0,
"password" TEXT,
"quota_bytes" INTEGER DEFAULT 0,
PRIMARY KEY("id")
)

As I like to update the quota and I like to use a dict/map I'm not sure if I
can update this following:

map {
  pattern = priv/quota/storage
  table = maibox
  value_field = dummy
  fields {
    value_field = quota_bytes
    id = mailbox_id
  }


mailbox_id will be queried using password_query using: "mailbox.id as
mailbox_id"

Using such map I hope to be able to use:

SELECT quota_bytes FROM mailbox WHERE id = '$mailbox_id'
INSERT INTO mailbox (quota_bytes) VALUES ('$value') ON DUPLICATE KEY UPDATE
quota_bytes='$value'

Can someone help me with this ?
___
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org


Re: Panic: file index-search-result.c: line 132 (index_search_result_update_flags): assertion failed: (result->search_args->args == _arg)

2024-01-14 Thread Markus Doits via dovecot



Am 03.01.24 um 10:14 schrieb Aki Tuomi:

namespace {
prefix = _/
separator = /
location =
virtual:~/Maildir/virtual:LAYOUT=maildir++:INDEX=~/Maildir/virtual
}



You should not store virtual folders inside Maildir (assuming this is your mail 
location). Please use
~/virtual/ instead. The INDEX directive is not needed in this case as it points 
to same place anyways.


Thanks for your suggestion! I changed it and moved the virtual folders 
out of the Maildir manually:


```
location = virtual:~/virtual:LAYOUT=maildir++
```

Unfortunately the same panic ist still there.

I just noticed there is another panic with the same assertion and 
backtrace but a different file:


```
Panic: file index-search-result.c: line 174 
(index_search_result_update_appends): assertion failed: 
(result->search_args->args == _arg)

```

By the way there is nothing that seems to be broken (fts searching seems 
to work like it should), but the logs are filled with this panics and 
backtraces. 路‍♂️


Some more info: The panics happen after logging in (tested with 
Thunderbird, Roundcube, K-9 Mail on Android). I cannot trigger the panic 
when doing a fts search after login (e.g. on Thunderbird or K-9 which 
holds the connection after login).

___
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org