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

117 Commits

Author SHA1 Message Date
Martin Schwenke
6695fa50ae ctdb: Use ctdb_wait_for_process_to_exit()
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-02-23 07:23:18 +01:00
Amitay Isaacs
d1f3b5d408 ctdb-daemon: Improve log message when REQ_DMASTER is received on non-lmaster
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-02-12 05:32:16 +01:00
Amitay Isaacs
b71c2e4230 Revert "ctdb-daemon: Check packet generation against database generation"
This reverts commit 0ff90f4fac.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11707

The checks against database generation are not required since
the global generation is updated as part of updating vnnmap
before the actual database recovery.  This change was done in
5aab31a39a.

Checking only against the database generation is incomplete.  It can
cause CTDB to abort if the following sequence of events happen.

 - CTDB gets REQ_DMASTER packet (gen1)
   This packet processing gets deferred to get a record lock

 - CTDB goes into recovery, marks RECOVERY_ACTIVE
   CTDB recovery helper updates vnnmap (gen2)

 - CTDB processes REQ_DMASTER packet (gen1)
   The check against database generation (gen1) succeeds.
   The check for lmaster is now invalid because VNNMAP has changed.
   This will cause CTDB to abort due to protocol error.

Reverting the patch stops processing packets of older generation before
they get into call processing.

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

Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Tue Feb  9 12:39:24 CET 2016 on sn-devel-144
2016-02-09 12:39:24 +01:00
Michael Adam
476672b647 dlist: remove unneeded type argument from DLIST_ADD_END()
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-02-06 21:48:17 +01:00
Christof Schmitt
03b27bd139 ctdb: Use prctl_set_comment from lib/util
Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-11-18 04:05:13 +01:00
Amitay Isaacs
f50db5cba5 ctdb-server: Replace ctdb_logging.h with common/logging.h
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
2015-11-16 00:46:15 +01:00
Mathieu Parent
c315fce17e Fix various spelling errors
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Nov  6 13:43:45 CET 2015 on sn-devel-104
2015-11-06 13:43:45 +01:00
Amitay Isaacs
e8f8c63361 ctdb-daemon: Rename struct ctdb_req_keepalive to ctdb_req_keepalive_old
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:14 +01:00
Amitay Isaacs
296d9f4cda ctdb-daemon: Rename struct ctdb_reply_dmaster to ctdb_reply_dmaster_old
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:14 +01:00
Amitay Isaacs
555a2f3f4f ctdb-daemon: Rename struct ctdb_req_dmaster to ctdb_req_dmaster_old
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:14 +01:00
Amitay Isaacs
e23a2891d9 ctdb-daemon: Rename struct ctdb_reply_error to ctdb_reply_error_old
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:14 +01:00
Amitay Isaacs
277c21f0cd ctdb-daemon: Rename struct ctdb_reply_call to ctdb_reply_call_old
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:14 +01:00
Amitay Isaacs
e0c42c5698 ctdb-daemon: Rename struct ctdb_req_call to ctdb_req_call_old
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:14 +01:00
Amitay Isaacs
4647787773 ctdb-daemon: Separate prototypes for common client/server functions
This groups function prototypes for common client/server functions in
common/common.h and removes them from ctdb_private.h.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-10-30 02:00:27 +01:00
Amitay Isaacs
01c6c90e98 ctdb-daemon: Remove dependency on includes.h
Instead of includes.h, include the required header files explicitly.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-10-30 02:00:27 +01:00
Amitay Isaacs
2fdb332fad ctdb-daemon: Stop using tevent compatibility definitions
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-10-30 02:00:27 +01:00
Amitay Isaacs
b900adc55c ctdb-daemon: Separate prototypes for system specific functions
This groups function prototypes for system specific functions in
common/system.h and removes them from ctdb_private.h.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-10-30 02:00:27 +01:00
Amitay Isaacs
ffff66b011 ctdb-call: Improve a log message
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-10-07 14:53:29 +02:00
Amitay Isaacs
b25c1135a7 ctdb-daemon: Use reqid abstraction
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-10-07 14:53:28 +02:00
Amitay Isaacs
0ff90f4fac ctdb-daemon: Check packet generation against database generation
CTDB verifies the generation in the packet header matches that of the
current generation.  However, that check now needs to be done where
database context is available.  So add in the check in handlers for
database requests (CTDB_REQ_CALL, CTDB_REQ_DMASTER, CTDB_REPLY_DMASTER
and CTDB_REPLY_CALL).

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-10-07 14:53:27 +02:00
Amitay Isaacs
d701072c3e ctdb-call: Delete old defer queue if recovery occurs
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-10-07 14:53:27 +02:00
Amitay Isaacs
3d11efe3c6 ctdb-daemon: Use database generation in packet headers for database requests
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-10-07 14:53:27 +02:00
Amitay Isaacs
6a212d13d0 ctdb-call: Convert pending calls list to per database list
The pending calls are migration requests received from clients (over unix
domain socket) which are under processing.  After a recovery is finished,
any requests which are under processing will be dropped since they do
not belong to the current generation.  All the pending call requests
are resent with new generation to restart record migrations.

This is in preparation for parallel database recovery.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-10-07 14:53:26 +02:00
Amitay Isaacs
2c57cc9597 ctdb-call: Drop all deferred requests from older generation
Deferring packets has a nasty interaction with recovery.  All deferred
packets must be dropped when recovery happens, since those packets are
tracked as pending requests and will be re-sent with new generation.

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 Sep  5 09:30:50 CEST 2014 on sn-devel-104
2014-09-05 09:30:50 +02:00
Amitay Isaacs
ef59f2e6bb ctdb-daemon: Defer all calls when processing dmaster packets
When CTDB receives DMASTER_REQUEST or DMASTER_REPLY packet, the specified
record needs to be updated as soon as possible to avoid inconsistent
dmaster information between nodes.  During this time, queue up all calls
for that record and process them only after dmaster request/reply has
been processed.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-09-05 07:05:10 +02:00
Amitay Isaacs
deb7bb89b3 ctdb-daemon: Remove duplicate code with refactored function
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-09-05 07:05:10 +02:00
Martin Schwenke
6fd3ce5391 ctdb-daemon: Fix some strict-aliasing warnings
Seeing these with -Wall:

  ../server/ctdb_call.c:1117:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     record_flags = *(uint32_t *)&c->data[c->keylen + c->datalen];
     ^

memcpy() seems to be the easiest way to get fix these.  The
alternative would be to use unmarshalling functions.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-08-21 04:46:13 +02:00
Martin Schwenke
c1558adeaa ctdb: Use sys_read() and sys_write() to ensure correct signal interaction
... and avoid compiler warnings in some cases.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-08-21 04:46:13 +02:00
Amitay Isaacs
c6d0e8dadc ctdb-readonly: Do not abort if revoke of readonly record fails on a node
Revoking readonly record involves first marking the record on dmaster as
RO_REVOKING_READONLY.  Then all the other nodes are sent update_record
control to get rid of RO_DELEGATION.  Once that succeeds, the record
is marked RO_REVOKING_COMPLETE.

Currently, revoking of readonly delegations on the nodes is tried only
once.  If a node goes in recovery, it can fail update_record control and
revoke code will abort ctdb.  Since database recovery would revoke all
readonly delegations anyway, there is no reason to abort.  Simply undo
the start of revoke process by resetting RO_REVOKING_READONLY flag.

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): Wed Aug 13 11:24:09 CEST 2014 on sn-devel-104
2014-08-13 11:24:09 +02:00
Amitay Isaacs
f96f395d85 ctdb-readonly: Add an early return to simplify code
This patch makes the subsequent logic change small and easier to
understand.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-08-13 08:57:11 +02:00
Amitay Isaacs
7667da6590 ctdb-readonly: Do not use hard-coded value for readonly revoke timeout
In case of control timeouts, readonly revoke code currently aborts.  This
needs to be fixed.  Meanwhile, using control_timeout instead of 5 seconds,
increases the timeout to 60 seconds.

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

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Mon Mar 31 07:20:48 CEST 2014 on sn-devel-104
2014-03-31 07:20:48 +02:00
Amitay Isaacs
be33efa3e4 ctdbd: Remove transaction code related to TRANS2 commits
This removes data types and structure elements related to TRANS2
persistent transaction code.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 22a253b7ccf1ff854cddf0b67969dc84d7d6a654)
2013-10-04 15:20:25 +10:00
Michael Adam
18f17aaa33 server: standardize formatting of comment block for ctdb_reply_dmaster() while I'm at it..
This was the comment block I was touching and meant to adapt in
commit 00d3bf092e2f72eda330978c75ec85f17e870553.
My search was apparently not unique...

Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit 09940255011b119dc6af3304f5d3e9568e6006fd)
2013-08-26 13:24:32 +02:00
Amitay Isaacs
19444f7c3d ctdbd: Make sure call data is freed if doing an early return
This should avoid memory bloat when a request bounces between nodes.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 7677fb263f06a97398e2c546e32273fb96edca69)
2013-08-22 16:59:49 +10:00
Amitay Isaacs
1467b666f2 Revert "LACOUNT: Add back lacount mechanism to defer migrating a fetched/read copy until after default of 20 consecutive requests from the same node"
This reverts commit 035c0d981bde8c0eee8b3f24ba8e2dc817e5b504.

This is a premature optimization.  Record can bounce between nodes
very quickly if it is a contended record.  There is no need to hold a
record on a node unnecessarily.  In case record contention becomes bad,
enabling sticky records on a database is a better idea.

Conflicts:
	include/ctdb_private.h
	server/ctdb_tunables.c

Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit ac417b0003f0116f116834ad2ac51482d25cfa0d)
2013-08-22 14:08:52 +10:00
Amitay Isaacs
59dae19f5a ctdbd: Print a log message when a key becomes hot
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 48f40985f4592c28402303ccbb458756f4914f75)
2013-08-22 14:08:52 +10:00
Michael Adam
621bfe8b0d server: standardize formatting of comment block for ctdb_reply_dmaster() while I'm at it..
Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit 00d3bf092e2f72eda330978c75ec85f17e870553)
2013-08-19 17:12:33 +02:00
Michael Adam
922246de73 server: fix wording and punctuation in comment block for ctdb_reply_dmaster().
Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit cb3a1c5af3b796dba30cae07118670d3c9e57df7)
2013-08-19 17:12:32 +02:00
Amitay Isaacs
a98baa539e ctdbd: When a record is made sticky, log only once
Instead of logging from ctdb_request_call(), log the message from
ctdb_make_record_sticky().  That way if the record is already sticky, the
message is not repeated unnecessarily.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 44a64d1c388bfe3c3388b191edfaedecfb7bb831)
2013-08-09 11:07:37 +10:00
Amitay Isaacs
d42cea6efe ctdbd: Improve high hopcount log messages when request is redirected
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 9cde47e1a5bf1b9ca3b4da8c2db94caac2b1aa5e)
2013-08-09 11:07:37 +10:00
Amitay Isaacs
0993387f4a ctdbd: Don't consider a hot record if the hopcount is zero
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit ab35773518ad15588013f4d859f7bee790437450)
2013-07-30 15:34:32 +10:00
Amitay Isaacs
054d8727ed ctdbd: Fix updating of hot keys in database statistics
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit fde4b4db5a57f75c5efa5647c309f33e0d5a68f3)
2013-07-29 16:00:46 +10:00
Amitay Isaacs
1c21f37e57 ctdbd: Set process names for child processes
This helps distinguish processes in process list in top, perf, etc.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 2493f57ce268d6fe7e4c40a87852c347fd60d29e)
2013-07-10 14:33:19 +10:00
Mathieu Parent
d82b9ae410 build: Fix tdb.h path to enable building with system TDB library
(This used to be ctdb commit f8bf99de3a5f56be67aaa67ed836458b1cf73e86)
2013-06-14 16:45:27 +10:00
Michael Adam
d1dd29197e ctdbd: fix comment explaining redirection of CTDB_REQ_CALL redirection.
Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit b697625b184227dad1be31a41b7a3fd9bd312e29)
2013-05-24 22:06:24 +10:00
Michael Adam
3f03a3c8a3 ctdbd: remove a nonempty blank line
Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit d9e24782a90d9ce29c0e6584b75d2b186142174d)
2013-05-24 22:06:21 +10:00
Michael Adam
a0b20771fe ctdbd: update comment describing ctdb_call_send_redirect()
Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit 9a21d417c51fb9cad8f2e87e00ca54d379aef860)
2013-05-24 22:06:16 +10:00
Michael Adam
eb0389b0b1 ctdb_call: use CTDB_REC_RO_FLAGS where appropriate
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-By: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit f99eb2f56d8ca27110a45ae0e1c4bff40ac7a60e)
2013-04-24 18:48:58 +10:00
Michael Adam
f1fe9ddf42 ctdb_call: don't bump the rsn in ctdb_become_dmaster() any more
This is now done in ctdb_ltdb_store_server(), so this
extra bump can be spared.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-By: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit cad3107b12e8392f786f9a758ee38cf3a3d58538)
2013-04-17 21:16:32 +10:00
Ronnie Sahlberg
59565c05cf STATISTICS: Add tracking of the 10 hottest keys per database measured in hopcount
and add mechanisms to dump it using the ctdb dbstatistics command

(This used to be ctdb commit 8307c70ed98996b430c470e9641a09fdeeb81bd8)
2012-06-13 16:19:18 +10:00