mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
added a builtin fetch function to support samba3 unlocked fetch
(This used to be ctdb commit 8c57a8355a94a7d714b9bec98533bc40a2bc4684)
This commit is contained in:
parent
2767ebb8df
commit
317ad52758
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -50,7 +50,8 @@ static void usage(void)
|
||||
" cleardb <vnn> <dbid> deletes all records in a db\n"
|
||||
" getrecmode <vnn> get recovery mode\n"
|
||||
" setrecmode <vnn> <mode> set recovery mode\n"
|
||||
" recover <vnn> recover the cluster\n");
|
||||
" recover <vnn> recover the cluster\n"
|
||||
" attach <dbname> attach a database\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user