Rev 234: added a builtin fetch function to support samba3 unlocked
fetch in http://samba.org/~tridge/ctdb
tridge at samba.org
tridge at samba.org
Wed May 2 05:11:12 GMT 2007
------------------------------------------------------------
revno: 234
revision-id: tridge at samba.org-20070502051111-kol2q81ec0oz8o1k
parent: tridge at samba.org-20070502033455-ouk4wh3sa9nmzdjv
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge
timestamp: Wed 2007-05-02 15:11:11 +1000
message:
added a builtin fetch function to support samba3 unlocked fetch
modified:
common/ctdb_ltdb.c ctdb_ltdb.c-20061128065342-to93h6eejj5kon81-2
include/ctdb.h ctdb.h-20061117234101-o3qt14umlg9en8z0-11
include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13
tools/ctdb_control.c ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1
=== modified file 'common/ctdb_ltdb.c'
--- a/common/ctdb_ltdb.c 2007-05-01 03:25:02 +0000
+++ b/common/ctdb_ltdb.c 2007-05-02 05:11:11 +0000
@@ -50,6 +50,15 @@
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 @@
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,
=== modified file 'include/ctdb.h'
--- a/include/ctdb.h 2007-05-02 00:53:29 +0000
+++ b/include/ctdb.h 2007-05-02 05:11:11 +0000
@@ -180,25 +180,10 @@
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,
=== modified file 'include/ctdb_private.h'
--- a/include/ctdb_private.h 2007-05-02 01:02:04 +0000
+++ b/include/ctdb_private.h 2007-05-02 05:11:11 +0000
@@ -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
=== modified file 'tools/ctdb_control.c'
--- a/tools/ctdb_control.c 2007-05-02 03:34:55 +0000
+++ b/tools/ctdb_control.c 2007-05-02 05:11:11 +0000
@@ -50,7 +50,8 @@
" 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);
}
More information about the samba-cvs
mailing list