1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00
Commit Graph

78 Commits

Author SHA1 Message Date
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
Amitay Isaacs
e1fed53e2a ctdb-daemon: Rename struct ctdb_req_control to ctdb_req_control_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
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
1023db2543 ctdb-daemon: Return correct sequence number for CONTROL_GET_DB_SEQNUM
Due to the missing cast of uint64_t, CONTROL_GET_DB_SEQNUM always returned
seqnum <= 256.

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

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

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Tue Jul 14 13:03:25 CEST 2015 on sn-devel-104
2015-07-14 13:03:25 +02:00
Martin Schwenke
acf26089f1 ctdb-util: Rename db_wrap to tdb_wrap and make it a build subsystem
This makes it consistent with Samba, to ease transition.

Update unit test code to link to with tdb_wrap instead of including
db_wrap.c.

There are some potential whitespace fixes in this commit that have
been ignored.  CTDB's lib/tdb_wrap will be deleted after the
transition to Samba's lib/tdb_wrap, so there's no point polishing it
too much.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-09-10 01:36:15 +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
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
257af5b62a server:persistent: fix a debug message (copy'n'paste error)
Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit 87c89b7c2a14e2ee79a3efc7e8125842bc04bf23)
2013-03-12 14:02:08 +01:00
Michael Adam
12d07dd1c6 server:persistent: fix a comment typo.
Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit 6455ce5e4980a63d56ed30f7059869c8356c12ea)
2013-02-22 11:37:03 +01:00
Amitay Isaacs
4392591555 Remove explicit include of lib/tevent/tevent.h.
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 0681014ca5ed2a9b56f63fdace7f894beccf8a9a)
2012-04-13 17:28:14 +10:00
Michael Adam
55abb07f51 server: move the code for the update_record control to its own file
It is very misleading in ctdb_persistent.c, since it is used for non-persistent
dbs...

(This used to be ctdb commit a956fa3a27106d0154a3fb46987d61c0a6b7c768)
2012-02-21 17:54:17 +01:00
Ronnie Sahlberg
af424b151c Revert "ReadOnly: We can not use ctdb_ltdb_store from a client/child context since"
This reverts commit 11dee7f3f881494cf5089d6c69fd40e74f07e670.

Try to solve this a different way so that ctdb_ltb_store() becomes safe to use also from child context

(This used to be ctdb commit 5990fe65a9cc37933ceff15d4cb2ab3b3a0addb6)
2012-02-21 06:49:18 +11:00
Ronnie Sahlberg
9323afa386 ReadOnly: We can not use ctdb_ltdb_store from a client/child context since
it sometimes (for empty records) needs to be able to initiate traffic unde rhte daemon context.

This should furhter updated later to allow the use also from non-daemon context.

(This used to be ctdb commit 11dee7f3f881494cf5089d6c69fd40e74f07e670)
2012-02-20 21:22:56 +11:00
Ronnie Sahlberg
3e2c40c590 DB Seqnum: must provide a ctdb_ltdb_header when calling ctdb_ltdb_fetch()
(This used to be ctdb commit 1fea9ef55a6a9d201ad1b49583451ac3e6b1c66d)
2011-11-30 08:48:04 +11:00
Michael Adam
2bd04f0ff8 persistent: add ctdb_persistent_finish_trans3_commits().
This function walks all databases and checks for running trans3 commits.
It sends replies to all of them (with error code) and ends them.
To be called when a recovery finishes.

(This used to be ctdb commit 70ba153b532528bdccea70c5ea28972257f384c1)
2011-02-24 10:35:26 +01:00
Michael Adam
0b3d8d28f6 persistent: add a client context to the persistent_stat and track the db_id
The db_id is tracked in the client context as an indication that a
transaction commit is in progress. This is cleared in the persistent_state
talloc destructor.

This is in order to properly treat running trans3_commits if the client
disconnects.

(This used to be ctdb commit e886ff24f4e3e250944289db95916b948893d26c)
2011-02-24 10:35:25 +01:00
Michael Adam
65f7a44987 persistent: reject trans3_control when a commit is already active.
This should actually never happen.

(This used to be ctdb commit f416e76838fe2adf629d4356d1cc87054b1af164)
2011-02-24 10:35:25 +01:00
Michael Adam
01c2c0c262 persistent: allocate the persistent state in the ctdb_db struct in trans3_commit
Make sure that ctdb_db->persistent_state is correctly NULL-ed when
the state is freed. This way, we can use ctdb_db->persistent_state
as an indication for whether a transaction commit is currently
running.

(This used to be ctdb commit 761cb235193564a0f337d0308f0a9e6de0ef2710)
2011-02-24 10:35:25 +01:00
Michael Adam
503b647319 persistent: add a ctdb_db context to the ctdb_persistent_state struct.
(This used to be ctdb commit a14917c983c3b9bbbf38f5ddeecdbbe5bde32364)
2011-02-24 10:35:25 +01:00
Michael Adam
76acf72bc5 persistent_callback: print "no error message given" instead of "(null)"
(This used to be ctdb commit d871a38978219e004833608c11aae98fe47614b9)
2011-02-24 10:35:25 +01:00
Michael Adam
e050266690 persistent: reduce indentation for the finishing moves in ctdb_persistent_callback
(This used to be ctdb commit 2c2d1646eb753ea9561f085bcb101153267b052b)
2011-02-24 10:35:24 +01:00
Michael Adam
033ba0b466 persistent: if a node failed to update_record, trigger a recovery
and stop processing of the update_record replies in order to let
the recovery finish the trans3_commit control.

(This used to be ctdb commit cab95570dc1eefb08abbac5ae411c29f699b51cc)
2011-02-24 10:35:24 +01:00
Michael Adam
0c93a2932c persistent_store_timout: do not really time out the trans3_commit control in recovery
If a recovery was started, then all further processing of the update_record
controls sent by the trans3_commit control and timing them out is disabled.
The recovery should trigger sending the reply for the update record control
when finished.

(This used to be ctdb commit 983c1ca2e18ecd60fca69bfe9e116125cc695857)
2011-02-24 10:35:24 +01:00
Michael Adam
c9df23ae1d persistent_callback: ignore the update-recordreturn code of remote node in recovery
If a recovery was started, then all further processing of the update_record
controls sent by the trans3_commit control is disabled. The recovery should
trigger sending the reply for the update record control when finished.

(This used to be ctdb commit 12cf0619255b12230843cd8bb49cbfdea376ca2f)
2011-02-24 10:35:24 +01:00
Ronnie Sahlberg
c4006ce844 Add ctdb_fork(0 which will fork a child process and drop the real-time
scheduler for the child.

Use ctdb_fork() from callers where we dont want the child to be running
at real-time privilege.

(This used to be ctdb commit 58795a4c9e0624e20fa3e0023b65127053edd103)
2011-01-11 07:40:41 +11:00
Ronnie Sahlberg
5ef29f9f25 Update latency countes to show min/max and average
(This used to be ctdb commit 1919e949af4641ffe919123e44b02fb87c13ab9f)
2010-10-11 15:12:24 +11:00
Ronnie Sahlberg
39c367a68f Create macros to update the statistics counters and use these macros
everywhere instead of manipulating the coutenrs directly.

(This used to be ctdb commit 2e648df890e5713bc575965d87937827b068d0d7)
2010-09-29 12:14:24 +10:00
Ronnie Sahlberg
2e8aac6689 Merge commit 'rusty/ports-from-1.0.112' into foo
(This used to be ctdb commit 13e58d92f5f1723e850a82ae030d0ca57e89b1ee)
2010-08-19 13:17:56 +10:00
Rusty Russell
9fbb191b78 logging: give a unique logging name to each forked child.
This means we can distinguish which child is logging, esp. via syslog where we have no pid.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

(This used to be ctdb commit 68b3761a0874429b90731741f0531f76dcfbb081)
2010-08-18 11:46:32 +09:30
Rusty Russell
f93440c4b7 event: Update events to latest Samba version 0.9.8
In Samba this is now called "tevent", and while we use the backwards
compatibility wrappers they don't offer EVENT_FD_AUTOCLOSE: that is now
a separate tevent_fd_set_auto_close() function.

This is based on Samba version 7f29f817fa.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit 85e5e760cc91eb3157d3a88996ce474491646726)
2010-08-18 09:16:31 +09:30
Ronnie Sahlberg
d7c00d8d7e Drop the debug level for logging fd creation to DEBUG_DEBUG
(This used to be ctdb commit eae1d4f9e52e73b4d8769868fffdafa590d03784)
2010-02-04 06:37:41 +11:00
Stefan Metzmacher
94bc40307a server: Use tdb_check to verify persistent tdbs on startup
Depending on --max-persistent-check-errors we allow ctdb
to start with unhealthy persistent databases.

The default is 0 which means to reject a startup with
unhealthy dbs.

The health of the persistent databases is checked after each
recovery. Node monitoring and the "startup" is deferred
until all persistent databases are healthy.

Databases can become healthy automaticly by a completely
HEALTHY node joining the cluster. Or by an administrator
with "ctdb backupdb/restoredb" or "ctdb wipedb".

metze

(This used to be ctdb commit 15f133d5150ed1badb4fef7d644f10cd08a25cb5)
2009-12-16 08:06:10 +01:00
Michael Adam
46de365e78 Add a new control CTDB_GET_DB_SEQNUM - fetch a persistent db's sequence number.
Michael

(This used to be ctdb commit a7e3b5fac6b3f5d74473f26eb86c067b35647996)
2009-12-12 00:45:39 +01:00
Michael Adam
faacd5ca79 server: add a new control CTDB_CONTROL_TRANS3_COMMIT
This is a simplified version of the trans2 commit control:
It just rolls out the marshall buffer to all active nodes.

It is the main ctdbd part of the re-implementation of the
persistent transactions. The client code is changed to
take a global lock to start a transactions and store into
the marshal buffer instead of writing to the local tdb
under a local transaction.

The old transaction implementation is going to be
removed in a later commit.

Michael

(This used to be ctdb commit f66428f9d2013080a414404c1ba6117888352fd6)
2009-12-12 00:43:26 +01:00
Michael Adam
c1039fba0e server:trans2_commit: move the check for active recovery down.
This needs to be done after the control-dispatcher:
In the TRANS2_COMMIT control, the client->db_id needs
to be set before bailing out, since otherwise the
next TRANS2_COMMIT_RETRY will fail...

Michael

(This used to be ctdb commit 59faf3f923a5989b5ee94ef02a12827412775bae)
2009-12-04 15:03:21 +01:00
Michael Adam
673a8588b1 server: fix debug message in trans2_commit (refusing persistent store during transaction)
log the right db_id
also log the client_id

Michael

(This used to be ctdb commit 48ac5c77698ab7a28d24629cc8a6985011c5d14d)
2009-10-30 09:29:25 +11:00
Michael Adam
1de0c6f807 server: uniformly log db and client ids as 8-digit hex numbers in trans2_commit
Michael

(This used to be ctdb commit 2febdd23f754a2d4699bed36b941442ab362a376)
2009-10-30 09:28:06 +11:00
Michael Adam
7384dfe4a9 server: line-wrap a debug statement in trans2_commit
Michael

(This used to be ctdb commit 3be446434adb0f3095ac0ef4b7c4a6258780b863)
2009-10-30 09:27:33 +11:00
Michael Adam
7bfa959a86 server: output client_id in some debug messages in trans2_commit
Michael

(This used to be ctdb commit 11fefd02e6c9531ffb28b9e6acaf42ba39757d87)
2009-10-30 09:26:51 +11:00
Michael Adam
4d073bd779 server: fix a debug message in trans2_commit - log the correct db_id
Michael

(This used to be ctdb commit ab9657b5a66d5665e6c5fd1bf8eb4074a3bffeec)
2009-10-30 09:26:16 +11:00
Michael Adam
dca16d5f64 server: extend a debug message in ctdb_control_trans2_error()
Michael

(This used to be ctdb commit 0fb9573d1c838b436ab9be83e197b68f35f94acb)
2009-10-30 09:24:17 +11:00
Michael Adam
2187e6c379 server: add positive debug statements to trans2_commit and trans2_finished
When the operation completed / started successfully.

Michael

(This used to be ctdb commit 0df012d58eb83195ea0365be19e0566dbc394a66)
2009-10-30 09:23:29 +11:00
Michael Adam
0113744fec server: trans2_active: don't report a transaction active on the node that performs the transaction
Otherwise a node can lock itself out, e.g. when a commit control times out...

Michael

(This used to be ctdb commit cb432e30351d5e5a41e98da3c7b1c2a4d400a3a2)
2009-10-30 09:22:18 +11:00
Ronnie Sahlberg
023d09cd38 Revert "update the "uptime" command to indicate the "time since last" is the time since the last recovery OR failover."
This reverts commit 3b0d44497800a16400d05a30bdaf6e6c285d4b36.

(This used to be ctdb commit cb36bbb5418290e8e5b770d2d836285b15da2a6f)
2009-10-29 10:49:00 +11:00
Ronnie Sahlberg
279b7ca564 update the "uptime" command to indicate the "time since last" is the time since the last recovery OR failover.
(This used to be ctdb commit 3b0d44497800a16400d05a30bdaf6e6c285d4b36)
2009-10-29 10:37:10 +11:00
Michael Adam
abac42ca34 server: add a new ctdb control CTDB_TRANS2_ACTIVE
This aske the daemon wheter a transaction is currently active on a
given DB on that node. More precisely this asks for the transaction_active
flag in the ctdb_db_context that is set in the CTDB_TRANS2_COMMIT
control and cleared in the CTDB_TRANS2_ERROR or CTDB_TRANS2_FINISHED controls.

This will be useful for fixing race conditions in the transaction code.

Michael

(This used to be ctdb commit 8d430ae6968dfe566614379436fc3c56003fcd88)
2009-10-29 10:14:30 +11:00
Michael Adam
769a36c048 In ctdb_ltdb_store(), add a missing transaction_cancel when local store failed.
Spotted by Volker.

Michael

(This used to be ctdb commit 0a4d409baabf242a87c06293789d589c896b104c)
2009-10-21 12:49:59 +11:00