summaryrefslogtreecommitdiffstats
path: root/ctdb/include
Commit message (Collapse)AuthorAgeFilesLines
* ctdb-logging: Split ringbuffer handling code from ctdb_collect_logAmitay Isaacs2014-06-121-0/+2
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-daemon: Rename ctdb_mkdir_p_or_die to mkdir_p_or_dieAmitay Isaacs2014-06-121-1/+1
| | | | | | | This function does not require ctdb context. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-daemon: Rename ctdb_lockdown_memory to lockdown_memoryAmitay Isaacs2014-06-121-1/+1
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-daemon: Instead of passing ctdb context, pass valgrinding booleanAmitay Isaacs2014-06-121-1/+1
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-common: Remove unused functionsAmitay Isaacs2014-06-121-2/+0
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-common: Drop ctdb prefix from utility functions independent of ctdbAmitay Isaacs2014-06-121-2/+2
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-common: Changing scheduler policy does not require ctdb contextAmitay Isaacs2014-06-121-2/+2
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-common: No need to save previous scheduler priorityAmitay Isaacs2014-06-121-1/+0
| | | | | | | | When calling sched_setscheduler() with SCHED_OTHER, the only valid priority is 0. Nice value is "restored" anyway. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-build: Move internal include files in a separate directoryAmitay Isaacs2014-05-273-0/+0
| | | | | | | | This will allow to build clustered samba with built-in ctdb tree rather than needing to install CTDB first. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb-recoverd: Detach database from recovery daemonAmitay Isaacs2014-04-231-0/+4
| | | | | | | | | | | | As part of vacuuming, recoverd attaches to databases to migrate records. When detaching a database from main daemon, it should be removed from recovery daemon also. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org> Autobuild-User(master): Michael Adam <obnox@samba.org> Autobuild-Date(master): Wed Apr 23 17:05:45 CEST 2014 on sn-devel-104
* ctdb-client: Add client code to detach a databaseAmitay Isaacs2014-04-141-0/+1
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-daemon: Add control CTDB_CONTROL_DB_DETACHAmitay Isaacs2014-04-142-0/+3
| | | | | | | This detaches specified database from all the nodes. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-daemon: Always update database priority cluster wideAmitay Isaacs2014-04-071-1/+2
| | | | | | | | | | | | | Database priority is a global property and all the nodes should have the priority set for the databases. Just setting priority on one node can lead to problems in the recovery as a database can be frozen at wrong priority and then freezing database would not succeed. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: David Disseldorp <ddiss@samba.org> Autobuild-User(master): David Disseldorp <ddiss@samba.org> Autobuild-Date(master): Mon Apr 7 14:06:26 CEST 2014 on sn-devel-104
* ctdb/daemon: Make delete IP wait until the IP is releasedMartin Schwenke2014-03-231-1/+8
| | | | | | | | | | | | reloadips really expects deleted IPs to be released before completing. Otherwise the recovery daemon starts failing the local IP check. The races that follow can cause a node to be banned. To make the error handling simple, do the actual deletion in release_ip_callback(). Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-daemon: Do not run monitor event if any other event is already runningAmitay Isaacs2014-01-211-0/+1
| | | | | | | | | | | | Any currently running monitor events are cancelled if any other events are scheduled. However, this does not stop monitor events to be run when other events are already running. Keep track of the number of active events and schedule monitor event only if there are no active events. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb/daemon: Untangle serialisation of 1st recovery -> startup -> monitorMartin Schwenke2014-01-171-1/+1
| | | | | | | | | | | | | | At the moment ctdb_check_healthy() is overloaded to wait until the first recovery is complete, handle the "startup" event and also actually handle monitoring. This is untidy and hard to follow. Instead, have the daemon explicitly wait for 1st recovery after the "setup" event. When first recovery is complete, schedule a function to handle the "startup" event. When the "startup" event succeeds then explicitly enable monitoring. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-daemon: Remove ctdb_fork_with_logging()Amitay Isaacs2014-01-161-5/+0
| | | | | | | | | | This function has been replaced with ctdb_vfork_with_logging(). Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net> Autobuild-User(master): Martin Schwenke <martins@samba.org> Autobuild-Date(master): Thu Jan 16 04:05:35 CET 2014 on sn-devel-104
* ctdb-daemon: Add ctdb_vfork_with_logging()Amitay Isaacs2014-01-161-0/+9
| | | | | | | | This will be used to spawn lightweight helper processes to run eventscripts. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-daemon: No need to call event scripts with CTDB_CALLED_BY_USERAmitay Isaacs2014-01-161-2/+1
| | | | | | | | This was added to support external monitoring using CTDB event scripts. However, it was never used. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-daemon: Deprecate RELOAD and STATUS eventsAmitay Isaacs2014-01-161-2/+2
| | | | | | | These events have never been used. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-common: Refactor code to keep track of child processesAmitay Isaacs2013-11-271-0/+1
| | | | | | | This code can then be used to track child processes created with vfork(). Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb-locking: Implement active lock requests limit per databaseAmitay Isaacs2013-11-271-1/+2
| | | | | | | | | | | | This limit was currently a global limit and not per database. This prevents any database freeze lock requests from getting scheduled if the global limit was reached. Only individual record requests should be limited and database freeze requests should always get scheduled. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb-tools/ctdb: New ptrans commandMartin Schwenke2013-11-271-0/+1
| | | | | | | | Also add test. Signed-off-by: Martin Schwenke <martin@meltin.net> Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb-recoverd: Fix backward compatibility for CTDB_SRVID_TAKEOVER_RUNMartin Schwenke2013-11-271-1/+6
| | | | | | | | | When running a mixed version cluster, compatibility with older versions was was broken during recent refactorisation. Signed-off-by: Martin Schwenke <martin@meltin.net> Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org>
* tunables: Remove obsolete tunablesAmitay Isaacs2013-10-301-3/+0
| | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit ca5fc3431573c44d55d09d987c715fb53756fc1f)
* build: Move the default CTDB socket from /tmp to /var/run/ctdbAmitay Isaacs2013-10-251-1/+1
| | | | | | | | | | | | | | | | | Use /var/run/ctdb/ctdbd.socket because there might be other daemons that need sockets in the future. The local daemons test code to create a link for the default convenience socket has to be removed because the link can't be created as a regular user in the new location. This should be OK since all calls to the ctdb tool in the test code should be wrapped in onnode. When debugging tests, a developer will have to set CTDB_SOCKET by hand. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Pair-programmed-with: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit dc67a4e24af9d07aead2a1710eeaf5d6cc409201)
* ctdbd: Simplify database directory setting logicMartin Schwenke2013-10-251-7/+0
| | | | | | | | | | | | | | No need to check if the options are set. The options are always set via static defaults. No need to talloc_strdup() the values via wrapper functions. The options aren't going away. Remove now unused ctdb_set_tdb_dir() and similar functions. Signed-off-by: Martin Schwenke <martin@meltin.net> Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 1fe82f3d7b610547ff4945887f15dd6c5798a49b)
* common: New function ctdb_mkdir_p_or_die()Martin Schwenke2013-10-251-0/+1
| | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 7b971df79b0b63f83555205eacf48d49ca3a273a)
* common: New function mkdir_p()Martin Schwenke2013-10-251-0/+2
| | | | | | | | | Behaves like mkdir -p. Signed-off-by: Martin Schwenke <martin@meltin.net> Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit afe2145d91725daf1399f0a24f1cddcf65f0ec31)
* ctdb_client.h: fix build on AIX by removing C++-style commentsMichael Adam2013-10-231-2/+2
| | | | | | | | Reported by John P Janosik <jpjanosi@us.ibm.com> Signed-off-by: Michael Adam <obnox@samba.org> (This used to be ctdb commit 1f327401f2e181780937aa3f6c479376ff787f3f)
* ctdbd: Pass the public address file location in ctdb contextMartin Schwenke2013-10-221-2/+1
| | | | | | | | | | No need to pass it as an extra argument to ctdb_start_daemon. Also ensure options.public_address_list gets a nice static default. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit a3d63a9db89d08bb284b3b3a6db773422f21b477)
* ctdbd: Default for event_script_dir should use CTDB_BASEMartin Schwenke2013-10-221-1/+0
| | | | | | | | | | Also get rid of ctdb_set_event_script_dir(). It creates an unnecessary copy of something that will be around for the lifetime of the process. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 21b4d1aba00902f1eee0cbf4f082b0794fd5b738)
* ctdbd: Add nodes_file member to struct ctdb_contextMartin Schwenke2013-10-222-6/+1
| | | | | | | | | | | | | | | | | This allows ctdb_load_nodes_file() to move to ctdb_server.c and ctdb_set_nlist() to become static. Setting ctdb->nodes_file needs to be done early, before the nodes file is loaded. It is now set from CTDB_BASE instead ETCDIR, so setting CTDB_BASE also needs to be done earlier. Unhack ctdbd_test.c - it no longer needs to define ctdb_load_nodes_file(). Signed-off-by: Martin Schwenke <martin@meltin.net> Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 20e705e63bd3b20837cc3ac92fdcf2a9650ccfc8)
* client: Reimplement persistent transaction code using TRANS3_COMMITAmitay Isaacs2013-10-041-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implementing persistent trasnaction code from Samba. Persistent transaction code was reimplemented in Samba using g_lock.tdb to hold transaction locks and using TRANS3_COMMIT control. Implementation details: 1. When starting a transaction, create a record with "transaction-<dbid>" as key and store current server_id in the structure. 2. If a record already exists, some other client has already started a transaction. Verify that the process corresponding to server_id stored in the record really exists or it's a stale record and overwrite it. 3. All modifications to the actual persistent database are stored in a marshal buffer. 4. When transaction is committed, read the sequence number of the persistent database and increment it. Sequence number record is also stored in the marshal buffer. 5. Send the changed records (marshal buffer) in TRANS3_COMMIT control to all the active nodes. 6. If all controls succeed, verify that the sequence number has been incremented. Commit is successful. If any of the controls fail, abort the transaction. 7. In case sequence number has not yet been incremented, then database recovery has been triggered. So repeat from step 5. Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 4e0f1971792c9431d8d51dc57d54ecc9e4576dd5)
* ctdbd: Remove transaction code related to TRANS2 commitsAmitay Isaacs2013-10-042-9/+0
| | | | | | | | | This removes data types and structure elements related to TRANS2 persistent transaction code. Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 22a253b7ccf1ff854cddf0b67969dc84d7d6a654)
* ctdbd: Deprecate TRANS2 commit controlsAmitay Isaacs2013-10-041-6/+6
| | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 7d176352986317e63696d74252ff5d8eccb2fee5)
* include: Remove unused set_dmaster structureAmitay Isaacs2013-10-041-6/+0
| | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 2ce3a48cc969d563c26dd295723416c0d7b077a2)
* client: Add ctdb_ctrl_getdbseqnum() functionAmitay Isaacs2013-10-041-0/+2
| | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 8cb1fbbfe88327c9c7ab68e8eded586dff611e57)
* client: Add ctdb_ctrl_getdbstatistics() functionAmitay Isaacs2013-10-041-0/+2
| | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 1e7fca5cdc1d7205cf084e35aace1a5dc46ea294)
* client: Add ctdb_client_check_message_handlers() functionAmitay Isaacs2013-10-041-1/+3
| | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit c9a9d14c91f203ce964a426a8a1e2c1715af2098)
* recoverd: Fix the implementation of CTDB_SRVID_REBALANCE_NODEMartin Schwenke2013-09-191-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current implementation has a few flaws: * A takeover run is called unconditionally when the timer goes even if the recovery master role has moved. This means a node other than the recovery master can incorrectly do a takeover run. * The rebalancing target nodes are cleared in the setup for a takeover run, regardless of whether the takeover run succeeds. * The timer to force a rebalance isn't cleared if another takeover run occurs before the deadline. Any forced rebalancing will happen in the first takeover run and when the timer expires some time later then an unnecessary takeover run will occur. * If the recovery master role moves then the rebalancing data will stay on the original node and affect the next takeover run to occur if the recovery master role should come back to the original node. Instead, store an array of rebalance target nodes in the recovery master context. This is passed as an extra argument to ctdb_takeover_run() each time it is called and is cleared when a takeover run succeeds. The timer hangs off the array of rebalance target nodes, which is cleared if the node isn't the recovery master. This means that it is possible to lose rebalance data if the recovery master role moves. However, that's a difficult problem to solve. The best way of approaching it is probably to try to stop the recovery master role from jumping around unnecesarily when inactive nodes join the cluster. The long term solution is to avoid this nonsense completely. The IP allocation algorithm needs to cache state between runs so that it knows which nodes have just become healthy. This also needs recovery master stability. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit c51c1efe5fc7fa668597f2acd435dee16e410fc9)
* recoverd: Remove unused CTDB_SRVID_RELOAD_ALL_IPS and handlerMartin Schwenke2013-09-191-5/+0
| | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 4cd727439a0824ebb8dbcf737d9888ffc3c41184)
* recoverd: New SRVID message CTDB_SRVID_DISABLE_TAKEOVER_RUNSMartin Schwenke2013-09-191-0/+3
| | | | | | | | | | | | This implements a superset of CTDB_SRVID_DISABLE_IP_CHECK. It stops the IP checks but also causes any attempted takeover runs to fail and be rescheduled. This is meant to completely stop IP movements. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 00db4de53a0d86013e79e6577e7e6cf3ef864e56)
* recoverd: Make the SRVID request structure genericMartin Schwenke2013-09-191-10/+3
| | | | | | | | No need for a separate one for each SRVID. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit d9c22b04d5aa7938a3965bd3144568664eb772ce)
* client: Remove unused function list_of_active_nodes_except_pnn()Martin Schwenke2013-09-111-4/+0
| | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit d8a76cf79f07dfb5a93c6c9a13f16e3268c7dd57)
* recoverd: Move struct ctdb_public_ip_list back into ctdb_takeover.cMartin Schwenke2013-08-221-6/+0
| | | | | | | | | | This is an internal structure. It was moved into ctdb_private.h a long time ago to allow unit testing. Unit test compilation was changed shortly afterwards to make this unnecessary. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit db57261d7dc264e161659a8c547f44fbd9e88eeb)
* Revert "LACOUNT: Add back lacount mechanism to defer migrating a ↵Amitay Isaacs2013-08-222-4/+2
| | | | | | | | | | | | | | | | | | | fetched/read copy until after default of 20 consecutive requests from the same node" This reverts commit 035c0d981bde8c0eee8b3f24ba8e2dc817e5b504. This is a premature optimization. Record can bounce between nodes very quickly if it is a contended record. There is no need to hold a record on a node unnecessarily. In case record contention becomes bad, enabling sticky records on a database is a better idea. Conflicts: include/ctdb_private.h server/ctdb_tunables.c Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit ac417b0003f0116f116834ad2ac51482d25cfa0d)
* Revert "recoverd: Use correct tdb flags when creating missing databases"Amitay Isaacs2013-08-141-1/+1
| | | | | | | | | | | This reverts commit 10a057d8e15c8c18e540598a940d3548c731b0b4. This approach would not work when creating local databases since currently there is no control to receive TDB flags for remote databases. Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit ca61eb776ab862bd269e45ee0f9f96e7e1e0e001)
* recoverd: Use correct tdb flags when creating missing databasesAmitay Isaacs2013-08-011-1/+1
| | | | | | | | | | When creating missing databases either locally or remotely, make sure to use the correct tdb flags from other nodes. Without this, volatile databases can get attached without TDB_INCOMPATIBLE_HASH flag. Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 10a057d8e15c8c18e540598a940d3548c731b0b4)
* ctdbd: Remove incomplete ctdb_db_statistics_wire structureAmitay Isaacs2013-07-291-12/+5
| | | | | | | | | Instead of maintaining another structure, add an element as place holder for marshall buffer of hot keys. This avoids duplication of the structure. Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit e73b2e12adc9db1dedb48d32bba3a8406a80f4cd)