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

2876 Commits

Author SHA1 Message Date
Ronnie Sahlberg
7f2f7364ad lower the loglevel for a debug message for redundant releases of public ips
(This used to be ctdb commit cfc1a4f878b61c85063af649d2339431e799647d)
2010-02-16 11:01:09 +11:00
Ronnie Sahlberg
64111bb02b Add a new variable : CTDB_NFS_SKIP_KNFSD_ALIVE_CHECK
when set to "yes" this will skip checking if knfsd has hung or not.

bz59626

(This used to be ctdb commit b0bf3794753c5bb898295b5109707953cc3dcec5)
2010-02-16 10:59:53 +11:00
Andrew Tridgell
c137725af8 fixed printing of high latency
(This used to be ctdb commit 88aacab30a36d66fe03d120bbf655edfe791ec32)
2010-02-16 10:58:24 +11:00
Martin Schwenke
47bebba8fe Test suite: Make "ctdb ip" test backward compatible with older ctdb versions.
Recent updates to the test meant that it only worked with the latest
ctdb versions.  This changes things so that we never bother matching
the machine readable header, just the actual data in the output.  It
also takes a slightly more liberal approach in massaging the human
readable output to ensure it matches the machine readable output.

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

(This used to be ctdb commit 8a1cb5dc1ddf82f3b9cbb23e40b3914b3d5c2783)
2010-02-10 20:27:53 +11:00
Martin Schwenke
d25ab9eca0 Merge commit 'origin/master'
(This used to be ctdb commit 19523fbb12db1ec1e5ee38de1b2d3b99a74c6ca4)
2010-02-10 20:24:28 +11:00
Ronnie Sahlberg
e01c8454ef commands that relate to manual failover of ip addresses (moveip)
can sometimes take long so allow for a longer timeout for the controls used.

(This used to be ctdb commit 144c69b633eeb17e120f962162feed6de3dc16a6)
2010-02-09 18:34:47 +11:00
Ronnie Sahlberg
ca9386a7f4 dont just exit(0) upon successful completion of waiting for an ipreallocate to finish.
return success back to the caller instead.

otherwise things like 'ctdb enable -n all' will just finish after the first disabled node has become enabled.

(This used to be ctdb commit f4eb41cd3a1099da8265351818fba9bd4688a188)
2010-02-09 14:35:10 +11:00
Rusty Russell
34b8b98078 event scripts: add logging for low memory conditions
We should never enter swap; if we do, show the memory state of the machine and the process list.  This will help us diagnose what caused the condition before it's too late and the box starts OOM-killing processes.

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

(This used to be ctdb commit 627a6d67a0e9e61f8713e62695b3518c51909230)
2010-02-09 12:46:35 +10:30
Andrew Tridgell
2406733ed2 ctdb: migrate to new dlinklist.h from Samba
(This used to be ctdb commit f63c091f12f8d582e9518673365c7c52479c470c)
2010-02-09 09:20:55 +11:00
Martin Schwenke
e128e590b3 onnode documentation - update documentation to reflect recent onnode changes.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 2fb2eb0fd7396de33474ce43fe95c66a5784d05b)
2010-02-05 15:30:39 +11:00
Martin Schwenke
240625fe9d Merge branch 'master' of git://git.samba.org/sahlberg/ctdb
(This used to be ctdb commit a442668923d4d8f8d624e00138fe37d76d593d21)
2010-02-05 14:00:23 +11:00
Andrew Tridgell
f23b82b58c ctdb: when we fill the client packet queue we need to drop the client
We can't just drop packets to the list, as those packets could be part
of the core protocol the client is using. This happens (for example)
when Samba is doing a traverse. If we drop a traverse packet then
Samba hangs indefinately. We are better off dropping the ctdb socket
to Samba.

(This used to be ctdb commit a7a86dafa4d88a6bbc6a71b77ed79a178fd802a6)
2010-02-04 15:37:59 +11:00
Andrew Tridgell
3eb9735be5 ctdb: move ctdb_io.c to use TLIST_*() macros
This will make large packet queues much more efficient

(This used to be ctdb commit e3f198056230073135ea6354bbef30c5bb022f8f)
2010-02-04 15:37:53 +11:00
Andrew Tridgell
5fd88a1c42 util: added TLIST_*() macros
The TLIST_*() macros are like the DLIST_*() macros, but take both a
head and tail pointer for the list. This means that adding an element
to the end of the list is efficient (it doesn't need to walk the
list).

We should move all uses of the DLIST_*() macros which use
DLIST_ADD_END() to use the TLIST_*() macros instead.

(This used to be ctdb commit 2d05a71349e9ade869b62cf261c2a9a21818a474)
2010-02-04 15:37:45 +11:00
Ronnie Sahlberg
7a889c5f1d When trying to enable/disable a node.
Check if the node is already enabled/disabled and log an information
message if so.

(This used to be ctdb commit c3eec8f10764a647106087099eeb47b7196f7aac)
2010-02-04 10:03:21 +11:00
Ronnie Sahlberg
a2857b1504 We only queued up to 1000 packets per queue before we start dropping
packets, to avoid the queue to grow excessively if smbd has blocked.

This could cause traverse packets to become discarded in case the main
smbd daemon does a traverse of a database while there is a recovery
(sending a erconfigured message to smbd, causing an avalanche of unlock
messages to be sent across the cluster.)

This avalance of messages could cause also the tranversal message to be
discarded  causing the main smbd process to hang indefinitely waiting
for the traversal message that will never arrive.

Bump the maximum queue length before starting to discard messages from
1000 to 1000000 and at the same time rework the queueing slightly so we
can append messages cheaply to the queue instead of walking the list
from head to tail every time.

(This used to be ctdb commit 59ba5d7f80e0465e5076533374fb9ee862ed7bb6)
2010-02-04 09:54:06 +11:00
Ronnie Sahlberg
7a5254ae69 add two new debug controls to send and receive messages
ctdb msglisten and msgsend

(This used to be ctdb commit 8c89aac20260dc7f3746e29fe99f17422a77cb88)
2010-02-04 09:45:32 +11:00
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
Volker Lendecke
68273bbab8 tdb: fix an early release of the global lock that can cause data corruption
There was a bug in tdb where the

                tdb_brlock(tdb, GLOBAL_LOCK, F_UNLCK, F_SETLKW, 0, 1);

(ending the transaction-"mutex") was done before the

                        /* remove the recovery marker */

This means that when a transaction is committed there is a window where another
opener of the file sees the transaction marker while the transaction committer
is still fully functional and working on it. This led to transaction being
rolled back by that second opener of the file while transaction_commit() gave
no error to the caller.

This patch moves the F_UNLCK to after the recovery marker was removed, closing
this window.

(This used to be ctdb commit 898b5edfe757cb145960b8f3631029bfd5592119)
2010-02-02 07:52:15 +11:00
Martin Schwenke
56b178e1a2 eventscripts: stop loadconfig function from loading ctdb config file twice.
If "$1" was empty than loadconfig would load the ctdb config twice.
This stops that from happening.

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

(This used to be ctdb commit 0406d406da70aaee7ad6aac236114905c5d03ed2)
2010-01-22 17:19:12 +11:00
Martin Schwenke
407a8f7205 eventscript: Use of $NFS_TICKLE_SHARED_DIRECTORY must be after loadconfig.
Proper fix for 085d1bea78fabf754ef6dd6d323f74a1d361e45c's workaround.
$NFS_TICKLE_SHARED_DIRECTORY was being used before it is set via
loadconfig.

Ronnie actually spotted this one.  :-)

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

(This used to be ctdb commit ee8b2e298351d05197a2e1494f3331433644c1e6)
2010-01-22 17:14:50 +11:00
Martin Schwenke
02e68340e8 initscript: Remove bash-ism.
Also, change the order of the comparison so it is consistent with
others in the script.

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

(This used to be ctdb commit 44696e15cdb23e7656d3bb0ead54f509495738a7)
2010-01-22 17:13:17 +11:00
Martin Schwenke
d6b0578cfb initscript: handle spaces in option values inserted into $CTDB_OPTIONS.
This puts single quotes around everything and uses eval on the
command-lines that actually start ctdbd.  The eval causes the single
quotes to be interpreted.

The "redhat" init style no longer uses the Red Hat daemon function.
It loses the quoting and re-splits on spaces.  Instead we add an extra
line that uses the success/failure functions to keep things pretty.
Note that this means that we don't respect daemon's
$DAEMON_COREFILE_LIMIT variable but we do our own core file handling
with $CTDB_SUPPRESS_COREFILE anyway.  daemon's core file handling was
probably overriding what we were doing anyway, so this can be regarded
as a bug fix.

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

(This used to be ctdb commit 522fbb012524fe41a67dbe43589a282dda6bcbe2)
2010-01-22 15:34:21 +11:00
Martin Schwenke
52dbd65825 onnode: update algorithm for finding nodes file.
2 changes:

* If a relative nodes file is specified via -f or $CTDB_NODES_FILE but
  this file does not exist then try looking for the file in /etc/ctdb
  (or $CTDB_BASE if set).

* If a nodes file is specified via -f or $CTDB_NODES_FILE but this
  file does not exist (even when checked as per above) then do not
  fall back to /etc/ctdb/nodes ((or $CTDB_BASE if set).  The old
  behaviour was surprising and hid errors.

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

(This used to be ctdb commit 60aa570aaa77d293b963105b3f605f9625a4594b)
2010-01-21 18:52:44 +11:00
Martin Schwenke
7569b21f2d onnode - respect $CTDB_BASE rather than hard-coding /etc/ctdb.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 503e4908b3028330bc25dc6de8561dbd53ee6a8d)
2010-01-21 18:52:31 +11:00
Stefan Metzmacher
12c8dd215c config: 10.interface: search "ethtool" in $PATH instead of using a hardcoded path
This is very useful for testing, I use such a script:

cat ~/bin/ethtool
 #!/bin/sh

 IFACE=$1

 case "$IFACE" in
        Neth2)
                ;;
        Neth3)
                ;;
        Neth4)
                ;;
        Neth5)
                ;;
        *)
                exec /usr/sbin/ethtool $@
                ;;
 esac

 ip link set down $IFACE

 exec /usr/sbin/ethtool $@

metze

(This used to be ctdb commit 3bab985cf615720eded4d47b4f9f37a9c28840aa)
2010-01-20 11:11:04 +01:00
Stefan Metzmacher
dbe912793e server: reload the public addresses before doing a takeover run
metze

(This used to be ctdb commit 0e41a2204fa8a1e77dc83c0d4b253ab272b5c72d)
2010-01-20 11:11:04 +01:00
Stefan Metzmacher
76cb4ce34c server: ban ourself if the ctdb and kernel knowledge of a public ip differs
metze

(This used to be ctdb commit 48e0af91113d6cead6cae3f28d8d8f610cacaa71)
2010-01-20 11:11:04 +01:00
Stefan Metzmacher
405368eeb0 server: give an error if we're getting an takeover_ip event with a wrong pnn
metze

(This used to be ctdb commit 2f44d6f3d290cc1b37b19ec34edfbad12cc0c0a7)
2010-01-20 11:11:04 +01:00
Stefan Metzmacher
a5ba5c129a server: return an error if we get an takeover ip event and we cannot serve the ip
metze

(This used to be ctdb commit f5c221e6abc118aefa489aa7e07755af952fd2bb)
2010-01-20 11:11:03 +01:00
Stefan Metzmacher
55d824bd77 server: print node number as signed integer on release ip event
metze

(This used to be ctdb commit 6c456face30606641f6b8beaad3121c9b05ca763)
2010-01-20 11:11:03 +01:00
Stefan Metzmacher
c5e579b56a server: debug redundant takeover ip events with level INFO
metze

(This used to be ctdb commit 7bc9969c4c28f2c4a4848bd730db3c63bb9204fe)
2010-01-20 11:11:03 +01:00
Stefan Metzmacher
ffdf32dedf server: be less verbose on redundant release_ip events
metze

(This used to be ctdb commit 72ef5f891f85ce51f5ca7e0c03d0c7cc955be110)
2010-01-20 11:11:03 +01:00
Stefan Metzmacher
58d7c44b1c server: add a ctdb_do_updateip()
metze

(This used to be ctdb commit eded224368dded2264e53546c196b1b485cb2094)
2010-01-20 11:11:02 +01:00
Stefan Metzmacher
aa485b17bb server: split out a ctdb_do_takeover_ip() function
metze

(This used to be ctdb commit 8fd6f4aab0c173b4c9c4c02c546e7d2ec1a98423)
2010-01-20 11:11:02 +01:00
Stefan Metzmacher
da59e0b162 server: split out a ctdb_announce_vnn_iface() function
metze

(This used to be ctdb commit ec87a51660cfa8a6851923f757fed31f7ffc7153)
2010-01-20 11:11:02 +01:00
Stefan Metzmacher
ea5843075c events: add updateip event to 13.per_ip_routing
metze

(This used to be ctdb commit 829150e814a5e6c85d0f21421f46f41e81d74c53)
2010-01-20 11:11:02 +01:00
Stefan Metzmacher
6a818e66ae events: 10.interface handle updateip event
metze

(This used to be ctdb commit a5cdf1277387f8c6292153c37fa9ceb64707d04f)
2010-01-20 11:11:02 +01:00
Stefan Metzmacher
98ee69c66d server: add updateip event
metze

(This used to be ctdb commit 712ed0c4c0bff1be9e96a54b62512787a4aa6259)
2010-01-20 11:11:01 +01:00
Stefan Metzmacher
50bff8c886 config: add CTDB_PARTIALLY_ONLINE_INTERFACES to ctdb.sysconfig
With this option set to "yes", we don't become unhealthy
as long as at least one interface is still available.

metze

(This used to be ctdb commit d054eb33c6ae92560cddb40732e5dcf622591a3c)
2010-01-20 11:11:01 +01:00
Stefan Metzmacher
179c098e86 server: start with disabled interfaces and let the event scripts enable the interfaces explicit
This makes sure that we don't get public addresses assigned during the
initial recovery and remove them again in the startup event.

metze

(This used to be ctdb commit f872e8c63a2f8979e6a0d088630575bdd4d7b4f1)
2010-01-20 11:11:01 +01:00
Stefan Metzmacher
5d2c3ef656 config: 10.interfaces call monitor_interfaces on startup
metze

(This used to be ctdb commit 615dec051c26aac628f120e96bf12fb39fc6d28a)
2010-01-20 11:11:01 +01:00
Stefan Metzmacher
94e7101070 config: 10.interfaces call ctdb ifaces and ctdb setifacelink for monitoring
metze

(This used to be ctdb commit c465f63585c419ba59a6b04cbbf78ae615a7259d)
2010-01-20 11:11:01 +01:00
Stefan Metzmacher
9c89dd9210 events: splitout a monitor_interfaces function in 10.interface
metze

(This used to be ctdb commit b5ba56dea57db97d6c6ba3e7582e74fe0e3041fc)
2010-01-20 11:11:01 +01:00
Stefan Metzmacher
5fa6a51388 server: monitor interfaces in verify_ip_allocation()
metze

(This used to be ctdb commit 965a65520693e3731b5b0250127b04c777087808)
2010-01-20 11:11:01 +01:00
Stefan Metzmacher
22ade0e456 server: only trigger one takeover run in verify_ip_allocation()
metze

(This used to be ctdb commit 10bc087d0280057962177721bdd6d4f28743b311)
2010-01-20 11:11:01 +01:00
Stefan Metzmacher
f2854f75c8 tools/ctdb: add PartiallyOnline state for "ctdb status" and "ctdb status -Y"
This is based on the GET_IFACES control against each node.

metze

(This used to be ctdb commit 38cb972382a09f830673277d0a9bd5d20deafff2)
2010-01-20 11:11:00 +01:00
Stefan Metzmacher
a6437bc707 tools/ctdb: display interfaces in "ctdb ip" and "ctdb ip -Y" outputs
metze

(This used to be ctdb commit dffa2b05acce8b73c2fdd085311732bf57f01b7f)
2010-01-20 11:11:00 +01:00
Stefan Metzmacher
0054f0c54f tests: add a all_ips_on_node() helper function that wraps ctdb ip -Y
metze

(This used to be ctdb commit c24fbea156dfdc9154e94eace725526e44cbcdac)
2010-01-20 11:11:00 +01:00
Stefan Metzmacher
04d896a5fe tests/simple/11_ctdb_ip.sh: be more strict in checking ctdb ip -Y output
metze

(This used to be ctdb commit 27bde04966e22975777b4034dbaccfe158369110)
2010-01-20 11:11:00 +01:00
Stefan Metzmacher
df5805d6a0 tools/ctdb: add "ctdb ipinfo <ip>"
metze

(This used to be ctdb commit e05e236fc019bfd3b316609a7c190e0e028a4bbc)
2010-01-20 11:11:00 +01:00
Stefan Metzmacher
a6803f42a5 tools/ctdb: add "ctdb setifacelink <iface> <status>"
metze

(This used to be ctdb commit 8d0c00b60db69bd10f12da4c676e1142dc37af7a)
2010-01-20 11:11:00 +01:00
Stefan Metzmacher
0ceef7036b tools/ctdb: add "ctdb ifaces"
metze

(This used to be ctdb commit 80053d09eed967fb76898f4a53437bed2b43a02f)
2010-01-20 11:11:00 +01:00
Stefan Metzmacher
f4f72024fe server: implement ctdb_control_set_iface_link()
This only marks the interface status and doesn't
generate any directly triggered action.

The actions is later taken by the recovery process
in verify_ip_allocation.

metze

(This used to be ctdb commit cff58b27c970e9252d131125941c372019fd6660)
2010-01-20 11:10:59 +01:00
Stefan Metzmacher
0dd7e1bfa1 server: implement ctdb_control_get_ifaces()
metze

(This used to be ctdb commit 0e982a416a126d9856145c19baef320cd0e71d66)
2010-01-20 11:10:59 +01:00
Stefan Metzmacher
80e3ab04de server: implement ctdb_control_get_public_ip_info()
metze

(This used to be ctdb commit 486fbd15f4cc4f45a4c110b2ddbba48bade22c9f)
2010-01-20 11:10:59 +01:00
Stefan Metzmacher
20e2f6199c client: implement ctdb_ctrl_set_iface_link()
metze

(This used to be ctdb commit e2d6582001be28c1800e4da8b0f2dc541538c314)
2010-01-20 11:10:59 +01:00
Stefan Metzmacher
a30513c1f8 client: implement ctdb_ctrl_get_ifaces()
metze

(This used to be ctdb commit a21e3765dd83e837d93111f387448bf0a5dd4652)
2010-01-20 11:10:59 +01:00
Stefan Metzmacher
11f643fa78 client: implement ctdb_ctrl_get_public_ip_info()
metze

(This used to be ctdb commit 4efab41dfa61d5c7951c583d584df3455ee9c704)
2010-01-20 11:10:59 +01:00
Stefan Metzmacher
32d00d0a0d controls: add stups for GET_PUBLIC_IP_INFO, GET_IFACES and SET_IFACE_LINK_STATE
metze

(This used to be ctdb commit a2c9e4578e149eccb2c6183f64a6b657eb95c5e1)
2010-01-20 11:10:59 +01:00
Stefan Metzmacher
37880b0d0a server: use CTDB_PUBLIC_IP_FLAGS_ONLY_AVAILABLE during a takeover run
We know ask for the known and available interfaces.
This means a node gets a RELEASE_IP event for all interfaces
it "knows", but doesn't serve and a node only gets a TAKE_IP event
for "available" interfaces.

metze

(This used to be ctdb commit a695a38e49e7c3e15a9706392dc920eeab1f11ba)
2010-01-20 11:10:59 +01:00
Stefan Metzmacher
d89604afab server: implement CTDB_PUBLIC_IP_FLAGS_ONLY_AVAILABLE behavior
metze

(This used to be ctdb commit 09a5c59bc8d1301edf60d7ae77504dc6d11a7da2)
2010-01-20 11:10:58 +01:00
Stefan Metzmacher
b9f6afe4b0 client: add CTDB_PUBLIC_IP_FLAGS_ONLY_AVAILABLE ctdb_ctrl_get_public_ips_flags()
metze

(This used to be ctdb commit 6bd780510058e5589f2f7c3722d37acbba4935ab)
2010-01-20 11:10:58 +01:00
Stefan Metzmacher
15616d3271 reserve upper bits in ctdb_control->flags for opcode specific flags
metze

(This used to be ctdb commit 91122c322fbec08138b92c528d9a946f6727b4fd)
2010-01-20 11:10:58 +01:00
Stefan Metzmacher
bea53c60b8 server: keep the interface information in a list of ctdb_iface structures
metze

(This used to be ctdb commit ff5291778f0752e176539397e9530dcf0e546bea)
2010-01-20 11:10:58 +01:00
Stefan Metzmacher
539ebdc94c server: we don't need to copy strings we pass as talloc_asprintf() arguments
metze

(This used to be ctdb commit 080ba5ac2195fb73ef6f18740abdde57a7b97151)
2010-01-20 11:10:58 +01:00
Stefan Metzmacher
9a43f5e42b events: 10.interfaces allow multiple interfaces per public address
metze

(This used to be ctdb commit f9837f8b6f887d28f29aeb3eeffe8cfb423b40b4)
2010-01-20 11:10:58 +01:00
Stefan Metzmacher
a1da4e05b5 server: allow multiple interfaces comma separated in public_addresses
metze

(This used to be ctdb commit 33a00ef7233051acdbc66410130ec5d876a8422f)
2010-01-20 11:10:58 +01:00
Stefan Metzmacher
8d50eda2b1 server: add a ctdb_vnn_iface_string() helper function to access vnn->iface
metze

(This used to be ctdb commit 9e5532e215892b2e0aadd9b106a730727f92c62e)
2010-01-20 11:10:58 +01:00
Stefan Metzmacher
bec35e6441 server: add a ctdb_set_single_public_ip() helper function
metze

(This used to be ctdb commit 400b4806c4a9686a2ee6398b5d7c3e0ca0793fd1)
2010-01-20 11:10:57 +01:00
Stefan Metzmacher
628ac65709 config: add 13.per_ip_routing event script
With this script it's possible to generate routing tables
per public ip address.

metze

(This used to be ctdb commit ff5678fbec2daef461143acf00cef3f94d7655fc)
2010-01-20 11:10:57 +01:00
Stefan Metzmacher
2ecf8053f9 config: add some ipv4 helper shell functions
Many thanks to Michael Adam <obnox@samba.org>
for the basic work.

metze

(This used to be ctdb commit ff9c641763702ae99632bbf4d0825d578440c074)
2010-01-20 11:10:57 +01:00
Stefan Metzmacher
4493ba6ffa config: add interface_modify.sh and call it under flock to make modification on interfaces atomic
When two releaseip events run in parallel it's possible that the 2nd script
readds a secondary ip that was removed by the 1st script.

metze

(This used to be ctdb commit e02417b2a55c45ac2c125b1b3463c9c39e7bc07a)
2010-01-20 11:10:48 +01:00
Stefan Metzmacher
c251ac20fa events/10.interfaces: move some parts to helper functions
metze

(This used to be ctdb commit 24cd42769d8f32b90a8876a6a08a36ab23076cd1)
2010-01-20 09:44:37 +01:00
Stefan Metzmacher
d01870f138 config/functions: add tickle_tcp_connections()
metze

(This used to be ctdb commit 2397f13d7b5ca3847ef148187c6b179d06f6a47a)
2010-01-20 09:44:37 +01:00
Stefan Metzmacher
fd06167caa server: add "init" event
This is needed because the "startup" event runs after the initial recovery,
but we need to do some actions before the initial recovery.

metze

(This used to be ctdb commit e953808449c102258abb6cba6f4abf486dda3b82)
2010-01-20 09:44:36 +01:00
Stefan Metzmacher
8456a1b0ef server: setup fault handler to get the build-in backtrace support
The panic action feature will be added later.

metze

(This used to be ctdb commit 37d11895e96ba8bc8c9ba159083970c45f76d9bb)
2010-01-20 09:44:36 +01:00
Stefan Metzmacher
78b78fc478 lib/util: add pre and post panic action hooks
metze

(This used to be ctdb commit e366e77ba170d2c27110c56004ae1adf97abef9e)
2010-01-20 09:44:36 +01:00
Stefan Metzmacher
9cba540514 lib/util: import fault/backtrace handling from samba.
metze

(This used to be ctdb commit 8171d66f0061fe23ed6dfef87ffe63bfc19596eb)
2010-01-20 09:44:36 +01:00
Stefan Metzmacher
b70ff7e4d1 configure: don't overwrite AC_CHECK_FUNC_EXT and AC_CHECK_LIB_EXT
This has curently no affect on the generated configure and config.h.in files.

metze

(This used to be ctdb commit 9d39ada437b02d84b70a5fea78b61bbb32f16d81)
2010-01-20 09:44:36 +01:00
Stefan Metzmacher
a309287947 move DEBUG* macros to one place
metze

(This used to be ctdb commit 4b4dd5d7f81bf226e05c7f3d40087043da1517a2)
2010-01-20 09:44:36 +01:00
Stefan Metzmacher
a23c409e73 tools/ctdb: display INACTIVE status in "ctdb status" and "ctdb status -Y"
metze

(This used to be ctdb commit 18af37e99ef8ff5623161495be432abfe5e3407f)
2010-01-20 09:44:36 +01:00
Stefan Metzmacher
2f36e78d88 server: add missing goto again after do_recovery()
metze

(This used to be ctdb commit 898894d3acbcc0add2ab0706a3172a446622f687)
2010-01-20 09:44:35 +01:00
Stefan Metzmacher
35a15ad7a9 lib/events: finish "Run only one event for each epoll_wait/select call"
This finished commit a78b8ea7168e5fdb2d62379ad3112008b2748576.

The logic was missing in events_standard (the one that's used by default).

metze

(This used to be ctdb commit 49f0488a5e60c74b6b8361dffcd09ebb2db740f0)
2010-01-20 09:44:35 +01:00
Ronnie Sahlberg
21e5b44673 source the nfs sysconfig file from the 61.nfstickles script
(This used to be ctdb commit 085d1bea78fabf754ef6dd6d323f74a1d361e45c)
2010-01-20 10:35:02 +11:00
Ronnie Sahlberg
88dc248ada document the in-memory ringbuffer for logging and the commands
used to set it up and manage it.

(This used to be ctdb commit 037e64e1900f09e699d5fce50df2850f26f47f91)
2010-01-15 16:01:51 +11:00
Ronnie Sahlberg
a1d60b1511 Make the size of the in memory ringbuffer for keeping the recent log messages
configureable using --log-ringbuf-size=<num-entries>.

Add an entry in the sysconfig file to set this persistently.

(This used to be ctdb commit c79c2da69bc352f509e7fca4b9172a4b7f23c0f8)
2010-01-15 15:38:56 +11:00
Ronnie Sahlberg
f066939a62 new version 1.0.113
(This used to be ctdb commit 4bcb07c412260147cd926452287885d05b2344c1)
2010-01-13 07:12:08 +11:00
Ronnie Sahlberg
62f87f0323 Merge commit 'metze/master-for-ronnie'
(This used to be ctdb commit 4cc9c79bfced9efa0d3817021512c86ed2fa3516)
2010-01-13 07:01:40 +11:00
Stefan Metzmacher
1eb8015ee0 server: call event_add_fd at the end of ctdb_set_child_logging()
metze

(This used to be ctdb commit 608e0765130aa9bca0aa77db5a888c413867a3fd)
2010-01-12 12:20:15 +01:00
Stefan Metzmacher
1b0f9c3db7 ctdb_logging: simplify ctdb_fork_with_logging a lot and reduce the syscall usage
metze

(This used to be ctdb commit acb98c36a3d56fa6b34747015b913ada3eaa133f)
2010-01-12 12:20:15 +01:00
Martin Schwenke
91fba1e121 New version 1.0.112.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 64ae8b0702cfdc44a778e0cc3705dd685f9f6ab0)
2010-01-12 21:07:45 +11:00
Martin Schwenke
b65a44a4ec Revert "Use wbinfo --ping-dc isntead of wbingo -p sicne this is a more reliable way to determine if winbindd is in a useful state."
This reverts commit 7c95e56ba871a4e0cb893a5cb5d821e7ff6e6dd6.

wbinfo --ping-dc is proving too unreliable.

(This used to be ctdb commit b70021856e76df1ba407c83cfc19bf332fbfc869)
2010-01-12 21:02:44 +11:00
Martin Schwenke
96066d8816 Revert "events/50.samba: only use wbinfo --ping-dc if available"
This reverts commit 7b73834ba3ac197cc8a3020c111f9bb2c567e70b.

wbinfo --ping-dc is proving too unreliable.

(This used to be ctdb commit 178f429a7b6d1008d35e857b6ca1df6adb60d255)
2010-01-12 21:02:11 +11:00
Martin Schwenke
39f9ded009 Merge commit 'origin/master'
(This used to be ctdb commit bb9fc8b4388848863fa2b8735bd77eb07b7b5849)
2010-01-07 12:46:26 +11:00
Ronnie Sahlberg
f34ba65d57 New version 1.0.111
(This used to be ctdb commit 484ae893f2179bebd0e2a2efe5f9619a39e48227)
2009-12-18 15:16:04 +11:00
Rusty Russell
565b2cda11 eventscript: fix bug when script is aborted
Another corner case when we terminate running monitor scripts to run
something else: logging can flush the output and we write to a NULL
pointer.

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

(This used to be ctdb commit eb22c34bccc8a04fcf63efa2bc48d9788709382e)
2009-12-18 14:48:41 +11:00
Rusty Russell
e757b7c4bf eventscript: remove cb_status, fix uninitialized bug when monitoring aborted
(Reapplied with merge after accidental revert)

Previously we updated cb_status a each script finished.  Since we're storing
the status anyway, we can calculate it by iterating the scripts array
itself, providing clear and uniform behavior on all code paths.

In particular, this fixes a longstanding bug when we abort monitor
scripts to run some other script: the cb_status was uninitialized.  In
this case, we need to hand *something* to the callback; 0 might make
us go healthy when we shouldn't.  So we use the last status (normally,
this will be the just-saved current status).

In addition, we make the case of failing the first fork for the script
and failing other script forks the same: the error is returned via the
callback and saved for viewing through 'ctdb scriptstatus'.

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

(This used to be ctdb commit 2c84fe393ff2b961abf77d58a371c24db5ecb93b)
2009-12-18 14:48:35 +11:00
Martin Schwenke
05dff92925 Merge commit 'origin/master'
(This used to be ctdb commit 82e1c5231c389bea935328a08ecf9b0b3a3979ef)
2009-12-18 14:44:25 +11:00
Martin Schwenke
d67f43fd50 Test suite: Add an optimisation in the getvar test.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit d9105ea79df198a20c2bfe471c4793d1dbba886e)
2009-12-18 14:43:45 +11:00
Martin Schwenke
5e92afeb33 Test suite: allow settign of timeout triggers for all events not just monitor.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit f319bd54369a2bc7d32c3bda7fc22f2ef1a51c3a)
2009-12-18 14:42:58 +11:00
Ronnie Sahlberg
01a0824288 Version 1.0.110
(This used to be ctdb commit 859e18db681dabe0990793d03f58e59a061aa8bb)
2009-12-18 12:32:58 +11:00
Rusty Russell
4dce0690de eventscript: fix cleanup path when setting up script list
We shouldn't set ctdb->current_monitor until we set destructor: that's
what cleans it up.

Also, free state->scripts on no-scripts exit path: it's not a child of
state because we need it in the destructor.

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

(This used to be ctdb commit 843a2ed5ef85f628788b0caf7417c6b61b5c6d3f)
2009-12-18 12:31:34 +11:00
Stefan Metzmacher
77c4a86351 server: add set_close_on_exec() on more fds
metze

(This used to be ctdb commit 7101ae80bf4e530f48e31e4c58707aa45a9fd3d5)
2009-12-17 14:41:07 +01:00
Stefan Metzmacher
bbfa4402e4 server: fix fd leaks in the new logging code
metze

(This used to be ctdb commit 140070dd81b39545fe2d56f70e9b9c96bfdae07f)
2009-12-17 13:05:39 +01:00
Ronnie Sahlberg
9b507abd6e version 1.0.109
(This used to be ctdb commit 99894a70fe2ebfe43daae7e88ff0fc9cab33e0fb)
2009-12-17 15:49:01 +11:00
Rusty Russell
8aec7e5656 eventscript: remove cb_status, fix uninitialized bug when monitoring aborted
Previously we updated cb_status a each script finished.  Since we're storing
the status anyway, we can calculate it by iterating the scripts array
itself, providing clear and uniform behavior on all code paths.

In particular, this fixes a longstanding bug when we abort monitor
scripts to run some other script: the cb_status was uninitialized.  In
this case, we need to hand *something* to the callback; 0 might make
us go healthy when we shouldn't.  So we use the last status (normally,
this will be the just-saved current status).

In addition, we make the case of failing the first fork for the script
and failing other script forks the same: the error is returned via the
callback and saved for viewing through 'ctdb scriptstatus'.

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

(This used to be ctdb commit 5d50f0e16948d18009f6623f132113f7273efc7f)
2009-12-17 15:39:46 +11:00
Ronnie Sahlberg
4c722fe34c fix a conflict in the merge from rusty
Merge commit 'rusty/ctdb-no-setsched'

Conflicts:

	server/ctdb_vacuum.c

(This used to be ctdb commit b4365045797f520a7914afdb69ebd1a8dacfa0d9)
2009-12-17 08:18:04 +11:00
Rusty Russell
af2613e16f ctdb: use mlockall, cautiously
We don't want ctdb stalling due to paging; this can be far worse than
scheduling delays.  But if we simply do mlockall(MCL_FUTURE), it
increases the risk that mmap (ie. tdb open) or malloc will fail,
causing us to abort.

This patch is a compromise: we mlock all current pages (including
10k of future stack for expansion) and then relock when a client
asks us to open a TDB.  We warn, but don't exit, if it fails.

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


(This used to be ctdb commit 82f778e85440bc713d3f87c08ddc955d3cfce926)
2009-12-16 20:57:20 +10:30
Rusty Russell
c488ba440a Remove RT priority, use niceness.
1) It's buggy.  Code needs to be carefully written (ie. no busy
   loops) to handle running with it, and we fork and run scripts.[1]

2) It makes debugging harder.  If ctdbd loops (as has happened recently)
   it can be extremely hard to get in and see what's happening.  We've already
   seen the valgrind hacks.

3) We have seen recent scheduler problems.  Perhaps they are unrelated,
   but removing this very unusual setup is unlikely to hurt.

4) It doesn't make anything faster.  Under all but the most perverse of
   circumstances, 99% of the cpu gives the same performance as 100%, and
   we will always preempt normal processes anyway.

[1] I made this worse in 0fafdcb8d353 "eventscript: fork() a child for
    each script" by removing the switch_from_server_to_client() which
    restored it, but even that was only for monitor scripts.  Others were
    run with RT priority.

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


(This used to be ctdb commit 482c302d46e2162d0cf552f8456bc49573ae729d)
2009-12-16 19:26:22 +10:30
Rusty Russell
f148735928 Add --valgringing flag instead of --nosetsched
The do_setsched was being tested for whether to mmap tdbs: let's make it
explicit.  We can also happily move the kill-child eventscript hack under
this flag.

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


(This used to be ctdb commit 2ee86cc1f311d7b7504c7b14d142b9c4f6f4b469)
2009-12-16 20:59:15 +10:30
Stefan Metzmacher
4626665b7e doc: regenerate manpages
metze

(This used to be ctdb commit e3825407a509110c786d618efcdfa56ba93380a5)
2009-12-16 08:08:34 +01:00
Stefan Metzmacher
fffb9d55b1 doc: fix docbook warnings for ctdb.1 and onnode.1 manpages
metze

(This used to be ctdb commit 0d1300aa2325c94d8fb1c3cf8d454e5eee43dde9)
2009-12-16 08:08:34 +01:00
Stefan Metzmacher
b22d893e91 doc/ctdb.1: update example "ctdb listvars" output
metze

(This used to be ctdb commit 33ec6943fb2d01b6df0ce4515d37c671b18d237f)
2009-12-16 08:08:34 +01:00
Stefan Metzmacher
685806d47f doc/ctdb.1: make clear the database is specified by name for "ctdb backupdb"
metze

(This used to be ctdb commit 9b4c76973a8cf03ddc1a9b3777a350f739c00892)
2009-12-16 08:08:34 +01:00
Stefan Metzmacher
3bfc58d47a doc/ctdb.1: document "ctdb getdbstatus <dbname>"
metze

(This used to be ctdb commit a90f3dd25a22f9b8777ff6946ce1721859e9479a)
2009-12-16 08:08:34 +01:00
Stefan Metzmacher
58dd03f43d doc/ctdb.1: add "See also" for ctdb getdbmap
metze

(This used to be ctdb commit bf48ae41ef5fb8e4675be448d13db522465d8d72)
2009-12-16 08:08:34 +01:00
Stefan Metzmacher
7809aa9a5d doc/ctdb.1: document "ctdb dumpdbbackup <file>"
metze

(This used to be ctdb commit 8e6b8be51fd1bda789675650a94df0115ee9e238)
2009-12-16 08:08:34 +01:00
Stefan Metzmacher
fa6d8641d9 doc/ctdb.1: document -Y output fot ctdb getdbmap
metze

(This used to be ctdb commit c09acd0896089a612ee3a1e78711abd98bd9cc99)
2009-12-16 08:08:34 +01:00
Stefan Metzmacher
0056cec9b4 doc/ctdb.1: document UNHEALTHY for "ctdb getdbmap"
metze

(This used to be ctdb commit 3cdb8be02acc23074c8137a54faea62fee4567a0)
2009-12-16 08:08:33 +01:00
Stefan Metzmacher
1634b44c74 doc/ctdb.1: document "ctdb wipedb"
metze

(This used to be ctdb commit fce390194dadb4961b46c706a1826442eef8c63d)
2009-12-16 08:08:33 +01:00
Stefan Metzmacher
96977cc5c4 config: add CTDB_MAX_PERSISTENT_CHECK_ERRORS option
metze

(This used to be ctdb commit fc5f556d488488040303438aefecb5ae2a8e54bc)
2009-12-16 08:08:33 +01:00
Stefan Metzmacher
0c735f03d4 config: try to use tdbtool <tdb> check instead of tdbdump for persistent db checks
metze

(This used to be ctdb commit 52e6d81f4d8a4035272d9256d01bafb8ed593027)
2009-12-16 08:08:33 +01:00
Stefan Metzmacher
a03cf0040b ctdb: print out some hints how to debug a "ctdb catdb" failure
metze

(This used to be ctdb commit 504cf78d00d1120b556124340b9312f890b8b8b9)
2009-12-16 08:08:33 +01:00
Stefan Metzmacher
965c000c6e ctdb: add machinereadable output fot "ctdb -Y getdbmap"
metze

(This used to be ctdb commit 45cfcd44093c7d2681e2ffd5cfb402823e8809f4)
2009-12-16 08:08:33 +01:00
Stefan Metzmacher
aa07a46bf5 ctdb: disallow "ctdb backupdb" on unhealthy databases
metze

(This used to be ctdb commit ecf799093c1989f5499c9d61ce8cc8a98d759160)
2009-12-16 08:08:33 +01:00
Stefan Metzmacher
c4bc231267 client: add "ctdb dumpdbbackup <filename>"
metze

(This used to be ctdb commit c63a0368d9d4b526ac1e49d891d3a1b7b8d20320)
2009-12-16 08:08:33 +01:00
Stefan Metzmacher
aa658b6777 client: make ctdb_dumpdb_record() public
metze

(This used to be ctdb commit 1cdc8dbb9cb971cf6dd6cd22b1adaf70ddc77e65)
2009-12-16 08:08:32 +01:00
Stefan Metzmacher
fb50e08942 tools/ctdb: let "ctdb restoredb" and "ctdb wipedb" mark the db as healthy on all
nodes

metze

(This used to be ctdb commit d1b10b0c0c323c39742a18e98a1dab7e82ddc7be)
2009-12-16 08:08:32 +01:00
Stefan Metzmacher
c56ce3d2f2 tools/ctdb: add "ctdb getdbstatus <dbname>"
metze

(This used to be ctdb commit 910c19f12448d293a755d1eb46d20f9591f8da7a)
2009-12-16 08:08:32 +01:00
Stefan Metzmacher
927dd3d9e5 tools/ctdb: display db health in "ctdb getdbmap"
metze

(This used to be ctdb commit c34535ff4dc6a44909283641596e0ed7c2316fbd)
2009-12-16 08:08:32 +01:00
Stefan Metzmacher
0e436b46c6 client: add ctdb_ctrl_getdbhealth()
metze

(This used to be ctdb commit 5abe44d0113839d3a45c9a31d30856aa70c2ea1f)
2009-12-16 08:08:32 +01:00
Stefan Metzmacher
f1f0af2b67 server: add CTDB_CONTROL_DB_SET_HEALTHY and CTDB_CONTROL_DB_GET_HEALTH
metze

(This used to be ctdb commit 7332d900538f0cbcd953a723417a0fe31dc9807c)
2009-12-16 08:08:29 +01: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
Stefan Metzmacher
9069d3a7fb server: move error handling to a 'fail' label in ctdb_control_transaction_commit()
metze

(This used to be ctdb commit d874463235fa299e83fe562291c688aca3b85cf3)
2009-12-16 08:03:56 +01:00
Stefan Metzmacher
8fbb5b7915 server/recovery: update flags on nodes before syncing dbs
metze

(This used to be ctdb commit 49d2dca9ad837e1b397294fb0e966bf0b77f751c)
2009-12-16 08:03:56 +01:00
Stefan Metzmacher
b74918b465 server: open /var/ctdb/state/persistent_health.tdb.X on startup
This node internal tdb will store the HEALTH state of persistent
tdbs.

metze

(This used to be ctdb commit cbda4666be88c11a810a192a70667b57f773ace1)
2009-12-16 08:03:56 +01:00
Stefan Metzmacher
7f05a423e2 server: create vactune.tdb.X with 0600 permissions
metze

(This used to be ctdb commit 21677ed6fb8c589f348321533c608cad58c4ec93)
2009-12-16 08:03:56 +01:00
Stefan Metzmacher
473f02ed48 server: create vactun.tdb.X under /var/ctdb/state
metze

(This used to be ctdb commit 1db17f312558fe59983a3465680e56c9f0c19e36)
2009-12-16 08:03:56 +01:00
Stefan Metzmacher
77d43d01aa server: create recdb.tdb.X in /var/ctdb/state/
metze

(This used to be ctdb commit 92e05282d6c4f16e55d914cc3bde3738ea2d44ad)
2009-12-16 08:03:56 +01:00
Stefan Metzmacher
9a96ae0c97 server: only do the mkdir() calls for db_directory* once at the start
metze

(This used to be ctdb commit f30f33685db50860b6cd6fd1b6bdc3066620a78f)
2009-12-16 08:03:56 +01:00
Stefan Metzmacher
b48228e7f9 server: add db_directory_state to ctdb_context
metze

(This used to be ctdb commit 656a6ec5ed81ccfbb86144156a3158e48f105ee4)
2009-12-16 08:03:55 +01:00
Stefan Metzmacher
cda5884854 server: create tdbs with 0600 permissions in ctdb_local_attach()
metze

(This used to be ctdb commit 6529a1328b9ec304ad306674651b2a67e4426e23)
2009-12-16 08:03:55 +01:00
Stefan Metzmacher
0c907f4965 config: load 'ctdb' config before 'nfs' config in statd-callout
All other scripts do 'loadconfig ctdb' before any other 'loadconfig foo'
call. I think we should do the same in statd-callout.

Otherwise it's very confusing, if you have configured some Options
in /etc/sysconfig/ctdb, but /etc/ctdb/statd-callout doesn't notice
them.

metze

(This used to be ctdb commit 10d95581fb90bfdf58ec32345c4e36c27acf4f37)
2009-12-16 08:03:55 +01:00
Stefan Metzmacher
003985acfd ctdb: pass TDB_DISALLOW_NESTING to all tdb_open/tdb_wrap_open calls
metze

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 1635e931b909c66eb3b1f5357e3a549b1a0da70d)
2009-12-16 08:03:55 +01:00
Simo Sorce
2d24073e97 Fix release script with newer versins of git
(cherry picked from commit 4334092cba)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 093f57a2c00f2d629a3b58e58202f1a7e1bbd406)
2009-12-16 08:03:54 +01:00
Matthias Dieter Wallnöfer
6e3a572135 tdb tools: Mostly cosmetic adaptions
Signed-off-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from samba commit 9776cb0345)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit d1873bd81bfc9f486b88f3a38c65c7de8f5a0909)
2009-12-16 08:03:54 +01:00
Stefan Metzmacher
859ffb09b6 tdb: change version to 1.2.0 after adding TDB_*ALLOW_NESTING
metze
(cherry picked from samba commit 5ca0a4bfd6)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 04aeac728f56c65b973762f09977de1b1b99099e)
2009-12-16 08:03:54 +01:00
Stefan Metzmacher
5cbf0183f3 tdb: add TDB_DISALLOW_NESTING and make TDB_ALLOW_NESTING the default behavior
We need to keep TDB_ALLOW_NESTING as default behavior,
so that existing code continues to work.

However we may change the default together with a major version
number change in future.

metze
(cherry picked from samba commit 3b9f19ed91)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit c1c0ede32dc00ed619d1cf5fda40a9de43995f3a)
2009-12-16 08:03:54 +01:00
Stefan Metzmacher
b768146ef5 tdb: always set tdb->tracefd to -1 to be safe on goto fail
metze
(cherry picked from samba commit 85449b7bcc)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 855391c1e37012b0d6c673a304bb8da8a1efcd72)
2009-12-16 08:03:53 +01:00
Volker Lendecke
e0f59b0a19 tdb: Fix a C++ warning (cherry picked from samba commit be88a126ea)
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 6126f04bd4982b66564dcccd92a15baf9cb856f3)
2009-12-16 08:03:53 +01:00
Kirill Smelkov
a96af9815b tdb: update README a bit
While studying tdb, I've noticed a couple of mismatches between readme
and actual code:

- tdb_open_ex changed it's log_fn argument to log_ctx
- there is now no tdb_update(), which it seems was transformed into
  non-exported tdb_update_hash()

There were other mismatches, but I don't remember them now, sorry.

Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(cherry picked from samba commit 83de5c8263)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 7a88f1df9190674deaf5dcbedad02ae4120a5263)
2009-12-16 08:03:53 +01:00
Kirill Smelkov
ad6e28c032 tdb: add tests for double .close() in pytdb
The reason I do it is that when using older python-tdb as shipped in
Debian Lenny, python interpreter crashes on this test:

    (gdb) bt
    #0  0xb7f8c424 in __kernel_vsyscall ()
    #1  0xb7df5640 in raise () from /lib/i686/cmov/libc.so.6
    #2  0xb7df7018 in abort () from /lib/i686/cmov/libc.so.6
    #3  0xb7e3234d in __libc_message () from /lib/i686/cmov/libc.so.6
    #4  0xb7e38624 in malloc_printerr () from /lib/i686/cmov/libc.so.6
    #5  0xb7e3a826 in free () from /lib/i686/cmov/libc.so.6
    #6  0xb7b39c84 in tdb_close () from /usr/lib/libtdb.so.1
    #7  0xb7b43e14 in ?? () from /var/lib/python-support/python2.5/_tdb.so
    #8  0x0a038d08 in ?? ()
    #9  0x00000000 in ?? ()

master's pytdb does not (we have a check for self->closed in obj_close()),
but still...

Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(cherry picked from samba commit 71a21393dd)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 03372b4ea8ba2938468a5c0fc234d604966ce070)
2009-12-16 08:03:53 +01:00
Kirill Smelkov
5ea8bd3851 tdb: reset tdb->fd to -1 in tdb_close()
So that erroneous double tdb_close() calls do not try to close() same
fd again. This is like SAFE_FREE() but for fd.

Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(cherry picked from samba commit b4424f8234)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit f5c992bdaeb73ef726ff4728a9922721474cd6f5)
2009-12-16 08:03:53 +01:00
Kirill Smelkov
8af1b8bf96 tdb: fix typo in python's Tdb.get() docstring
It's Tdb.get(), not Tdb.fetch().

Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(cherry picked from samba commit cfed5f946d)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 76aacdd8e1106f26565e25903091a757b59cd7e2)
2009-12-16 08:03:53 +01:00
Andrew Tridgell
a51ad4a3be tdb: detect tdb store of identical records and skip
This can help with ldb where we rewrite the index records
(cherry picked from samba commit d4c0e8fdf0)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 470750fa2e3cf987f10de48451b1ee13aab03907)
2009-12-16 08:03:52 +01:00
Stefan Metzmacher
2b10c14e35 tdb: rename 'struct list_struct' into 'struct tdb_record'
metze
(cherry picked from samba commit 3b62e250c0)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 03b3682e3fa53c9f5fdf2c4beac8b5d030fd2630)
2009-12-16 08:03:52 +01:00
Rusty Russell
f836eeb79b lib/tdb: make tdbtool use tdb_check() for "check" command
Also, set logging function so we get more informative messages.

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

(cherry picked from samba commit 0944931159)
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 6ac7ef8bf4d384f880c7f483ace70f8e08c15a8b)
2009-12-16 08:03:52 +01:00
Rusty Russell
b0a4a82370 lib/tdb: add tdb_check()
ctdb wants a quick way to detect corrupt tdbs; particularly, tdbs with
loops in their hash chains.  tdb_check() provides this.

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

(cherry picked from samba commit 022b4d4aa6)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit df1a3ce0380fa9d8722b2f9b16f65557095e4c83)
2009-12-16 08:03:52 +01:00
Kirill Smelkov
b4bb5257f6 tdb: kill last bits from swig
We no longer use swig for pytdb, so there is no need for swig make
rules. Also pytdb.c header should be updated.

Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(cherry picked from samba commit ecbe5ebd8d)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 27611d6a0c313732e438cb24c82b9de126e50156)
2009-12-16 08:03:52 +01:00
Stefan Metzmacher
42d131d951 lib/tdb: sync build files from samba master
metze

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 1d5c5a221c28f1dc652a80ed516a0f18ba588d9f)
2009-12-16 08:03:52 +01:00
Stefan Metzmacher
4576b9aae8 s3 build: Remove unused fstat check to fix a bunch of HAVE_FSTAT warnings (cherry picked from samba commit 2c2545d45a)
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit c40d14b1b7ba7c9ae40c0306a2e552504e0f92a6)
2009-12-16 08:03:51 +01:00
Stefan Metzmacher
a60db0255b lib/tdb: include replace.h and system/filesys.h in pytdb.c
This fixes the build on Tru64.

metze
(cherry picked from samba commit 3718cf294a)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 5652e403be099f35cdd29fda8ba4fe2c35de8035)
2009-12-16 08:03:51 +01:00
Stefan Metzmacher
c0131bbcc7 Avoid using a utility header for Python replacements included in Samba, since this will not be shipped with talloc/tdb/tevent/etc. (cherry picked from samba commit ba5d6e6d70)
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit da47169c4d3bc1b446b49610d892df05638e912c)
2009-12-16 08:03:51 +01:00
Stefan Metzmacher
c5827f2c2d s3/s4 build: Fix Py_RETURN_NONE to work with python versions < 2.4 (cherry picked from samba commit 61a23c5eea)
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 4130c5dd10869b071124e2bf04d6807bbb11ab1f)
2009-12-16 08:03:51 +01:00
Stefan Metzmacher
31bc9f3ee1 py: Properly increase the reference counter of Py_None. (cherry picked from samba commit d2c70d24e1)
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit e7242221c3318a5c312e17ff4074bef80b639ca8)
2009-12-16 08:03:51 +01:00
Jelmer Vernooij
fc9d260310 Make sure to not close tdb database more than once. (cherry picked from samba commit 6fe6983e4c)
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 52f78e040749d24058ee1f575d949b57d15f5987)
2009-12-16 08:03:51 +01:00
Jelmer Vernooij
c9907f2634 Implement missing functions in pytdb. (cherry picked from samba commit 2da551bbcc)
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 3a671b11770057c91e0ae646499d4714f52bc5c0)
2009-12-16 08:03:51 +01:00
Stefan Metzmacher
50ceb83180 Add simple manually written replacement for the tdb module. (cherry picked from samba commit 2a61fd41e9)
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 2231ee0aa163d68383dd9636f25f033fe7c1f3e7)
2009-12-16 08:03:50 +01:00
Jelmer Vernooij
4c69b5e0fd tdb: Add simple reimplementation of tdbdump in Python as an example of the tdb Python bindings. (This used to be commit 47d797f788) (cherry picked from samba commit 6bdd1425b7)
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 363c34d4bb488609317794cd3153d85c12643110)
2009-12-16 08:03:50 +01:00
Jeremy Allison
e58068d666 Remove unecessary msync. Jeremy. (cherry picked from samba commit 0bae1ef3de) (This used to be commit db2acaf46f) (cherry picked from samba commit a1cf3ad5d6)
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 236dc2fa29b3c0caec51859dbd469f0a13f5917e)
2009-12-16 08:03:50 +01:00
Stefan Metzmacher
61c7444943 The msync manpage reports that msync *must* be called before munmap. Failure to do so may result in lost data. Fix an ifdef check, I really think we meant to check HAVE_MMAP here. (cherry picked from samba commit 74c8575b3f) (This used to be commit 8fd54bb55f) (cherry picked from samba commit b39e332bd7)
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 5aa0ab328c36ecd4d7ec03f921e6027340c2ef13)
2009-12-16 08:03:50 +01:00
Volker Lendecke
a3b4f9b59e Attempt to fix bug 5684
With the ctdb checkin dde9f3f006 tdb optimized out write lock checks for
write-enabled transaction. Sadly, this also removed the possibility to ever
remove dead records left over from tdb_delete calls within a transaction.

Tridge, please check this! Did dde9f3f006 have any reason beyond performance
optimizations?

Thanks,

Volker
(cherry picked from samba commit 3f884c4ae3)
(This used to be commit 1d85e0647e)
(cherry picked from samba commit 8c88209c6f)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit b02bf7659f04f1fa203834bd75a2392b48e56c16)
2009-12-16 08:03:50 +01:00
Slava Semushin
06ab3cfe60 lib/tdb/tools/tdbtorture.c: fixed memory leak.
Found by cppcheck:
[lib/tdb/tools/tdbtorture.c:326]: (error) Memory leak: pids
(cherry picked from samba commit 497b9e460b)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 5d4cc4b018a538dc3f1d79fe091f3e6e67003daf)
2009-12-16 08:03:50 +01:00
Andrew Tridgell
3e04b100c1 added basic testing of tdb_transaction_prepare_commit() in tdbtorture (cherry picked from samba commit 84547b8dba)
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 923b61fe722c0aec8a5b6ac8dd1df74957dc102b)
2009-12-16 08:03:50 +01:00
Andrew Tridgell
5b6b852691 make tdbbackup use transactions
tdbbackup was originally written before we had transactions, and it
attempted to use its own fsync() calls to make it safe. Now that we
have transactions we can do it in a much safer (and faster!) fashion
(cherry picked from samba commit 2e4247782b)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit cd23d36ada9631095ca68663516de0c8d8c3bbed)
2009-12-16 08:03:49 +01:00
Andrew Tridgell
6eaaa52a1d fixed tdbbackup to give tdb error messages (cherry picked from samba commit 08be1420ba)
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 3d44412593b8748a5158e15b83cd9eb548231194)
2009-12-16 08:03:49 +01:00
Rusty Russell
b52a06ffc6 lib/tdb: add -t (always use transactions) option to tdbtorture
This means you can kill it at any time and expect no corruption.

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

(cherry picked from samba commit 0fc6800005)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit f7278a277ed91587cae5b5e3660dad7124bdb73f)
2009-12-16 08:03:49 +01:00
Rusty Russell
8dcc760f1e lib/tdb: wean off TDB_ERRCODE.
It was a regrettable hack which I used to reduce line count in tdb; in fact it caused confusion as can be seen in this patch.
In particular, ecode now needs to be set before TDB_LOG anyway, and having it exposed in
the header is useless (the struct tdb_context isn't defined, so it's doubly useless).
Also, we should never set errno, as io.c was doing.

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

(cherry picked from samba commit b77f41d58b)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit a6620f6e74aadc708395b21b42303d1082192fcc)
2009-12-16 08:03:49 +01:00
Rusty Russell
7f857c4d14 lib/tdb: TDB_TRACE support (for developers)
When TDB_TRACE is defined (in tdb_private.h), verbose tracing of tdb operations is enabled.
This can be replayed using "replay_trace" from http://ccan.ozlabs.org/info/tdb.

The majority of this patch comes from moving internal functions to _<funcname> to
avoid double-tracing.  There should be no additional overhead for the normal (!TDB_TRACE)
case.

Note that the verbose traces compress really well with rzip.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(cherry picked from samba commit 703004340c)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit b01b756cb577f32a1ec4597efb00017241e01685)
2009-12-16 08:03:49 +01:00
Andrew Tridgell
805ef91707 tdb: fixed the intermittent failure of tdbtorture in the build farm
There was a race condition that caused the torture.tdb to be left in a
state that needed recovery. The torture code thought that any message
from the tdb code was an error, so the "recovered" message, which is a
TDB_DEBUG_TRACE message, marked the run as being an error when it
isn't.
(cherry picked from samba commit 5dcf0069b6)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 43c97b259b19c42b4edc7f83dbfc5e486568b4e3)
2009-12-16 08:03:49 +01:00
Michael Adam
8fd54bbbe1 tdb:tdbtool: fix indentation.
Michael
(cherry picked from samba commit e440a2e11e)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit c1b8d32b4ef87b9d8f37b451f47fcee2ea753d21)
2009-12-16 08:03:48 +01:00
Stefan Metzmacher
42648556a6 Fix all warnings in source3 with gcc4.3. Jeremy. (cherry picked from samba commit 07e0094365)
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit e4d49c182e12c2d429d0414209cc2c8ccc19dc91)
2009-12-16 08:03:48 +01:00
Tim Prouty
a04fecb1c2 s3/s4: Fix "shadows a global declaration" warning (cherry picked from samba commit e48a5cd5d4)
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 94f5728a77b8c772fb16c4744c24b45de8016e52)
2009-12-16 08:03:48 +01:00
Tim Prouty
c8366fcfb4 tdb: Fix some recently introduced warnings in tdbtool (cherry picked from samba commit c299833bf8)
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 5830a2427b84e1cce74390b58fe12c45b5a056a6)
2009-12-16 08:03:48 +01:00
Andrew Tridgell
e0bed62820 added some more speed tests to tdbtool
This adds 3 simple speed tests to tdbtool, for transaction store,
store and fetch.

On my laptop this shows transactions costing about 10ms
(cherry picked from samba commit e15027155d)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 463279c972fa4538919bdd1dff48ca6b2fb8d49c)
2009-12-16 08:03:48 +01:00
Michael Adam
886cb3e86d tdb:tdbtool: add transaction_start/_commit/_cancel commands.
So one can perform tdbtool operations protected by transactions.

Michael
(cherry picked from samba commit 91e1bab2e9)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 35a5b874b925380f7c227e47aebb590c9db4739e)
2009-12-16 08:03:48 +01:00
Michael Adam
168bb40b4b tdb:tdbtool: add the "speed" command to the help text.
Michael
(cherry picked from samba commit 817383d88d)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit dc287a7d7420cca0b104049e689a73202bc535f8)
2009-12-16 08:03:47 +01:00
Holger Hetterich
0a0281444d Added a simple tdb integrity check to tdbtool. The command "check" runs traverse on the currently open tdb, and returns the number of entries if the integrity check is successful. (cherry picked from samba commit 42366bcbbd)
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 02b35ba77672727c96ad004be37c7f6f1d3fe474)
2009-12-16 08:03:47 +01:00
Andrew Tridgell
09f7874151 tdb: allow reads after prepare commit
We previously only allowed a commit to happen after a prepare
commit. It is in fact safe to allow reads between a prepare and a
commit, and the s4 replication code can make use of that, so allow it.
(cherry picked from samba commit 46c99ec2a3)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 5ef5ddb8369e5e76173285fe9a08498dc8dc73ab)
2009-12-16 08:03:46 +01:00
Michael Adam
d05b49aaf2 tdb:mksigs: allow PRINTF_ATTRIBUTE(..) macros function types as funcion args
Michael
(cherry picked from samba commit 55dcf928eb)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit ef1dc585d869a9e48164cd65bafc92c1da245007)
2009-12-16 08:03:46 +01:00
Michael Adam
ab37ff7c04 tdb:mksigs: normalize bool -> _Bool
Michael
(cherry picked from samba commit cfa4e7ec75)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 0ae735b7a2096a40e5e47086ec41d9d45ef6d36b)
2009-12-16 08:03:46 +01:00
Michael Adam
a0dba36390 tdb:mksigs: ignore symbols (like _DEPRECATED_) after closing function parentheses
Michael
(cherry picked from samba commit 25939a627f)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 2e69647404c87c438ae7c180277ac3b532941efd)
2009-12-16 08:03:46 +01:00
Michael Adam
6d9ce0ef50 tdb:mksigs: correctly ignode multiline function typedefs
by first concatenating multilint parentheses and removing typefes afterwards.

Michael
(cherry picked from samba commit 13bfcd5a93)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 37225f1ed3f70d7259c2af2c51c671105c34476a)
2009-12-16 08:03:46 +01:00
Michael Adam
67da31e222 tdb:mksigs: ignore struct forward declarations.
Michael
(cherry picked from samba commit ecd12bfb38)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 66fffa577e051212ac7541be906b6c80f4a7c0c9)
2009-12-16 08:03:45 +01:00
Michael Adam
67d7709140 tdb:mksyms: allow characters after closing functions parenthesis.
Michael
(cherry picked from samba commit 400f08450b)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 310d673b7cb9000d76437d78e43bc2bf133e4e14)
2009-12-16 08:03:44 +01:00
Michael Adam
31b9126d29 tdb:mksyms: allow double pointer return value of functions.
Michael
(cherry picked from samba commit 907e05595f)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit f70e371d70e334a7254649b2bb09aa382e6f09bb)
2009-12-16 08:03:44 +01:00
Günther Deschner
9872a2faab tdb: fix c++ build warning.
Guenther
(cherry picked from samba commit 1c2f4919ab)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 9d5015e6fc68d3eb9e7b7178dbaf8c129dc79471)
2009-12-16 08:03:44 +01:00
Michael Adam
2b29e30df5 One would expect I could spell my name... (cherry picked from samba commit 0d120be36b)
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit efa4a795db7fb2bddaab3969850d1554fc5f4da1)
2009-12-16 08:03:43 +01:00
Michael Adam
6e522eb198 tdb: add script/abi_checks.sh. check for abi changes without gcc magic.
USAGE: abi_checks.sh LIBRARY_NAME header1 [header2 ...]

This creates symbol signature lists using the mksyms and mksigs scripts
and compares them with the checked in lists.

Michael
(cherry picked from samba commit 9636e0d373)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 724d71dc838750fff91a45359feeb6e71bf0a4c7)
2009-12-16 08:03:43 +01:00