Client disconnect used to be per client fd in
the qnetd_client_net_socket_poll_loop_set_events_cb. Problem is, that
disconnect calls algorithm which may send message to other client
with fd which was already processed in the pr-poll-loop so POLLOUT is
not set till new loop exec is called (and that usually happens
because old one timeouts). To reproduce this problem use
ffsplit and make qnetd disconnect one of the clients - ffsplit
needs to send ack/nack votes, but it doesn't send them during
first iteration and waits for dpd timeout.
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Previously dead peer detection timer was scheduled every dpd_interval,
added dpd_interval to all of the clients timestamp and if timestamp was
larger than client hearbeat interval * 1.2 then check if client sent
some message. If so, flag was reset.
This method was source of number of problems so instead different method
is now used.
Every single client has its own timer with timeout based on
(configurable) dpd_interval_coefficient and multiplied with
client heartbeat timeout. When message is received from client timer is
rescheduled. When timer callback is called (= client doesn't sent
message during timeout) then client is disconnected.
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Configuration without ring0_addr is valid for new Corosync.
Big thanks to Fabian-Gruenbichler who reported the problem and
Oyvind Albrigtsen for englishify the error message.
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Position in entries array, heap_pos, is added to the entry.
This has to be kept in sync for every move so new internal set/get
functions are added too.
This removes need for searching for entry.
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Previous timer-list was naive implementation of priority queue and very
slow when number of timers increased. This was not a problem because
only few timers were used. But with removal of dpd timer and replacement
with per-connection timer this may become problematic.
Solution is to use binary heap based priority queue which is much
faster.
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
This patch adds qdevice-net part of keep active partition tie breaker
functionality. It's enabled by default.
When tie happens prefer partition with members of
previously active (quorate) partition. This is hard-coded
behavior of LMS algorithm so this setting affects only
FFSplit algorithm. By default it is disabled for backwards
compatibility.
This solves problem with FFSplit when node A (with lowest id) is killed,
node B gets vote and then node A starts up and creates single node
membership and gets vote.
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
To match the specification add heartbeat timeout only when requested.
Also add qdevice client method to send option message.
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
When tie happens prefer partition with members of
previously active (quorate) partition. This is hard-coded
behavior of LMS algorithm so this setting affects only
FFSplit algorithm. By default it is disabled for backwards
compatibility.
This solves problem with FFSplit when node A (with lowest id) is killed,
node B gets vote and then node A starts up and creates single node
membership and gets vote.
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
With default config of running dpd timer every 10 second and waiting for
2 * client_timeout to clear message received flag and then waiting
another 2 * client_timeout without message received it was possible that
client was marked as a dead after more than 40 seconds making qdevice to
stop sending votequorum hearbeat for too long so corosync lost votes
from qdevice.
This patch is simpler solution which just changes default dpd timer to
1 second and timeout to 1.2 * client_timeout.
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
When events is set to 0 and set_events return -2 it was changed to -1.
Solution is to check, if return code was 0 and only if so, change return
code to -1 if events is 0.
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Previous patch 8dbf1bc8b0 was wrong
because it fixed the crash but made qdevice not work at all.
Correct solution is to test, if state is
QDEVICE_NET_INSTANCE_STATE_WAITING_INIT_REPLY.
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
IPC and TLS sockets are read only, so write callbacks should never
happen (specifically tested in pr-poll-loop test) so remove them.
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Heuristics is designed to be component of its own, which doesn't depend
on qdevice_instance. Removing qdevice_instance pointer was easy as soon
as exec notifier got two user data pointers.
Signed-off-by: Jan Friesse <jfriesse@redhat.com>