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

3554 Commits

Author SHA1 Message Date
Ronnie Sahlberg
b01dc029ca ReadOnly: After recovering all databases, make sure to clear out the tracking database used to track delegations and revoke. This is because the recovery will implicitely result in a revoke of all delegations.
(This used to be ctdb commit b5520933b9922d6af6f59f535824e1cdacb9f774)
2011-08-23 10:24:44 +10:00
Ronnie Sahlberg
1441b77cce ReadOnly: Add "readonly" flag to the ctdb_db_context to indicate if this database supports readonly operations or not. Add a private lock-less tdb file to the ctdb_db_context to use for tracking delegarions for records
Assume all databases will support readonly mode for now and se thte flag for all databases. At later stage we will add support to control on a per database level whether delegations will be supported or not.

(This used to be ctdb commit 502f86f79944df4bac9094f716e54110c511dc24)
2011-08-23 10:24:26 +10:00
Ronnie Sahlberg
6ff039d444 ReadOnly: After performing a recovery, clear out all flags related to readonly delegations and revoke
(This used to be ctdb commit 9985a97e11688f3f688bb84e1180fd57c42077f4)
2011-08-23 10:24:18 +10:00
Ronnie Sahlberg
49923d4fdc Add the missing "persistent" argument to db_exist()
The API for this function has changed since the 1.2 branch where readonly locks are being merged from

(This used to be ctdb commit d01b9716d3e50f4c6d102e8411f0401b0f499699)
2011-08-23 10:23:18 +10:00
Ronnie Sahlberg
b77142ccc0 ReadOnly: Add a new command 'ctdb cattdb'. This fucntion differs from 'ctdb catdb' in that 'cattdb' will always traverse the local tdb file only, while 'catdb' does a cluster traverse.
Since some record flags may differ between nodes in the cluster when read only delegations are in use, cattdb is needed when you need to know the exact flag settings on the current node itself.

(This used to be ctdb commit d2342b680a3a8160d903d12550b86ee21c8b277d)
2011-08-23 10:22:41 +10:00
Ronnie Sahlberg
a224631e7b ReadOnly: Add printing of the record flags when we are traversing a database to print its content.
(This used to be ctdb commit 5eaa9a8683babac27f9f0144ff4cb5364fcd54f6)
2011-08-23 10:17:30 +10:00
Ronnie Sahlberg
8f63a5dadd ReadOnly: Add 4 new record flags to handle read only delegation and revoking of delegations
(This used to be ctdb commit 875b0bede217547b51f02648b6a28a3c98b6b949)
2011-08-23 10:17:08 +10:00
Ronnie Sahlberg
b8d06cb41b ReadOnly: add a new test tool that does a fetchlock on a record, then bunps the RSN by 10 and writes the new content to the record as sprintf("%d", rsn)
(This used to be ctdb commit 151b25798f2a2c182fc9557c1c1ea0f3ef0ad3fe)
2011-08-23 10:13:10 +10:00
Ronnie Sahlberg
e8127f0e0f ReadOnly: Add clientside functions to send the UPDATE_RECORD control
(This used to be ctdb commit 74a5b3d7bafd8827a4ee80095fde5798263821e4)
2011-08-23 10:11:38 +10:00
Ronnie Sahlberg
9fdd258606 ReadOnly: Add test tool to validate the functions to manipulate and enumerate the bitmap of nodes to where we have readonly delegations
(This used to be ctdb commit bfdeda30ee0e359f06dd5714864f8beae22b0736)
2011-08-23 10:10:54 +10:00
Ronnie Sahlberg
f924b3f40e ReadOnly: Add helper functions to manipulate a TDB_DATA as a bitmap for nodes that we are tracking as having a readonly delegation
(This used to be ctdb commit d10084e62d37674bb8d9e31d457fd23e050545be)
2011-08-23 10:09:42 +10:00
Ronnie Sahlberg
00a870f759 ReadOnly records: Add a new RPC function FETCH_WITH_HEADER.
This function differs from the old FETCH in that this function will also fetch the record header and not just the record data

(This used to be ctdb commit c7196d16e8e03bb2a64be164d15a7502300eae0e)
2011-08-23 10:06:59 +10:00
Volker Lendecke
1cf1670f0a Fix a const warning
Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit e25559087c9752502580875f7e33f3c416c05f84)
2011-08-22 17:11:07 +02:00
Volker Lendecke
fff653d126 Remove an unused variable
Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit 04c3d9c7c9ffa8bb95b0bf1513fd79f6c1096a2f)
2011-08-22 17:11:07 +02:00
Volker Lendecke
85bc1ccb7e libctdb: "unpack_reply_control" does not need the ctdb_connection parameter
Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit bb8f68f0256c43fe0671fe45023d1c88e340ad96)
2011-08-22 17:11:07 +02:00
Volker Lendecke
da528a65b1 libctdb: "unpack_reply_call" does not need the ctdb_connection parameter
Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit 77ae553249ef1e1d467d792ac033f2aaa4e337e6)
2011-08-22 17:11:07 +02:00
Volker Lendecke
21bb8abc93 libctdb: "ctdb_request_free" does not need the ctdb_connection parameter
Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit 5a5ed2a43b76bec69494b6cdc6451527f5c472e5)
2011-08-22 17:11:07 +02:00
Volker Lendecke
b0706be89e libctdb: Make sure ctdb_request->ctdb is filled correctly
Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit 06433d20a43d41f05b96a9dda6dc5931539feaa3)
2011-08-22 17:11:06 +02:00
Volker Lendecke
8638b5f5d2 libctdb: Ensure 0-termination of sun_path
Rusty, please check!

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

(This used to be ctdb commit 955f67a02026b157440d2ae87ead193773331e75)
2011-08-22 17:11:06 +02:00
Volker Lendecke
b4fd8024b5 libctdb: Fix a few format warnings
Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit fa6564c24429e084be728dbe6eea1dec13e58709)
2011-08-22 17:11:06 +02:00
Volker Lendecke
ef64060898 libctdb: Add license header to messages.c
Rusty, please check!

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

(This used to be ctdb commit 4bceba374be82e76ba5d9d923172e85e9365b990)
2011-08-22 17:11:06 +02:00
Volker Lendecke
d55e6cf53c libctdb: Reorder attachdb
No code change, this is for easier reading the sequence of what happens

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

(This used to be ctdb commit 883b9b185dce03a6bf233fbf2cfabad9883519e5)
2011-08-22 17:11:06 +02:00
Volker Lendecke
a31d7516f5 libctdb: Reorder set_message_handler
No code change, this is for better readability

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

(This used to be ctdb commit e0f93459e05eef33024096654b4aaf1eb3c6d7c4)
2011-08-22 17:11:06 +02:00
Volker Lendecke
19f31f86ac libctdb: Correct 4bfdfda, stddef.h is needed by libctdb_private.h
Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit 683caa7bbf45d5b6791e53e2f3ee6d0ac3b08f28)
2011-08-22 17:11:06 +02:00
Volker Lendecke
452f6504a0 Add missing #include to libctdb/ctdb.c
We need that to have the "offsetof" macro, thus we don't need to redeclare it
in libctdb_private.h

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

(This used to be ctdb commit 4bfdfdae4f8ab23f14bc6ab4c06b66c07714ec17)
2011-08-17 15:12:46 +02:00
Ronnie Sahlberg
02ebd35398 Merge remote branch 'martins/eventscripts'
(This used to be ctdb commit bb008c01989ebb173a3f095ebd2f90ab54f9da91)
2011-08-17 14:10:04 +10:00
Martin Schwenke
6e7dbf0543 Eventscripts - new default TCP port checker using "ctdb checktcpport"
New function ctdb_check_tcp_ports_ctdb().  This should be fast... and
is now the default checker.  If it fails in an unexpected way we fall
back to the nmap and netstat checkers.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit a1e16a707ce204817531a61455000361f972080a)
2011-08-17 14:02:45 +10:00
Martin Schwenke
1374327f6e Eventscripts - generalise TCP port checking plus new nmap-based checker
Split the netstat-specific parts of ctdb_check_tcp_ports() into new
function ctdb_check_tcp_ports_netstat().

Implement new ctdb_check_tcp_ports_nmap() function that uses
"nmap -PS" to check if the desired ports are listening.

ctdb_check_ctdb_ports() now uses new configuration variable
CTDB_TCP_PORT_CHECKERS to decide which port checkers to try.  Default
value is currently "nmap netstat".  If nmap is not found then this
will fall back to netstat - if logging is at debug level this will
also fill the logs with message saying the nmap checker failed.  This
indicates that either nmap should be installed or the default value of
CTDB_TCP_PORT_CHECKERS should be changed (in a configuration file) to
avoid trying to use nmap.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit d9651175b40b9454e7d4e98291955fcf1445085e)
2011-08-17 12:12:20 +10:00
Martin Schwenke
62f654d3d2 Eventscripts - ctdb_check_tcp_ports() only prints netstat output if debugging
Use the new debug function to conditionally print the netstat output.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 44c14aeeb11080980fe07c7396d06843a4870747)
2011-08-17 10:39:54 +10:00
Martin Schwenke
86792724a2 Eventscripts - weaken TCP port check message if CTDB has just been started.
Sometimes smbd and other services can take a while to start,
especially when there is a lot of activity after ctdbd has just
started.  The TCP port check can then pollute the logs with lots of
"ERROR" messages and possibly extra debug.

This creates a flag file when a service is started (but not restarted)
and this flag is removed the first time that TCP port checks succeed
for that service.  When a port check fails and the flag file still
exists, a less extreme "INFO" message is printed rather than the usual
"ERROR" message.  This means that until the node actually becomes
healthy we see more friendly messages.

The subtext is that we're hearing false positive reports "recreates"
of CQ S1024874 (samba stopped responding on port 445) quite often when
ctdbd is started.  This reduces the chances of people reporting such
false recreates...

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 571865eb6ef847857129d0b1e2ba5fa7254bfe8c)
2011-08-17 10:39:53 +10:00
Martin Schwenke
5c9fbb55ce Eventscript functions: optimise ctdb_check_tcp_ports() and add debug.
ctdb_check_tcp_ports() runs "netstat -a -t -n" in a loop for each
port.  There are 2 problems with this:

* Netstat is run on each loop iteration when it need only be run once.

* The -a option is used to list all connections but the function only
  cares about the listening ports.  There may be many thousands of
  non-listening ports to grep through.

This changes ctdb_check_tcp_ports() to run netstat with the -l option
instead of the -a option.  It also only runs netstat once before the
main loop.

When a port is found to not be listening the output of the netstat
command is now dumped to help with debugging.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 830355a8b18c53cfcc3ad1e3009bbb1a7a681fa0)
2011-08-17 10:39:53 +10:00
Martin Schwenke
f0f9271301 Eventscripts: add a debug() function and call ctdb_set_current_debuglevel()
The debug function passes its arguments to echo if
$CTDB_CURRENT_DEBUGLEVEL is >= 4 (i.e. DEBUG).  If no args are given
then use stdin - this allows the function to be used with here
documents.

To ensure $CTDB_CURRENT_DEBUGLEVEL is set,
ctdb_set_current_debuglevel() is called near the end of the functions
file.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 6143483d9f87322578c00f12081e381f425226ca)
2011-08-17 10:39:35 +10:00
Ronnie Sahlberg
9d0a5b167c Add a new command 'ctdb checktcpport <port>'
that tries to bind to the specified port on INADDR_ANY.

This can be used for testing if a service is listening to that port or not.

Errors are printed to stdout and the returned status code is either 0 : if we managed to bind to the port (in which case the service is NOT listening on that bort) or the value of errno that stopped us from binding to a port.

errno for EADDRINUSE is 98 so a script using this command should check the status code against the value 98.
If this command returns 98 it means the service is listening to the specified port.

(This used to be ctdb commit 04cbb490c5a075080923fde58af7082572c55c43)
2011-08-17 10:20:19 +10:00
Ronnie Sahlberg
ce4555b7a6 dont use a too big persistence timeout value
(This used to be ctdb commit 82628e32c431d66b806399ffb9657c3a031f6428)
2011-08-17 10:00:06 +10:00
Martin Schwenke
3e1a0528b8 Eventscripts - conditionally inherit ctdbd debug level in each monitor event
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit a7eebc06f81a7b0a3fba93759bcbdeabc8c2e86e)
2011-08-17 09:14:23 +10:00
Martin Schwenke
171bef3d68 Eventscripts - new function ctdb_set_current_debuglevel()
This function ensures that CTDB_CURRENT_DEBUGLEVEL is set.  It works
like this:

1. If it is already set then do nothing, since it might have been set
   some other way.

   The recommended "other way" would be to add a file in rc.local.d/.

2. If it is not set then set it by sourcing
   /var/ctdb/eventscript_debuglevel.

3. If this file does not exist then create it using output from "ctdb
   getdebug".

If the optional 1st argument is set to "create" then don't source an
existing file but create a new one instead - this is useful for
creating the file just once in each event run in, say, 00.ctdb.

If there's a problem getting the debug level from ctdb then it is
silently set to 0 - no use spamming logs if our debug code is
broken...

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 93910921c8a25f2b029733cd938069ff7c7bdab7)
2011-08-17 09:00:46 +10:00
Martin Schwenke
430ca2f606 Eventscripts - ensure the statd update-trigger file always exists.
See the comment in the code for details.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 8ee9856996a8ec738e9d3ea7f1561605da526b8c)
2011-08-16 13:28:40 +10:00
Martin Schwenke
1452b63d27 Eventscripts: remove "return 0" from 50.samba service_stop().
This potentially masks errors and was basically included by accident.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit e7e4a1b4f31118027fd13a6223192f9957cf2e74)
2011-08-16 13:18:40 +10:00
Ronnie Sahlberg
81292ac0e6 Change the errors for 10.interface to clearly state ERROR: for error messages
Update the tests system to catch the new error strings generated by this change

(This used to be ctdb commit a2c30d88348da47d1a733a16e4c7d83c3becb6df)
2011-08-15 15:53:04 +10:00
Ronnie Sahlberg
569ea5c4e1 Merge remote branch 'martins/eventscript_tests'
(This used to be ctdb commit 4e670d9bc1bdeb2abd7e846bc36e02f0aa0d7309)
2011-08-15 15:43:15 +10:00
Martin Schwenke
65ff8b4b7b Tests - exportfs stub needs to print out export options.
This is needed due to bd39b91ad12fd05271a7fced0e6f9d8c4eba92e6.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 92f8e31f6995836b1668639a4dac2862efee269a)
2011-08-15 15:42:20 +10:00
Ronnie Sahlberg
1fb577f4b2 Merge remote branch 'martins/eventscript.10.interface'
(This used to be ctdb commit 0d17daab38d4086f922a8006d4c545133adca191)
2011-08-15 15:27:50 +10:00
Ronnie Sahlberg
bc00292cfe Merge remote branch 'martins/60_nfs_regression'
(This used to be ctdb commit 845fb0ba24cf9118470c58fae7103ab8322ce079)
2011-08-15 15:22:20 +10:00
Ronnie Sahlberg
2c5f1d7ccc Merge remote branch 'martins/eventscript.60.nfs.rpc'
(This used to be ctdb commit 2e30a2bb4371a846c7a768affa15883211642d5c)
2011-08-15 15:20:18 +10:00
Ronnie Sahlberg
775e188cb7 Merge remote branch 'martins/test_suite'
(This used to be ctdb commit f9899b1b96056d23628356589c855cf2262e5152)
2011-08-15 15:16:06 +10:00
Ronnie Sahlberg
846d1c77d6 Merge remote branch 'martins/eventscript_tests'
(This used to be ctdb commit 06b322ad6eff8d4e691f8e014b7d85983b261147)
2011-08-15 15:15:12 +10:00
Martin Schwenke
facd0ce624 Tests - ctdb listvars test should allow alphanumericals in tunable names.
This matches the new "LCP2PublicIPs" tunable.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 0680437bf5f02aeaed6387370e58bbdba2c04f28)
2011-08-15 13:56:26 +10:00
Ronnie Sahlberg
d1f5177374 Change the default for ip failover to be LCP2 and not DeterministicIPs
(This used to be ctdb commit 038916248a73d6a250108c9235c0c4f76dba8e0c)
2011-08-15 10:43:42 +10:00
Martin Schwenke
c9d168bbe4 Eventscripts: 10.interfaces - make startup event actually mark interfaces up!
The startup event intends to mark interfaces up.  However, it doesn't
actually do that because $INTERFACES is empty.

This uses the function get_all_interfaces() to list the
interfaces... and then mark them up.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit fc62bf0975c6059ee467285565d0dc3b4daaf238)
2011-08-12 16:34:34 +10:00
Martin Schwenke
5ab955a73d Eventscripts: 10.interfaces - startup comment says assume all interfaces good.
Interfaces are currently marked down.  Mark them up instead, as per
the comment... and discussion with Ronnie.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 35942841229cc72ce363a7236aec708f1a33136b)
2011-08-12 16:34:34 +10:00