From: Andrew Tridgell Date: Wed, 2 May 2007 05:11:11 +0000 (+1000) Subject: added a builtin fetch function to support samba3 unlocked fetch X-Git-Tag: tevent-0.9.20~348^2~2797 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=317ad52758b39814c3041c98b99a944589e164e4;p=thirdparty%2Fsamba.git added a builtin fetch function to support samba3 unlocked fetch (This used to be ctdb commit 8c57a8355a94a7d714b9bec98533bc40a2bc4684) --- diff --git a/ctdb/common/ctdb_ltdb.c b/ctdb/common/ctdb_ltdb.c index 979d506b0b3..f8141180f2f 100644 --- a/ctdb/common/ctdb_ltdb.c +++ b/ctdb/common/ctdb_ltdb.c @@ -50,6 +50,15 @@ static int ctdb_null_func(struct ctdb_call_info *call) return 0; } +/* + this is a plain fetch procedure that all databases support +*/ +static int ctdb_fetch_func(struct ctdb_call_info *call) +{ + call->reply_data = &call->record_data; + return 0; +} + /* return the lmaster given a key @@ -366,6 +375,17 @@ int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, TDB_DATA indata, talloc_free(ctdb_db); return -1; } + + /* + all databases support the "fetch" function. we need this + for efficient Samba3 ctdb fetch + */ + ret = ctdb_daemon_set_call(ctdb, ctdb_db->db_id, ctdb_fetch_func, CTDB_FETCH_FUNC); + if (ret != 0) { + DEBUG(0,("Failed to setup fetch function for '%s'\n", ctdb_db->db_name)); + talloc_free(ctdb_db); + return -1; + } /* tell all the other nodes about this database */ ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_VNN, 0, diff --git a/ctdb/include/ctdb.h b/ctdb/include/ctdb.h index cb4f73615a0..16d3c403c09 100644 --- a/ctdb/include/ctdb.h +++ b/ctdb/include/ctdb.h @@ -180,25 +180,10 @@ int ctdb_send_message(struct ctdb_context *ctdb, uint32_t vnn, Fetch a ctdb record from a remote node . Underneath this will force the dmaster for the record to be moved to the local node. - */ struct ctdb_record_handle *ctdb_fetch_lock(struct ctdb_db_context *ctdb_db, TALLOC_CTX *mem_ctx, TDB_DATA key, TDB_DATA *data); - -/* - do a fetch lock from a client to the local daemon -*/ -#define FETCH_LOCK_SUCCESS 0 -#define FETCH_LOCK_LOCKFAILED 1 -#define FETCH_LOCK_FETCHFAILED 2 -#define FETCH_LOCK_DMASTERFAILED 3 - -int ctdb_client_fetch_lock(struct ctdb_db_context *ctdb_db, - TALLOC_CTX *mem_ctx, - TDB_DATA key, TDB_DATA *data); - - int ctdb_record_store(struct ctdb_record_handle *h, TDB_DATA data); int ctdb_register_message_handler(struct ctdb_context *ctdb, diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h index 30f1607c669..0807a37a480 100644 --- a/ctdb/include/ctdb_private.h +++ b/ctdb/include/ctdb_private.h @@ -30,7 +30,8 @@ #define CTDB_DS_ALIGNMENT 8 -#define CTDB_NULL_FUNC 0xF0000001 +#define CTDB_NULL_FUNC 0xFF000001 +#define CTDB_FETCH_FUNC 0xFF000002 #define CTDB_CURRENT_NODE 0xF0000001 #define CTDB_BROADCAST_VNN 0xF0000002 diff --git a/ctdb/tools/ctdb_control.c b/ctdb/tools/ctdb_control.c index ee5420a0f4d..6f41d3f73d3 100644 --- a/ctdb/tools/ctdb_control.c +++ b/ctdb/tools/ctdb_control.c @@ -50,7 +50,8 @@ static void usage(void) " cleardb deletes all records in a db\n" " getrecmode get recovery mode\n" " setrecmode set recovery mode\n" - " recover recover the cluster\n"); + " recover recover the cluster\n" + " attach attach a database\n"); exit(1); }