Mercurial > dovecot > core-2.2
annotate src/stats/client-reset.c @ 22715:20415dd0b85a
dsync: Add per-mailbox sync lock that is always used.
Both importing and exporting gets the lock before they even sync the
mailbox. The lock is kept until the import/export finishes. This guarantees
that no matter how dsync is run, two dsyncs can't be working on the same
mailbox at the same time.
This lock is in addition to the optional per-user lock enabled by the -l
parameter. If the -l parameter is used, the same lock timeout is used for
the per-mailbox lock. Otherwise 30s timeout is used.
This should help to avoid email duplication when replication is enabled for
public namespaces, and maybe in some other rare situations as well.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Thu, 28 Dec 2017 14:10:23 +0200 |
parents | cb108f786fb4 |
children |
rev | line source |
---|---|
22713
cb108f786fb4
Updated copyright notices to include the year 2018.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
21390
diff
changeset
|
1 /* Copyright (c) 2016-2018 Dovecot authors, see the included COPYING file */ |
19575
845fb37ef972
stats: Add RESET call to stats client
Aki Tuomi <aki.tuomi@dovecot.net>
parents:
diff
changeset
|
2 |
845fb37ef972
stats: Add RESET call to stats client
Aki Tuomi <aki.tuomi@dovecot.net>
parents:
diff
changeset
|
3 #include "lib.h" |
845fb37ef972
stats: Add RESET call to stats client
Aki Tuomi <aki.tuomi@dovecot.net>
parents:
diff
changeset
|
4 #include "ostream.h" |
845fb37ef972
stats: Add RESET call to stats client
Aki Tuomi <aki.tuomi@dovecot.net>
parents:
diff
changeset
|
5 #include "strescape.h" |
845fb37ef972
stats: Add RESET call to stats client
Aki Tuomi <aki.tuomi@dovecot.net>
parents:
diff
changeset
|
6 #include "mail-stats.h" |
845fb37ef972
stats: Add RESET call to stats client
Aki Tuomi <aki.tuomi@dovecot.net>
parents:
diff
changeset
|
7 #include "client.h" |
845fb37ef972
stats: Add RESET call to stats client
Aki Tuomi <aki.tuomi@dovecot.net>
parents:
diff
changeset
|
8 #include "client-reset.h" |
845fb37ef972
stats: Add RESET call to stats client
Aki Tuomi <aki.tuomi@dovecot.net>
parents:
diff
changeset
|
9 |
845fb37ef972
stats: Add RESET call to stats client
Aki Tuomi <aki.tuomi@dovecot.net>
parents:
diff
changeset
|
10 int client_stats_reset(struct client *client, const char *const *args ATTR_UNUSED, |
845fb37ef972
stats: Add RESET call to stats client
Aki Tuomi <aki.tuomi@dovecot.net>
parents:
diff
changeset
|
11 const char **error_r ATTR_UNUSED) |
845fb37ef972
stats: Add RESET call to stats client
Aki Tuomi <aki.tuomi@dovecot.net>
parents:
diff
changeset
|
12 { |
845fb37ef972
stats: Add RESET call to stats client
Aki Tuomi <aki.tuomi@dovecot.net>
parents:
diff
changeset
|
13 struct mail_global *g = &mail_global_stats; |
845fb37ef972
stats: Add RESET call to stats client
Aki Tuomi <aki.tuomi@dovecot.net>
parents:
diff
changeset
|
14 stats_reset(g->stats); |
20690
50456ea55fec
stats: Reset nearly all global mail stats
Aki Tuomi <aki.tuomi@dovecot.fi>
parents:
19839
diff
changeset
|
15 g->num_logins = 0; |
50456ea55fec
stats: Reset nearly all global mail stats
Aki Tuomi <aki.tuomi@dovecot.fi>
parents:
19839
diff
changeset
|
16 g->num_cmds = 0; |
50456ea55fec
stats: Reset nearly all global mail stats
Aki Tuomi <aki.tuomi@dovecot.fi>
parents:
19839
diff
changeset
|
17 g->reset_timestamp = ioloop_time; |
21389
59437f8764c6
global: Replaced all instances of memset(p, 0, sizeof(*p)) with the new i_zero() macro.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
20690
diff
changeset
|
18 i_zero(&g->last_update); |
19575
845fb37ef972
stats: Add RESET call to stats client
Aki Tuomi <aki.tuomi@dovecot.net>
parents:
diff
changeset
|
19 o_stream_nsend_str(client->output, "OK\n"); |
845fb37ef972
stats: Add RESET call to stats client
Aki Tuomi <aki.tuomi@dovecot.net>
parents:
diff
changeset
|
20 return 0; |
845fb37ef972
stats: Add RESET call to stats client
Aki Tuomi <aki.tuomi@dovecot.net>
parents:
diff
changeset
|
21 } |