ctdb-server: Avoid logging a count of 0 resent calls This fixes a little thinko in commit 80de84d36e9c29d9506976f991560fb5dde99471, where this was overlooked. Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Mon Jul 10 15:15:06 UTC 2023 on atb-devel-224
ctdb:server: Fix code spelling Best reviewed with: `git show --word-diff` Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
ctdb-daemon: Log per-database summary of resent calls After a recovery that takes a significant amount of time the logs are flooded with messages about every resent call. Log a summary instead and demote per-call messages to INFO level. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb-daemon: Fix sorting of hot keys The current code only ever swaps with slot 0. This will only ever happen with slots 0 and 1, so probably never sorts. Replace with qsort(). Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb-daemon: Add extra logging of hot keys ctdbd currently only logs when a new hot key is added. If a key gets hotter then nothing new is logged. Log hot key updates when the number of migrations has doubled since the last time that key was logged. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb-daemon: Update hot key logging This message indicates that a hot key was added, so say that. After all the hot key slots have been filled the id will always be 0, so don't bother logging it. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb-daemon: Fix bug in slot 0 comparison optimisation This is only valid if all slots are in use. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb-daemon: Switch some variables to unsigned These should be unsigned but luck is currently on our side. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb-daemon: Add separate hot keys array for database statistics There are 2 reasons for this. Sorting of hot keys is broken and will be changed to an implementation that needs a named (i.e. not anonymous) structure. Also, at least one non-protocol field will be added to facilitate more useful logging. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/server/ctdb_call.c: typo fixes Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb-daemon: Avoid signed/unsigned comparison by casting Compiling with -Wsign-compare complains: 1047 | && (call->call_id == CTDB_FETCH_WITH_HEADER_FUNC)) { | ^~ struct ctdb_call is a protocol element, so we can't simply change it. Found by csbuild. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Wed Aug 14 10:29:59 UTC 2019 on sn-devel-184
ctdb-daemon: Avoid signed/unsigned comparison by declaring as unsigned Compiling with -Wsign-compare complains: ctdb/server/ctdb_call.c:831:12: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’} [-Wsign-compare] 831 | if (count <= ctdb_db->statistics.hot_keys[0].count) { | ^~ and ctdb/server/ctdb_call.c:844:13: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’} [-Wsign-compare] 844 | if (count <= ctdb_db->statistics.hot_keys[i].count) { | ^~ Found by cs-build. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb-daemon: Divide by 2 when calculating hop count bucket This provides finer resolution while still maintaining a reasonable maximum. In this case the top bucket contains any hop counts >= 16384, compared to the current situation where the top bucket contains hop counts >= 268435456. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb-server: Only set destructor if required Set the detructor in ctdb_start_revoke_ro_record after the revokechild_handle was added to the list. Signed-off-by: Swen Schillig <swen@vnet.ibm.com> Reviewed-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Sat Mar 31 03:45:51 CEST 2018 on sn-devel-144
ctdb-server: Add goto tag avoiding code duplication Introduced err_out goto tag to prevent code duplication. Signed-off-by: Swen Schillig <swen@vnet.ibm.com> Reviewed-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Jeremy Allison <jra@samba.org>
ctdb-server: Minor code cleanup Cleanup ctdb_start_revoke_ro_record to improve readability. Signed-off-by: Swen Schillig <swen@vnet.ibm.com> Reviewed-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Jeremy Allison <jra@samba.org>
ctdb-server: Replace the variable rc by something meaningful Replace the varibale name "rc" in ctdb_start_revoke_ro_record to prevent a mix-up with the common meaning of rc (return code). Signed-off-by: Swen Schillig <swen@vnet.ibm.com> Reviewed-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Jeremy Allison <jra@samba.org>
ctdb-server: Only talloc_set_destructor when required The destructor is only needed once the state got added to the DLIST. Therefore, move the setting of the destructor to after the addition of state to the DLIST. Signed-off-by: Swen Schillig <swen@vnet.ibm.com> Reviewed-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Jeremy Allison <jra@samba.org>
ctdb-server: Cleanup ctdb_daemon_call_send_remote Minor code cleanup and adding a temporary variable to improve readabilty. Signed-off-by: Swen Schillig <swen@vnet.ibm.com> Reviewed-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Jeremy Allison <jra@samba.org>
ctdb-daemon: Allocate deferred calls off calling context BUG: https://bugzilla.samba.org/show_bug.cgi?id=13152 This makes sure that if a client disconnects, all the deferred calls from the client are correctly freed. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>