summaryrefslogtreecommitdiffstats
path: root/src/db
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2016-02-29 13:20:28 +0100
committerLukas Slebodnik <lslebodn@redhat.com>2016-06-10 18:15:27 +0200
commit6dcbfe52d5e64205c0d922f3e89add066b42c496 (patch)
tree17ccc47e89ac2733ee62062c6fbeb8af50179463 /src/db
parentbd93ef2db6d24946ebf98a23fa18d34d45f6b072 (diff)
downloadsssd-6dcbfe52d5e64205c0d922f3e89add066b42c496.tar.gz
sssd-6dcbfe52d5e64205c0d922f3e89add066b42c496.tar.xz
sssd-6dcbfe52d5e64205c0d922f3e89add066b42c496.zip
SYSDB: Add systemtap probes to track sysdb transactions
Actually adds marks for sysdb transactions that receive the transaction nesting level as an argument. The nesting is passed on from probes to marks along with a human-friendly description. The transaction commit is decorated with two probes, before and after. This would allow the caller to distinguish between the time we spend in the transaction (which might be important, because if a transaction is active on an ldb context, even the readers are blocked before the transaction completes) and the time we spend commiting the transaction (which is important because that's when the disk writes occur) The probes would be installed into /usr/share/systemtap/tapset on RHEL and Fedora. This is in line with systemtap's paths which are described in detail in "man 7 stappaths". Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
Diffstat (limited to 'src/db')
-rw-r--r--src/db/sysdb.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/db/sysdb.c b/src/db/sysdb.c
index 0d2f4f06d..80feb8266 100644
--- a/src/db/sysdb.c
+++ b/src/db/sysdb.c
@@ -26,6 +26,7 @@
#include "util/crypto/sss_crypto.h"
#include "db/sysdb_private.h"
#include "confdb/confdb.h"
+#include "util/probes.h"
#include <time.h>
#define LDB_MODULES_PATH "LDB_MODULES_PATH"
@@ -918,6 +919,7 @@ int sysdb_transaction_start(struct sysdb_ctx *sysdb)
ret = ldb_transaction_start(sysdb->ldb);
if (ret == LDB_SUCCESS) {
+ PROBE(SYSDB_TRANSACTION_START, sysdb->transaction_nesting);
sysdb->transaction_nesting++;
} else {
DEBUG(SSSDBG_CRIT_FAILURE,
@@ -929,10 +931,15 @@ int sysdb_transaction_start(struct sysdb_ctx *sysdb)
int sysdb_transaction_commit(struct sysdb_ctx *sysdb)
{
int ret;
+#ifdef HAVE_SYSTEMTAP
+ int commit_nesting = sysdb->transaction_nesting-1;
+#endif
+ PROBE(SYSDB_TRANSACTION_COMMIT_BEFORE, commit_nesting);
ret = ldb_transaction_commit(sysdb->ldb);
if (ret == LDB_SUCCESS) {
sysdb->transaction_nesting--;
+ PROBE(SYSDB_TRANSACTION_COMMIT_AFTER, sysdb->transaction_nesting);
} else {
DEBUG(SSSDBG_CRIT_FAILURE,
"Failed to commit ldb transaction! (%d)\n", ret);
@@ -947,6 +954,7 @@ int sysdb_transaction_cancel(struct sysdb_ctx *sysdb)
ret = ldb_transaction_cancel(sysdb->ldb);
if (ret == LDB_SUCCESS) {
sysdb->transaction_nesting--;
+ PROBE(SYSDB_TRANSACTION_CANCEL, sysdb->transaction_nesting);
} else {
DEBUG(SSSDBG_CRIT_FAILURE,
"Failed to cancel ldb transaction! (%d)\n", ret);