From a116d7c7d9ddaf6bc6798ed98b3c62369e924076 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 29 Aug 2007 11:46:44 +0000 Subject: r24773: Fix a ctdb connection lockup The lockup could happen when packet_read_sync() gets two packets in a row, the first one being an async message, and the second one being the response to a ctdb request. Also add some debug msg to ctdb_conn.c, and cut off the "locking key" messages to only dump 20 hex chars at debug level 10. >10 will dump everything. (This used to be commit 0a55880a240b619810371a19144dd0a75208adfe) --- source3/lib/dbwrap_ctdb.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'source3/lib/dbwrap_ctdb.c') diff --git a/source3/lib/dbwrap_ctdb.c b/source3/lib/dbwrap_ctdb.c index 73d8eeffea..c5cb8d0aad 100644 --- a/source3/lib/dbwrap_ctdb.c +++ b/source3/lib/dbwrap_ctdb.c @@ -85,7 +85,9 @@ 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); - DEBUG(10, ("Unlocking key %s\n", + DEBUG(10, (DEBUGLEVEL > 10 + ? "Unlocking db %u key %s\n" : "Unlocking db %u key %20s\n", + (int)crec->ctdb_ctx->db_id, hex_encode(data, (unsigned char *)data->key.dptr, data->key.dsize))); @@ -135,9 +137,14 @@ static struct db_record *db_ctdb_fetch_locked(struct db_context *db, */ again: - DEBUG(10, ("Locking key %s\n", - hex_encode(result, (unsigned char *)key.dptr, - key.dsize))); + if (DEBUGLEVEL >= 10) { + char *keystr = hex_encode(result, key.dptr, key.dsize); + DEBUG(10, (DEBUGLEVEL > 10 + ? "Locking db %u key %s\n" + : "Locking db %u key %20s\n", + (int)crec->ctdb_ctx->db_id, keystr)); + TALLOC_FREE(keystr); + } if (tdb_chainlock(ctx->wtdb->tdb, key) != 0) { DEBUG(3, ("tdb_chainlock failed\n")); -- cgit