Timo Sirainen [Mon, 16 Oct 2017 11:49:56 +0000 (14:49 +0300)]
cassandra: Fix using bigint types with unprepared statements
This reverts the code to not using the statements with binding at all.
Alternative fix would be to start using explicit int32 or int64 parameter
types, but that breaks backwards compatibility a bit.
Timo Sirainen [Mon, 9 Oct 2017 10:19:32 +0000 (13:19 +0300)]
lib: ostream-multiplex - set ostream_private.parent
Unlike with istream-multiplex, there are no issues with I/Os. Only the
parent stream will have the I/O. Using the default parent adds the
missing methods that otherwise would have needed to be implemented:
- cork
- flush_pending
- switch_ioloop
Timo Sirainen [Mon, 9 Oct 2017 10:14:23 +0000 (13:14 +0300)]
lib: istream-multiplex - Forward i_stream_switch_ioloop() to parent
Most istreams do this because istream_private.parent is set to the parent
stream, but this can't be done with istream-multiplex. The main problem
with attempting to do the same with istream-multiplex is that the different
channels don't share the same I/O. Just because one channel received data
doesn't mean that other channels received any data. (It would be possible
to solve this by implementing a new method that allows overriding
i_stream_set_io(), but I'm not sure if that's a good idea either.)
Timo Sirainen [Fri, 6 Oct 2017 13:55:28 +0000 (16:55 +0300)]
acl: Fix checking create (k) permission in global acl-file
Just because the global ACL file hasn't changed since it was last refreshed
for another ACL object, it doesn't mean that those ACLs don't need to be
applied to this ACL object.
This didn't usually cause problems, because the initial ACL object refresh
was always done due to local-path refresh returning "needs a refresh".
The only exception was when acl_object_init_from_parent() was called,
because it added an empty non-NULL validity for the local-path, so the
"needs a refresh" wasn't returned. This happened only when trying to
CREATE or RENAME mailbox under a parent where user didn't have create
permissions.
This affected only when using a single global acl-file, not when using
global acl directory containing per-mailbox files.
Timo Sirainen [Thu, 5 Oct 2017 08:46:55 +0000 (11:46 +0300)]
director: Don't crash if DIRECTOR-REMOVE is received for itself
This triggers the director removal from the ring, which causes the
connection to be destroyed. But since we're still in the middle of handling
the connection it needs refcounting.
Timo Sirainen [Thu, 14 Sep 2017 14:57:29 +0000 (17:57 +0300)]
director: After CONNECT was received, make sure we disconnect
The remote side won't be reading anything after the CONNECT, so we have to
disconnect anyway. If we decide that the CONNECT request is wrong, reconnect
after a short delay and hope that the remote agrees with us the next time.
Timo Sirainen [Thu, 14 Sep 2017 14:38:24 +0000 (17:38 +0300)]
director: Don't reset directors' last_network_failure while handshaking
The reset is done mainly to make it faster for a director that has been down
to connect back to the ring, without other directors still thinking that
it's down. But DIRECTOR that is sent during handshake says nothing about
whether the director is up at the moment or not.
Timo Sirainen [Tue, 3 Oct 2017 11:51:16 +0000 (14:51 +0300)]
lib-master: master_service_init_log() - Switch log handlers only on the first call
The secondary calls were only done by mail_storage_service_*() calls. They
want to initialize the logging once, but afterwards they only care about
changing the log prefix. Switch to this behavior now explicitly.
This fixes behavior if logging functions are changed between
mail_storage_service_*() calls, so they don't get reset.
Timo Sirainen [Wed, 4 Oct 2017 12:41:03 +0000 (15:41 +0300)]
director: Fix HOST-RESET-USERS when all hosts are down
If there were a lot of users being kicked, the host was flushed after the
initial round of user kills. This caused the rest of the user connections to
be just discarded instead of actually being killed.
Timo Sirainen [Wed, 4 Oct 2017 12:39:08 +0000 (15:39 +0300)]
director: Fix tracking user move count when user is freed early
users_moving_count wasn't updated if the user was freed before killing it
finished. This caused "doveadm director flush" to hang while waiting for
the move count to drop to 0, which it never did. Also following flushes
were doing less work in parallel, or possibly even nothing since director
thought there were too many users already being moved.
Timo Sirainen [Mon, 19 Oct 2015 10:49:54 +0000 (13:49 +0300)]
director: Remember backends' hostnames and send them in login reply.
This allows login processes to verify the remote server's hostname in SSL
certificate.
Timo Sirainen [Fri, 18 Aug 2017 08:51:36 +0000 (11:51 +0300)]
director: Run director/host changing doveadm commands only after ring is synced
If the ring sync is still pending, the doveadm command may become reverted.
This doesn't fully prevent problems caused by sending doveadm commands
simultaneously to multiple directors, but it should prevent issues when
only a single director is used for doveadm commands.
It would have been nice to enable this also for HOST/DIRECTOR-LIST commands,
but they don't support returning a ring timeout error without changing the
protocol. It's a bit too much effort to change that for now.
Timo Sirainen [Wed, 13 Sep 2017 12:16:59 +0000 (15:16 +0300)]
cassandra: Fix paged queries to work again
When continuing the result, consistency was reset to 0 (=ANY), which caused
the queries to fail. There's no need to initialize the statement again when
continuing it. Also set result->consistency to be correct mainly for
debugging purposes.
Timo Sirainen [Thu, 24 Aug 2017 08:13:32 +0000 (11:13 +0300)]
cassandra: sql_transaction_commit_s() - Set query_type correctly
The queries were all sent with READ type instead of WRITE/DELETE. This
meant they were using potentially wrong consistency values. Although
synchronous commits aren't actually used anywhere, so this practically
this doesn't fix anything right now.
Timo Sirainen [Thu, 7 Sep 2017 12:40:16 +0000 (15:40 +0300)]
dict-sql: Use prepared statements
Create a hash table of query template -> prepared statement and fill it out
as needed. This could have been done some alternative ways that wouldn't
require building the string first, but this should still be fast enough and
much easier to implement.
Timo Sirainen [Tue, 15 Aug 2017 13:50:16 +0000 (16:50 +0300)]
dict-sql: Cleanup - Remove unnecessary code
The values are explicitly added to params. sql_dict_update_query() doesn't
add them again. Since the "diff" parameter is already a long long type,
this avoids unnecessary conversion to string and back.
Timo Sirainen [Tue, 15 Aug 2017 11:27:40 +0000 (14:27 +0300)]
dict-sql: Change "uint" type to mean 64bit instead of 32bit integer.
This is likely what is usually wanted (especially in e.g. quotas).
If someone actually wants it to be restricted to 32bit, we could add
uint32 later on.