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

2133 Commits

Author SHA1 Message Date
Ronnie Sahlberg
b5c5ce2513 skip any persistent databases ending in .bak
(This used to be ctdb commit 85590e9dfaab0db16ce8103e509fd4d51aef4ad5)
2009-08-19 08:25:50 +10:00
Ronnie Sahlberg
9927ea7a00 new version 1.0.88
(This used to be ctdb commit fbfa1c72875dda4d1636d8e72c67ba09b10455df)
2009-08-17 11:04:40 +10:00
Ronnie Sahlberg
ef9db0efc3 reduce the loglevel for the message that we switch to a different recmaster while waiting for ipreallocate to finish
(This used to be ctdb commit e5b25e1386294b1f800c32fb01c69c3c3ce85c26)
2009-08-17 10:56:12 +10:00
Ronnie Sahlberg
486bdd8ca1 if no timeout at all is specified to the ctdb tool, neither using -T nor by setting CGTDB_TIMEOUT, then use 120 seconds as a default timepout before the ctdb command will exit with an error.
(This used to be ctdb commit d8d21884736a9610d48cf532e1c6778e511fb7a8)
2009-08-17 10:54:45 +10:00
Ronnie Sahlberg
2d57599595 document enable/disablescript
(This used to be ctdb commit 5852a526ce7d0333cd1f9a05353d8920ea99db37)
2009-08-13 13:02:00 +10:00
Ronnie Sahlberg
1cc79905ad add new controls to make it possible to enable/disable individual eventscripts
update scriptstatus output so it lists disabled scripts

(This used to be ctdb commit 7e799b7523c9699bd65a8a8207f7e03d668b0b81)
2009-08-13 13:04:08 +10:00
Ronnie Sahlberg
8f393eb987 Merge root@10.1.1.27:/shared/ctdb/ctdb-git
(This used to be ctdb commit a42dbdb7b9ccf3ce2aed48aa33f1cd3af2e94fe3)
2009-08-10 07:33:52 +10:00
Michael Adam
6cf67b9bb0 tests: fix the 52_ctdb_fetch.sh test.
The parser for the output of the ctdb_fetch program
did not match the output that ctdb_fetch generates.
It seemed to rather come from the ctdb_bench test...

This patch adapts the parser to correctly interpret
the output of ctdb_fetch.

Michael

(This used to be ctdb commit 836b95f32724cf37e4f643f20653f78842613692)
2009-08-04 09:46:40 +02:00
Michael Adam
572d397626 client: fix a debug message (misplaced newline).
Michael

(This used to be ctdb commit c513a31d755003d7af91529790b06ce0d226c90f)
2009-08-04 09:46:39 +02:00
Michael Adam
cfbdba0be6 client:ctdb_control_send: remove duplicate setting of the reqid header.
Michael

(This used to be ctdb commit 875778fbbfd6b0f09fd2db76f7348ad6271350a3)
2009-08-04 09:46:39 +02:00
Michael Adam
2f9fa6e36e ctdbd: use ctdb_syslog_log() as debug_add function for syslog
Michael

(This used to be ctdb commit a0ad69197b4771f3d5be23d78d0933d732405f08)
2009-08-04 09:46:39 +02:00
Michael Adam
bd81f50590 ctdbd: set debug_add hook to be able to use dump_data in the daemon.
Michael

(This used to be ctdb commit afafab0ac6cac90c3f8614204b5b6df92e446728)
2009-08-04 09:46:39 +02:00
Michael Adam
ace21b84b7 debug: add debug_add and dump_data functions
Michael

(This used to be ctdb commit 64405bdbebb2ddf0ae980e958ede77df79139000)
2009-08-04 09:46:39 +02:00
Rusty Russell
3cc352f975 tdb: don't alter tdb->flags in tdb_reopen_all()
The flags are user-visible, via tdb_get_flags/add_flags/remove_flags.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 8f48e37c254e0852d4e2dea54b905ce5ef2b925d)
2009-08-04 16:50:55 +09:30
Rusty Russell
ed2c8e415f tdb: Reimplementation of Metze's "lib/tdb: if we know pwrite and pread are thread/fork safe tdb_reopen_all() should be a noop".
This version just wraps the reopen code, so we still re-grab the lock and do
the normal sanity checks.

The reason we do this at all is to avoid global fd limits, see:
http://forums.fedoraforum.org/showthread.php?t=210393

Note also that this whole reopen concept is fundamentally racy: if the parent
goes away before the child calls tdb_reopen_all, the database can be left
without an active lock and another TDB_CLEAR_IF_FIRST opener will clear it.
A fork_with_tdbs() wrapper could use a pipe to solve this, but it's hardly
elegant (what if there are other independent things which have similar needs?).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 8d0d432ab7766d9c0f9868fd77e48b9b5cc5d9f9)
2009-08-04 16:50:52 +09:30
Rusty Russell
6e4577d08f realloc() has that horrible overloaded free semantic when size is 0: current code does a free of the old record in this case, then fail.
(This used to be ctdb commit 8b6a5bba93843cd83b7b386b82949ad88f29884a)
2009-08-04 16:50:48 +09:30
Rusty Russell
1664d75ad3 If the record is at the end of the database, pretending it has length 1 might take us out-of-bounds. Only pretend to be length 1 for the malloc.
(This used to be ctdb commit 6de2823f5f7976d4efa20761e518d6b67753f054)
2009-08-04 16:50:43 +09:30
Rusty Russell
6aa98fb041 Port from SAMBA tdb: commit 54a51839ea Author: Rusty Russell <rusty@rustcorp.com.au> Date: Sat Jul 18 15:28:58 2009 +0930
Make tdb transaction lock recursive (samba version)

    This patch replaces 6ed27edbcd and
    1a416ff13c, which fixed the bug where traversals
    inside transactions would release the transaction lock early.

    This solution is more general, and solves the more minor symptom that nested
    traversals would also release the transaction lock early.  (It was also suggestd in
    Volker's comment in 6ed27ed).

    This patch also applies to ctdb, if the traverse.c part is removed (ctdb's tdb
    code never received the previous two fixes).

    Tested using the testsuite from ccan (adapted to the samba code).  Thanks to
    Michael Adam for feedback.

    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    Signed-off-by: Michael Adam <obnox@samba.org>
commit 760104188d
Author: Rusty Russell <rusty@rustcorp.com.au>
Date:   Tue Jul 21 16:23:35 2009 +0930

    tdb: fix locking error

    54a51839ea "Make tdb transaction lock
    recursive (samba version)" was broken: I "cleaned it up" and prevented
    it from ever unlocking.

    To see the problem:
        $ bin/tdbtorture -s 1248142523
        tdb_brlock failed (fd=3) at offset 8 rw_type=1 lck_type=14 len=1
        tdb_transaction_lock: failed to get transaction lock
        tdb_transaction_start failed: Resource deadlock avoided

    My testcase relied on the *count* being correct, which it was.  Fixing that
    now.

    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit ce19658ba13272238058e9b9bc03e62f48b737c0)
2009-08-04 16:43:34 +09:30
Rusty Russell
825391de1d Port from SAMBA tdb: commit a6cc04a200 Author: Andrew Tridgell <tridge@samba.org> Date: Mon Jun 1 13:13:07 2009 +1000
overallocate all records by 25%

    This greatly reduces the fragmentation of databases where records
    tend to grow slowly by a small amount each time. The case where this
    is most seen is the ldb index records. Adding this overallocation
    reduced the size of the resulting database by more than 20x when
    running a test that adds 10k users.

(This used to be ctdb commit e72974e5cefabc7035399d16633f727f868caa61)
2009-08-04 16:43:31 +09:30
Rusty Russell
94ee0cbe3a Port from SAMBA tdb: commit a386173fa1 Author: Andrew Tridgell <tridge@samba.org> Date: Mon Jun 1 13:11:39 2009 +1000
auto-repack in transactions that expand the tdb

    The idea behind this is to recover from badly fragmented free
    lists. Choosing the point where the file expands is fairly arbitrary,
    but seems to work well.

(This used to be ctdb commit 233c52bfb087f636ad61e95c12616c02901f4f83)
2009-08-04 16:43:26 +09:30
Rusty Russell
3dc37c17c1 Port from SAMBA ctdb: commit 936d76802f Author: Andrew Tridgell <tridge@samba.org> Date: Tue Dec 16 14:38:17 2008 +1100
imported the tdb_repack() code from CTDB

    The tdb_repack() function repacks a TDB so that it has a single
    freelist entry. The file doesn't shrink, but it does remove all
    freelist fragmentation. This code originated in the CTDB vacuuming
    code, but will now be used in ldb to cope with fragmentation from
    re-indexing

(This used to be ctdb commit fe3ceb101a5a9c336973c2c6c31406bd8181c2fe)
2009-08-04 16:43:21 +09:30
Rusty Russell
d66a7c40da Port from SAMBA tdb: commit 4b4fec65db Author: Andrew Tridgell <tridge@samba.org> Date: Thu May 28 16:08:28 2009 +1000
make TDB_NOSYNC affect all the fsync/msync calls in transactions

    During a transaction commit tdb normally uses fsync/msync calls to
    make it crash safe. This can be disabled using the TDB_NOSYNC flag,
    but it wasn't disabling all the code paths that caused a fsync/msync.

(This used to be ctdb commit e03980add02a28609a7a0a0c87ebc85419b98144)
2009-08-04 16:43:17 +09:30
Rusty Russell
f10db37b82 Port from SAMBA tdb: commit a91bcbccf8 Author: Jim McDonough <jmcd@samba.org> Date: Thu May 21 16:26:26 2009 -0400
Detect tight loop in tdb_find()

(This used to be ctdb commit 5253a0ba3a34fbf5810f363ecc094203d49e835f)
2009-08-04 16:43:14 +09:30
Rusty Russell
c153b85a93 Port from SAMBA tdb: commit 42c0931441 Author: Tim Prouty <tprouty@samba.org> Date: Tue Mar 31 16:24:07 2009 -0700
tdb: Remove unused variable

(This used to be ctdb commit aa22d1875b1997664af983c0baeabe34e40dd253)
2009-08-04 16:43:10 +09:30
Rusty Russell
166e74a8b1 Port from SAMBA tdb:
commit b90863c0b7
Author: Howard Chu <hyc@highlandsun.com>
Date:   Tue Mar 31 13:15:54 2009 +1100

    Add tdb_transaction_prepare_commit()

    Using tdb_transaction_prepare_commit() gives us 2-phase commits. This
    allows us to safely commit across multiple tdb databases at once, with
    reasonable transaction semantics

    Signed-off-by: tridge@samba.org

(This used to be ctdb commit 4c3dac215a088947f645f727343997f5d47e3260)
2009-08-04 16:43:06 +09:30
Ronnie Sahlberg
0e09e52824 update STOP/CONTINUE to better handle when we stop the last node
(This used to be ctdb commit 9a251078f22aea15b9ca37393e0b5e2740aa21fb)
2009-08-03 12:51:55 +10:00
Ronnie Sahlberg
690f1537f0 Merge commit 'martins/master'
(This used to be ctdb commit 32a69b0efa078b069802470be6488a4efe32961d)
2009-07-30 10:55:56 +10:00
Martin Schwenke
063bd6e278 Test suite: fix test file permissions in complex/44_failover_nfs_oneway.sh.
Something, perhaps root_squash, causing permission denied on the test
file after we copy it over with scp.  This sets the initial
permissions to be friendly and adds -p to the scp command to maintain
those friendly permissions.

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

(This used to be ctdb commit 52f21f5a92eb14df7540a2ae9e212d936e646c06)
2009-07-30 10:47:36 +10:00
Martin Schwenke
73ca4b6c8b Test suite: fix the test suite's generic event script.
Add a "stopped" case to log events and stop the event script from
failing with an unknown event.

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

(This used to be ctdb commit 7f67f7395e2233f0bba2e9662404aad49e13f645)
2009-07-29 18:10:05 +10:00
Martin Schwenke
48078dd24f Test suite: Fixes for node state parsing plus new stop/continue tests.
The parsing of "ctdb status -Y" output to determine various node
states was implemented very strictly.  Therefore, the parsing broke
due to the addition of the new "stopped" state to the output of "ctdb
status -Y".  This relaxes the parsing so that it should work for
versions prior to the introduction of the "stopped" state, as well as
future versions that add new states to the end of the list of bits in
output of "ctdb status -Y".

Similarly the check for cluster unhealthy (in _cluster_is_healthy())
now just checks for a single 1 in any bit in the "ctdb status -Y"
output, rather than checking for a particular number of 0s.

New tests
tests/simple/{41_ctdb_stop.sh,42_ctdb_continue.sh,43_stop_recmaster_yield.sh}
do rudimentary testing of the stop and continue functions.

Remove tests tests/simple/41_ctdb_ban.sh and
tests/simple/42_ctdb_unban.sh.  They were both unreliable.

tests/simple/21_ctdb_disablemonitor.sh now schedules a restart, since
one will be required.

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

(This used to be ctdb commit 67c5bfb5f02c9d45a32d976021ede4fb2174dfe9)
2009-07-29 18:01:07 +10:00
Ronnie Sahlberg
a1e1503328 change the defaults for repacking to repack once every 120 seconds and letting it work for 30 second before timing out.
(This used to be ctdb commit 2aa5d18bb42dca4ef9cb049b4fa9d7bc999ce4ad)
2009-07-29 13:31:12 +10:00
Wolfgang Mueller-Friedt
16af87bf25 repack limit tunable
Signed-off-by: Wolfgang Mueller-Friedt <wolfmuel@de.ibm.com>

(This used to be ctdb commit a2768b0732f2ab2e3fafda55587bd2e99eedf0fa)
2009-07-29 13:30:39 +10:00
Wolfgang Mueller-Friedt
345df3c714 remove repack from eventscript
Signed-off-by: Wolfgang Mueller-Friedt <wolfmuel@de.ibm.com>

(This used to be ctdb commit dd334caa98882fc59765b7c84eca8e86de785487)
2009-07-29 13:29:38 +10:00
Wolfgang Mueller-Friedt
fddfaaaa4b added event repacking
Signed-off-by: Wolfgang Mueller-Friedt <wolfmuel@de.ibm.com>

(This used to be ctdb commit 78466364f22d6a183710338f138b8c808c6b7753)
2009-07-29 13:28:48 +10:00
Ronnie Sahlberg
1653af16a6 vacuum event framework
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Signed-off-by: Wolfgang Mueller-Friedt <wolfmuel@de.ibm.com>

(This used to be ctdb commit 30cdad97706a9e9bb210120699aa939f6b16e8ca)
2009-07-29 13:26:29 +10:00
Ronnie Sahlberg
fb63d27e4e initial part of new vacuuming patch.
create some new fields for ctdb_db and tunables

(This used to be ctdb commit 3a8e7d36cc42aedf4b7665364224140dcbfb3efa)
2009-07-29 13:25:43 +10:00
Ronnie Sahlberg
cca0aae1f5 From Michael Adam:
Update the transaction test tool to the new api for transactions

(This used to be ctdb commit 4d9a53f142deba6ab578af2fc35bfa99c29c3a99)
2009-07-29 11:18:02 +10:00
Michael Adam
a6bd36933a client: refuse to do record_store() on a persistent tdb.
Only allow stores wrapped in transactions on persistent dbs.

Michael

(This used to be ctdb commit 9dea71cf72ef79a9aadf8ee7cf1a1899527459ff)
2009-07-29 11:17:07 +10:00
Michael Adam
a6cf23362f ctdbd: refuse PERSISTENT_STORE if transaction is running.
Michael

(This used to be ctdb commit c07d6d90f7afd19213ad44624c3e2b9c85f4eea8)
2009-07-29 11:13:38 +10:00
Michael Adam
4cd06a330e Fix persistent transaction commit race condition.
In ctdb_client.c:ctdb_transaction_commit(), after a failed
TRANS2_COMMIT control call (for instance due to the 1-second
being exceeded waiting for a busy node's reply), there is a
1-second gap between the transaction_cancel() and
replay_transaction() calls in which there is no lock on the
persistent db. And due to the lack of global state
indicating that a transaction is in progress in ctdbd, other nodes
may succeed to start transactions on the db in this gap and
even worse work on top of the possibly already pushed changes.
So the data diverges on the several nodes.

This change fixes this by introducing global state for a transaction
commit being active in the ctdb_db_context struct and in a db_id field
in the client so that a client keeps track of _which_ tdb it as
transaction commit running on. These data are set by ctdb upon
entering the trans2_commit control and they are cleared in the
trans2_error or trans2_finished controls. This makes it impossible
to start a nother transaction or migrate a record to a different
node while a transaction is active on a persistent tdb, including
the retry loop.

This approach is dead lock free and still allows recovery process
to be started in the retry-gap between cancel and replay.
Also note, that this solution does not require any change in the
client side.

This was debugged and developed together with
Stefan Metzmacher <metze@samba.org> - thanks!

Michael

(This used to be ctdb commit f88103516e5ad723062fb95fcb07a128f1069d69)
2009-07-29 11:12:39 +10:00
Michael Adam
188ab0f96c client: set dmaster in ctdb_transaction_store() also when updating an existing record
Michael

(This used to be ctdb commit e9194a130327d6b05a8ab90bd976475b0e93b06d)
2009-07-29 10:28:35 +10:00
Martin Schwenke
e50a067cb5 Merge commit 'origin/master'
(This used to be ctdb commit d7ff60a74595dcb4ae41f5a8193de5b898d61227)
2009-07-29 10:08:56 +10:00
Ronnie Sahlberg
62c4a841d2 When processing the stop node control reply in the client code we should
also check the returned status code in case the _stop() command failed
due to the eventscripts failing.

If this happens, make "ctdb stop" log an error to the console and try
the operation again.

(This used to be ctdb commit 20e82e0c48e07d1012549f5277f1f5a3f4bd10d1)
2009-07-29 09:58:40 +10:00
Martin Schwenke
50650fbbd1 onnode: update tests for healthy and connected to cope with new stopped bit.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit bfc926c866e361ab28330747544b268ba130bf30)
2009-07-28 16:00:11 +10:00
Ronnie Sahlberg
c413ee95b8 document the two new commands setlmasterrole and setrecmasterrole
(This used to be ctdb commit 1d7d7dd515e7ef62cacf2a712a2f4c4d62a38fa5)
2009-07-28 13:54:08 +10:00
Ronnie Sahlberg
37d68c58b8 add two commands : setlmasterrole and setrecmasterrole to enable/disable these capabilities at runtime
(This used to be ctdb commit 51aaed0e9e42e901451292e8dd545297ab725a62)
2009-07-28 13:45:13 +10:00
Ronnie Sahlberg
ad98e6a1f4 Document the natgw flag and how this changes the output of "ctdb
getcapabilities"

(This used to be ctdb commit 9b395986962909a5b0548eaea7e45215df72a08e)
2009-07-28 10:02:39 +10:00
Ronnie Sahlberg
4d5823ba7c update the natgw eventscript to set the NATGW capability when this feature is used
This does not modify any behaviour of the daemon itself other than showing this flag as ON in the ctdeb getcapabilities output

(This used to be ctdb commit fb337c151bd16ad5ad0c99431224451979d8c651)
2009-07-28 10:00:33 +10:00
Ronnie Sahlberg
72e2380e92 add a command "setnatgwstate {on|off}" that can be used to indicate if this node is using natgw functionality or not.
(This used to be ctdb commit 89a9bb29a60a6fb1fba55987e6cf0a4baa695e50)
2009-07-28 09:58:11 +10:00
Ronnie Sahlberg
679ef878f8 describe how to activate NATGW without restarting the nodes on a running
cluster

(This used to be ctdb commit b6c8011024ce4574f945d5a470075c6779b34a43)
2009-07-28 09:27:00 +10:00