summaryrefslogtreecommitdiff
path: root/source3/lib/dbwrap_ctdb.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2010-03-05 16:46:36 +0100
committerVolker Lendecke <vl@samba.org>2010-03-22 17:32:18 +0100
commit70f9338bf2e6081916ffe5bb7cddf50b4e958b24 (patch)
tree8a7fe5fc62fd2d06b3afe2cf2415b7cabedb1bb4 /source3/lib/dbwrap_ctdb.c
parentcad0c004ad54d80dcb25803f0ebb317344a42792 (diff)
downloadsamba-70f9338bf2e6081916ffe5bb7cddf50b4e958b24.tar.gz
samba-70f9338bf2e6081916ffe5bb7cddf50b4e958b24.tar.bz2
samba-70f9338bf2e6081916ffe5bb7cddf50b4e958b24.zip
s3: Add the "ctdb locktime warn threshold" parameter
This is mainly a debugging aid for post-mortem analysis in case a cluster file system is slow.
Diffstat (limited to 'source3/lib/dbwrap_ctdb.c')
-rw-r--r--source3/lib/dbwrap_ctdb.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/source3/lib/dbwrap_ctdb.c b/source3/lib/dbwrap_ctdb.c
index 938a312657..bef91cb1ec 100644
--- a/source3/lib/dbwrap_ctdb.c
+++ b/source3/lib/dbwrap_ctdb.c
@@ -50,6 +50,7 @@ struct db_ctdb_ctx {
struct db_ctdb_rec {
struct db_ctdb_ctx *ctdb_ctx;
struct ctdb_ltdb_header header;
+ struct timeval lock_time;
};
static NTSTATUS tdb_error_to_ntstatus(struct tdb_context *tdb)
@@ -898,6 +899,7 @@ static int db_ctdb_record_destr(struct db_record* data)
{
struct db_ctdb_rec *crec = talloc_get_type_abort(
data->private_data, struct db_ctdb_rec);
+ int threshold;
DEBUG(10, (DEBUGLEVEL > 10
? "Unlocking db %u key %s\n"
@@ -911,6 +913,14 @@ static int db_ctdb_record_destr(struct db_record* data)
return -1;
}
+ threshold = lp_ctdb_locktime_warn_threshold();
+ if (threshold != 0) {
+ double timediff = timeval_elapsed(&crec->lock_time);
+ if ((timediff * 1000) > threshold) {
+ DEBUG(0, ("Held tdb lock %f seconds\n", timediff));
+ }
+ }
+
return 0;
}
@@ -1011,6 +1021,8 @@ again:
migrate_attempts));
}
+ GetTimeOfDay(&crec->lock_time);
+
memcpy(&crec->header, ctdb_data.dptr, sizeof(crec->header));
result->value.dsize = ctdb_data.dsize - sizeof(crec->header);