1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
Commit Graph

6237 Commits

Author SHA1 Message Date
Martin Schwenke
02f48084b7 ctdb-killtcp: Change default retry interval, batch size and attempts
Testing indicates that these are good reliable defaults that can kill
many connections in a reasonable amount of time.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Fri Apr  1 08:10:54 CEST 2016 on sn-devel-144
2016-04-01 08:10:54 +02:00
Martin Schwenke
dd06c797b1 ctdb-killtcp: Send tickle ACKs in batches
At the moment the batch size is "all".

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-01 04:42:12 +02:00
Martin Schwenke
e66cdd8312 ctdb-killtcp: Store retry interval in killtcp structure
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-01 04:42:12 +02:00
Martin Schwenke
93f3cd6650 ctdb-killtcp: Don't count attempts for individual connections
This made sense when connections were individually queued in the
daemon.  However, they're now done in batch so just keep an overall
count.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-01 04:42:12 +02:00
Martin Schwenke
402f3c0460 ctdb-killtcp: Keep track of number of kill attempts and maximum allowed
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-01 04:42:12 +02:00
Martin Schwenke
7e5eab139d ctdb-killtcp: Filter out sent packets
When previously killing TCP connections via the daemon there was some
latency due to each kill being sent to the daemon via a separate
control.  This probably meant that when doing a 2-way kill the tickle
ACKs sent to the client end of a connection would not interfere with
listening for the reply ACK from the server end.  Now that there is no
latency, the tickle ACK or RST sent to the client end can be seen as
the reply to the server end tickle ACK, and vice-versa.

To avoid this, throw away packets that look like we sent them.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-01 04:42:12 +02:00
Martin Schwenke
bba31152df ctdb-system: Return window size and RST bit when reading TCP packets
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-01 04:42:12 +02:00
Martin Schwenke
d7fa4b76c5 ctdb-killtcp: Clarify a debug message
The end of the connection in parentheses is not the end being killed.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-01 04:42:12 +02:00
Martin Schwenke
cb2fee2c43 ctdb-killtcp: Set debug level via environment variable CTDB_DEBUGLEVEL
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-01 04:42:12 +02:00
Martin Schwenke
5492f874d9 ctdb-killtcp: Don't send initial tickle ACK during setup
Since they're being done in batch, just schedule an event to traverse
all the connections.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-01 04:42:12 +02:00
Martin Schwenke
4105ca953e ctdb-killtcp: Drop unnecessary casts
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-01 04:42:12 +02:00
Martin Schwenke
7aea3c12fb ctdb-killtcp: Drop check to see if capture socket can be read
The handler won't be called unless there is something to read.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-01 04:42:12 +02:00
Martin Schwenke
2e1e1e8268 ctdb-killtcp: Merge "common" killtcp code into helper
ctdb_killtcp.c is now the only place it is needed.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-01 04:42:12 +02:00
Martin Schwenke
52cfe76de8 ctdb-protocol: Drop killtcp protocol support
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-01 04:42:12 +02:00
Martin Schwenke
d8398b04b5 ctdb-daemon: Remove implementation of CTDB_CONTROL_KILL_TCP
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-01 04:42:12 +02:00
Martin Schwenke
f0a83d865c ctdb-client: Drop killtcp client functions
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-01 04:42:12 +02:00
Martin Schwenke
efd371659f ctdb-tools: Drop "ctdb killtcp" command
It is now handled by a standalone helper.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-01 04:42:12 +02:00
Martin Schwenke
83502a79dc ctdb-scripts: Use ctdb_killtcp helper to kill connections
ctdb_killtcp will take up to 5 seconds to kill connections, so don't
wait in a loop.  Just check if there are remaining connections on
completion and log a message either way.

Also add a test stub.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-01 04:42:12 +02:00
Martin Schwenke
b417d79930 ctdb-scripts: Add interface argument to kill_tcp_connections()
This will be needed for a rewrite of the connection killing code but
it is not used yet.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-01 04:42:11 +02:00
Martin Schwenke
1924323af6 ctdb-killtcp: New helper ctdb_killtcp
This will allow killing of TCP connections without daemon involvement.

It looks strange that the common code for daemon and helper is in the
server directory.  Having it in the server directory means less
temporary changes to the build configuration.  This code will move
into the helper itself and will no longer be used by the daemon.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-01 04:42:11 +02:00
Martin Schwenke
c56112949a ctdb-killtcp: Simplify includes by using ctdb_sock_addr_to_string()
This allows common.h and ctdb_private.h to be dropped.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-01 04:42:11 +02:00
Martin Schwenke
248557bdf5 ctdb-killtcp: Avoid unnecessary dependency on lib/util/time.h
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-01 04:42:11 +02:00
Martin Schwenke
51f5faf555 ctdb-killtcp: Factor out killtcp code into separate file.
This will be used in a standalone helper.

Don't worry that the API isn't clean and opaque.  All of the code will
eventually move into the helper and will no longer be used by the
daemon.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-01 04:42:11 +02:00
Martin Schwenke
f76cb52eb5 ctdb-killtcp: Factor out ctdb_killtcp()
This function knows nothing about CTDB contexts or VNNs, so it can be
used elsewhere.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-01 04:42:11 +02:00
Martin Schwenke
879960b74d ctdb-killtcp: Change struct ctdb_tcp_kill to store arbitrary destructor data
The destructor used in this instances needs a CTDB context and a VNN.
However, destructors used in other cases may need different data.

For this instance create a local structure to hold the required data.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-01 04:42:11 +02:00
Martin Schwenke
1bf494f693 ctdb-killtcp: Avoid CTDB_NO_MEMORY()
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-01 04:42:11 +02:00
Martin Schwenke
32ea7c0d2c ctdb-killtcp: Determine the interface as soon as vnn is known
This makes restructuring the code easier.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-01 04:42:11 +02:00
Martin Schwenke
380c894471 ctdb-killtcp: Use the given event context directly
We don't want this code to depend on a CTDB context, so don't go
looking there for an event context.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-01 04:42:11 +02:00
Amitay Isaacs
386cd7969c ctdb-system: Add ctdb_parse_connections() function
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-04-01 04:42:11 +02:00
Martin Schwenke
5433a00408 ctdb-tests: Link ctdb-util instead of including
These are never replaced with stubs.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-01 04:42:11 +02:00
Martin Schwenke
676f42a6ba ctdb-util: Move rb_tree.c to ctdb-util
It doesn't need struct ctdb_context or similar.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-01 04:42:11 +02:00
Amitay Isaacs
c51b8c2234 ctdb-recovery-helper: Add banning to parallel recovery
If one or more nodes are misbehaving during recovery, keep track of
failures as ban_credits.  If the node with the highest ban_credits exceeds
5 ban credits, then tell recovery daemon to assign banning credits.

This will ban only a single node at a time in case of recovery failure.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>

Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Fri Mar 25 06:57:32 CET 2016 on sn-devel-144
2016-03-25 06:57:32 +01:00
Amitay Isaacs
ae366fb932 ctdb-recoverd: Add message handler to assigning banning credits
This will be called from recovery helper to assign banning credits to
misbehaving node.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-03-25 03:26:16 +01:00
Amitay Isaacs
fc63eae80b ctdb-protocol: Add srvid for assigning banning credits
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-03-25 03:26:16 +01:00
Amitay Isaacs
ad7a407a13 ctdb-recovery-helper: Introduce new #define variable
... instead of hardcoding number of retries.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-03-25 03:26:16 +01:00
Amitay Isaacs
e5a714a3c2 ctdb-recovery-helper: Improve log message
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-03-25 03:26:16 +01:00
Amitay Isaacs
a7b8ee87fe ctdb-tests: Add a test for recovery of large databases
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-03-25 03:26:15 +01:00
Amitay Isaacs
ffea827bae ctdb-recovery-helper: Introduce push database abstraction
This abstraction uses capabilities of the remote nodes to either send
older PUSH_DB controls or newer DB_PUSH_START and DB_PUSH_CONFIRM
controls.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-03-25 03:26:15 +01:00
Amitay Isaacs
b96a4759b3 ctdb-recovery-helper: Introduce pull database abstraction
This abstraction depending on the capability of the remote node either
uses older PULL_DB control or newer DB_PULL control.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-03-25 03:26:15 +01:00
Amitay Isaacs
bb6541b386 ctdb-protocol: Add new capability
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-03-25 03:26:15 +01:00
Amitay Isaacs
c5776f0529 ctdb-protocol: Add srvid for messages during recovery
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-03-25 03:26:15 +01:00
Amitay Isaacs
b1e8714bb8 ctdb-protocol: Introduce variable for checking srvid prefix
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-03-25 03:26:15 +01:00
Amitay Isaacs
e1fdfdd1c1 ctdb-recovery-helper: Write recovery records to a recovery file
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-03-25 03:26:15 +01:00
Amitay Isaacs
9058fe06df ctdb-recovery-helper: Re-factor function to retain records from recdb
Also, rename traverse function and traverse state for recdb_records
consistently.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-03-25 03:26:15 +01:00
Amitay Isaacs
76f653f0bc ctdb-protocol: Add file IO functions for ctdb_rec_buffer
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-03-25 03:26:15 +01:00
Amitay Isaacs
a80ff09ed3 ctdb-recovery-helper: Create accessors for recdb structure fields
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-03-25 03:26:15 +01:00
Amitay Isaacs
70011a1bfb ctdb-recovery-helper: Rename pnn to dmaster in recdb_records()
This variable is used to set the dmaster value for each record in
recdb_traverse().

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-03-25 03:26:15 +01:00
Amitay Isaacs
5b926d882e ctdb-recovery-helper: Pass capabilities to database recovery functions
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-03-25 03:26:15 +01:00
Amitay Isaacs
5f43f92796 ctdb-recovery-helper: Factor out generic recv function
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-03-25 03:26:15 +01:00
Amitay Isaacs
338e0dccd9 ctdb-client: Add client API functions for new controls
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-03-25 03:26:15 +01:00