summaryrefslogtreecommitdiffstats
path: root/src/db/sysdb.c
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2016-02-29 13:22:18 +0100
committerLukas Slebodnik <lslebodn@redhat.com>2016-06-10 18:15:27 +0200
commitbd93ef2db6d24946ebf98a23fa18d34d45f6b072 (patch)
tree029a9f1963a456ca99400ee4acb0735448bd1986 /src/db/sysdb.c
parent29c5542feb4c45865ea61be97e0e84a1d1f04918 (diff)
downloadsssd-bd93ef2db6d24946ebf98a23fa18d34d45f6b072.tar.gz
sssd-bd93ef2db6d24946ebf98a23fa18d34d45f6b072.tar.xz
sssd-bd93ef2db6d24946ebf98a23fa18d34d45f6b072.zip
SYSDB: Track transaction nesting in sysdb_ctx
Adds an integer that tracks how deeply nested we are in sysdb transactions. This will become useful later, because generally we are only interested in level-0 transactions when probing, so we'll want to pass the transaction nesting to the systemtap probes. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
Diffstat (limited to 'src/db/sysdb.c')
-rw-r--r--src/db/sysdb.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/db/sysdb.c b/src/db/sysdb.c
index d7540f0cc..0d2f4f06d 100644
--- a/src/db/sysdb.c
+++ b/src/db/sysdb.c
@@ -917,7 +917,9 @@ int sysdb_transaction_start(struct sysdb_ctx *sysdb)
int ret;
ret = ldb_transaction_start(sysdb->ldb);
- if (ret != LDB_SUCCESS) {
+ if (ret == LDB_SUCCESS) {
+ sysdb->transaction_nesting++;
+ } else {
DEBUG(SSSDBG_CRIT_FAILURE,
"Failed to start ldb transaction! (%d)\n", ret);
}
@@ -929,7 +931,9 @@ int sysdb_transaction_commit(struct sysdb_ctx *sysdb)
int ret;
ret = ldb_transaction_commit(sysdb->ldb);
- if (ret != LDB_SUCCESS) {
+ if (ret == LDB_SUCCESS) {
+ sysdb->transaction_nesting--;
+ } else {
DEBUG(SSSDBG_CRIT_FAILURE,
"Failed to commit ldb transaction! (%d)\n", ret);
}
@@ -941,7 +945,9 @@ int sysdb_transaction_cancel(struct sysdb_ctx *sysdb)
int ret;
ret = ldb_transaction_cancel(sysdb->ldb);
- if (ret != LDB_SUCCESS) {
+ if (ret == LDB_SUCCESS) {
+ sysdb->transaction_nesting--;
+ } else {
DEBUG(SSSDBG_CRIT_FAILURE,
"Failed to cancel ldb transaction! (%d)\n", ret);
}