From a41af25ebd424184ceb300a181cbfca7a9eb014c Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 21 Dec 2020 14:40:47 +0100 Subject: [PATCH] dbwrap: Remove "db_context->try_fetch_locked()" fn pointer Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- lib/dbwrap/dbwrap_private.h | 3 --- lib/dbwrap/dbwrap_tdb.c | 15 --------------- source3/lib/dbwrap/dbwrap_ctdb.c | 19 ------------------- 3 files changed, 37 deletions(-) diff --git a/lib/dbwrap/dbwrap_private.h b/lib/dbwrap/dbwrap_private.h index 8a1f03c7bec..3ac5ebf97a1 100644 --- a/lib/dbwrap/dbwrap_private.h +++ b/lib/dbwrap/dbwrap_private.h @@ -40,9 +40,6 @@ struct db_context { struct db_record *(*fetch_locked)(struct db_context *db, TALLOC_CTX *mem_ctx, TDB_DATA key); - struct db_record *(*try_fetch_locked)(struct db_context *db, - TALLOC_CTX *mem_ctx, - TDB_DATA key); int (*traverse)(struct db_context *db, int (*f)(struct db_record *rec, void *private_data), diff --git a/lib/dbwrap/dbwrap_tdb.c b/lib/dbwrap/dbwrap_tdb.c index 74b895a7736..6cd95fa25ad 100644 --- a/lib/dbwrap/dbwrap_tdb.c +++ b/lib/dbwrap/dbwrap_tdb.c @@ -169,20 +169,6 @@ static struct db_record *db_tdb_fetch_locked( return db_tdb_fetch_locked_internal(db, ctx, mem_ctx, key); } -static struct db_record *db_tdb_try_fetch_locked( - struct db_context *db, TALLOC_CTX *mem_ctx, TDB_DATA key) -{ - struct db_tdb_ctx *ctx = talloc_get_type_abort(db->private_data, - struct db_tdb_ctx); - - db_tdb_log_key("Trying to lock", key); - if (tdb_chainlock_nonblock(ctx->wtdb->tdb, key) != 0) { - DEBUG(3, ("tdb_chainlock_nonblock failed\n")); - return NULL; - } - return db_tdb_fetch_locked_internal(db, ctx, mem_ctx, key); -} - static NTSTATUS db_tdb_do_locked(struct db_context *db, TDB_DATA key, void (*fn)(struct db_record *rec, TDB_DATA value, @@ -509,7 +495,6 @@ struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx, db_tdb->id.ino = st.st_ino; result->fetch_locked = db_tdb_fetch_locked; - result->try_fetch_locked = db_tdb_try_fetch_locked; result->do_locked = db_tdb_do_locked; result->traverse = db_tdb_traverse; result->traverse_read = db_tdb_traverse_read; diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c index 9c9e05b9d77..683acd90063 100644 --- a/source3/lib/dbwrap/dbwrap_ctdb.c +++ b/source3/lib/dbwrap/dbwrap_ctdb.c @@ -1264,24 +1264,6 @@ static struct db_record *db_ctdb_fetch_locked(struct db_context *db, return fetch_locked_internal(ctx, mem_ctx, key, false); } -static struct db_record *db_ctdb_try_fetch_locked(struct db_context *db, - TALLOC_CTX *mem_ctx, - TDB_DATA key) -{ - struct db_ctdb_ctx *ctx = talloc_get_type_abort(db->private_data, - struct db_ctdb_ctx); - - if (ctx->transaction != NULL) { - return db_ctdb_fetch_locked_transaction(ctx, mem_ctx, key); - } - - if (db->persistent) { - return db_ctdb_fetch_locked_persistent(ctx, mem_ctx, key); - } - - return fetch_locked_internal(ctx, mem_ctx, key, true); -} - struct db_ctdb_parse_record_state { void (*parser)(TDB_DATA key, TDB_DATA data, void *private_data); void *private_data; @@ -1988,7 +1970,6 @@ struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx, result->private_data = (void *)db_ctdb; result->fetch_locked = db_ctdb_fetch_locked; - result->try_fetch_locked = db_ctdb_try_fetch_locked; result->parse_record = db_ctdb_parse_record; result->parse_record_send = db_ctdb_parse_record_send; result->parse_record_recv = db_ctdb_parse_record_recv;