[SCM] CTDB repository - branch libctdb updated - ctdb-1.0.114-85-g6cd4099

Ronnie Sahlberg sahlberg at samba.org
Tue May 11 12:33:32 MDT 2010


The branch, libctdb has been updated
       via  6cd409926803bed1a3a611347ef4e9ddaa8c4d86 (commit)
       via  d883679e7a8668147dd30e04ddd615c1f787a900 (commit)
       via  f63313be672c73a0fb32795ed78d8ef36a974792 (commit)
       via  bd00323cc572c5504143b0e4dad04ea2a5635a3f (commit)
      from  2dbbc98985783dc14462371ffaf1febf2484a79d (commit)

http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=libctdb


- Log -----------------------------------------------------------------
commit 6cd409926803bed1a3a611347ef4e9ddaa8c4d86
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Wed May 12 04:10:18 2010 +1000

    change the libctdb_ prefix to ctdb_

commit d883679e7a8668147dd30e04ddd615c1f787a900
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Wed May 12 03:59:15 2010 +1000

    Change the ifdefs to match the filename

commit f63313be672c73a0fb32795ed78d8ef36a974792
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Wed May 12 03:56:20 2010 +1000

    rename ctdb.h to ctdb_protocol.h
    rename libctdb.h to ctdb.h
    
    update all source files to include ctdb_protocol.h when required

commit bd00323cc572c5504143b0e4dad04ea2a5635a3f
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Wed May 12 03:32:41 2010 +1000

    dont include talloc in libctdb.a
    use te talloc that the application we link with provides

-----------------------------------------------------------------------

Summary of changes:
 Makefile.in                         |    5 +-
 client/ctdb_client.c                |    3 +-
 common/cmdline.c                    |    6 +-
 common/ctdb_logging.c               |    4 +-
 common/system_aix.c                 |    3 +-
 common/system_common.c              |    1 +
 common/system_linux.c               |    3 +-
 include/ctdb.h                      |  730 +----------------------------------
 include/ctdb_private.h              |    1 -
 include/{ctdb.h => ctdb_protocol.h} |    4 +-
 include/libctdb.h                   |   59 ---
 libctdb/ctdb_io.c                   |    4 +-
 libctdb/ctdb_ltdb.c                 |    3 +-
 libctdb/ctdb_message.c              |    3 +-
 libctdb/ctdb_util.c                 |    3 +-
 libctdb/libctdb.c                   |   43 +-
 libctdb/tst.c                       |   12 +-
 packaging/RPM/ctdb.spec.in          |    1 +
 server/ctdb_banning.c               |    4 +-
 server/ctdb_call.c                  |    3 +-
 server/ctdb_control.c               |    3 +-
 server/ctdb_daemon.c                |    4 +-
 server/ctdb_freeze.c                |    3 +-
 server/ctdb_keepalive.c             |    3 +-
 server/ctdb_lockwait.c              |    3 +-
 server/ctdb_logging.c               |    4 +-
 server/ctdb_ltdb_server.c           |    3 +-
 server/ctdb_monitor.c               |    3 +-
 server/ctdb_persistent.c            |    3 +-
 server/ctdb_recover.c               |    3 +-
 server/ctdb_recoverd.c              |    4 +-
 server/ctdb_server.c                |    3 +-
 server/ctdb_serverids.c             |    5 +-
 server/ctdb_takeover.c              |    5 +-
 server/ctdb_traverse.c              |    3 +-
 server/ctdb_tunables.c              |    3 +-
 server/ctdb_uptime.c                |    3 +-
 server/ctdb_vacuum.c                |    6 +-
 server/ctdbd.c                      |    1 +
 server/eventscript.c                |    5 +-
 tcp/tcp_connect.c                   |    3 +-
 tcp/tcp_init.c                      |    3 +-
 tcp/tcp_io.c                        |    3 +-
 tests/src/ctdb_bench.c              |    2 +-
 tests/src/ctdb_fetch.c              |    1 +
 tests/src/ctdb_fetch_one.c          |    1 +
 tests/src/ctdb_persistent.c         |    1 +
 tests/src/ctdb_randrec.c            |    1 +
 tests/src/ctdb_store.c              |    1 +
 tests/src/ctdb_transaction.c        |    1 +
 tests/src/ctdb_traverse.c           |    1 +
 tools/ctdb.c                        |    6 +-
 tools/ctdb_vacuum.c                 |    6 +-
 53 files changed, 142 insertions(+), 853 deletions(-)
 copy include/{ctdb.h => ctdb_protocol.h} (99%)
 delete mode 100644 include/libctdb.h


Changeset truncated at 500 lines:

diff --git a/Makefile.in b/Makefile.in
index be7a182..72c359b 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -45,12 +45,12 @@ CTDB_LIB_OBJ = libctdb/libctdb.o libctdb/ctdb_io.o \
 	libctdb/ctdb_client.o libctdb/ctdb_message.o \
 	libctdb/ctdb_ltdb.o \
 	libctdb/ctdb_util.o lib/util/debug.o \
-	@EVENTS_OBJ@ @TALLOC_OBJ@ @TDB_OBJ@ $(UTIL_OBJ) \
+	@EVENTS_OBJ@ @TDB_OBJ@ $(UTIL_OBJ) \
 	@LIBREPLACEOBJ@ 
 
 CTDB_COMMON_OBJ = common/cmdline.o common/rb_tree.o @CTDB_SYSTEM_OBJ@ \
 	common/system_common.o common/ctdb_logging.c \
-	libctdb/libctdb.a
+	@TALLOC_OBJ@ libctdb/libctdb.a 
 
 CTDB_TCP_OBJ = tcp/tcp_connect.o tcp/tcp_io.o tcp/tcp_init.o
 
@@ -223,6 +223,7 @@ install: all
 	${INSTALLCMD} -m 755 bin/smnotify $(DESTDIR)$(bindir)
 	$(INSTALLCMD) -m 755 bin/ping_pong $(DESTDIR)$(bindir)
 	${INSTALLCMD} -m 644 include/ctdb.h $(DESTDIR)$(includedir)
+	${INSTALLCMD} -m 644 include/ctdb_protocol.h $(DESTDIR)$(includedir)
 	${INSTALLCMD} -m 644 include/ctdb_private.h $(DESTDIR)$(includedir) # for samba3
 	${INSTALLCMD} -m 644 config/functions $(DESTDIR)$(etcdir)/ctdb
 	${INSTALLCMD} -m 755 config/statd-callout $(DESTDIR)$(etcdir)/ctdb
diff --git a/client/ctdb_client.c b/client/ctdb_client.c
index 665f61d..1afa66a 100644
--- a/client/ctdb_client.c
+++ b/client/ctdb_client.c
@@ -27,7 +27,8 @@
 #include "system/filesys.h"
 #include "system/locale.h"
 #include <stdlib.h>
-#include "../include/ctdb_private.h"
+#include "include/ctdb_protocol.h"
+#include "include/ctdb_private.h"
 #include "lib/util/dlinklist.h"
 
 
diff --git a/common/cmdline.c b/common/cmdline.c
index 332a448..fb725f4 100644
--- a/common/cmdline.c
+++ b/common/cmdline.c
@@ -21,9 +21,9 @@
 #include "lib/events/events.h"
 #include "system/filesys.h"
 #include "popt.h"
-#include "../include/ctdb.h"
-#include "../include/ctdb_private.h"
-#include "../common/rb_tree.h"
+#include "include/ctdb_protocol.h"
+#include "include/ctdb_private.h"
+#include "common/rb_tree.h"
 #include <ctype.h>
 
 /* Handle common command line options for ctdb test progs
diff --git a/common/ctdb_logging.c b/common/ctdb_logging.c
index d0870ce..3367646 100644
--- a/common/ctdb_logging.c
+++ b/common/ctdb_logging.c
@@ -21,8 +21,8 @@
 #include "lib/events/events.h"
 #include "lib/tdb/include/tdb.h"
 #include "system/time.h"
-#include "../include/ctdb_private.h"
-#include "../include/ctdb.h"
+#include "include/ctdb_protocol.h"
+#include "include/ctdb_private.h"
 
 int log_ringbuf_size;
 
diff --git a/common/system_aix.c b/common/system_aix.c
index 5fe5413..cafbd3d 100644
--- a/common/system_aix.c
+++ b/common/system_aix.c
@@ -23,7 +23,8 @@
 #include "system/network.h"
 #include "system/filesys.h"
 #include "system/wait.h"
-#include "../include/ctdb_private.h"
+#include "include/ctdb_protocol.h"
+#include "include/ctdb_private.h"
 #include <netinet/if_ether.h>
 #include <netinet/ip6.h>
 #include <net/if_arp.h>
diff --git a/common/system_common.c b/common/system_common.c
index 9aa4620..99d0a4d 100644
--- a/common/system_common.c
+++ b/common/system_common.c
@@ -20,6 +20,7 @@
 
 #include "includes.h"
 #include "system/network.h"
+#include "include/ctdb_protocol.h"
 
 /*
   uint16 checksum for n bytes
diff --git a/common/system_linux.c b/common/system_linux.c
index b8aace4..81e1e9b 100644
--- a/common/system_linux.c
+++ b/common/system_linux.c
@@ -22,7 +22,8 @@
 #include "system/network.h"
 #include "system/filesys.h"
 #include "system/wait.h"
-#include "../include/ctdb_private.h"
+#include "include/ctdb_protocol.h"
+#include "include/ctdb_private.h"
 #include "lib/events/events.h"
 #include <netinet/if_ether.h>
 #include <netinet/ip6.h>
diff --git a/include/ctdb.h b/include/ctdb.h
index 540ca98..dd5361c 100644
--- a/include/ctdb.h
+++ b/include/ctdb.h
@@ -1,7 +1,7 @@
 /* 
    ctdb database library
 
-   Copyright (C) Andrew Tridgell  2006
+   Copyright (C) Ronnie sahlberg 2010
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -20,729 +20,41 @@
 #ifndef _CTDB_H
 #define _CTDB_H
 
-#define CTDB_IMMEDIATE_MIGRATION	0x00000001
-struct ctdb_call {
-	int call_id;
-	TDB_DATA key;
-	TDB_DATA call_data;
-	TDB_DATA reply_data;
-	uint32_t status;
-	uint32_t flags;
-};
+struct ctdb_context *ctdb_connect(const char *addr);
 
-/*
-  structure passed to a ctdb call backend function
-*/
-struct ctdb_call_info {
-	TDB_DATA key;          /* record key */
-	TDB_DATA record_data;  /* current data in the record */
-	TDB_DATA *new_data;    /* optionally updated record data */
-	TDB_DATA *call_data;   /* optionally passed from caller */
-	TDB_DATA *reply_data;  /* optionally returned by function */
-	uint32_t status;       /* optional reply status - defaults to zero */
-};
-
-#define CTDB_ERR_INVALID 1
-#define CTDB_ERR_NOMEM 2
-
-/*
-  ctdb flags
-*/
-#define CTDB_FLAG_TORTURE      (1<<1)
-
-/* 
-   a message handler ID meaning "give me all messages"
- */
-#define CTDB_SRVID_ALL (~(uint64_t)0)
-
-/*
-  srvid type : RECOVERY
-*/
-#define CTDB_SRVID_RECOVERY	0xF100000000000000LL
-
-/* 
-   a message handler ID meaning that the cluster has been reconfigured
- */
-#define CTDB_SRVID_RECONFIGURE 0xF200000000000000LL
-
-/* 
-   a message handler ID meaning that an IP address has been released
- */
-#define CTDB_SRVID_RELEASE_IP 0xF300000000000000LL
-
-/* 
-   a message ID to set the node flags in the recovery daemon
- */
-#define CTDB_SRVID_SET_NODE_FLAGS 0xF400000000000000LL
-
-/* 
-   a message ID to ask the recovery daemon to update the expected node
-   assignment for a public ip
- */
-#define CTDB_SRVID_RECD_UPDATE_IP 0xF500000000000000LL
-
-/*
-  a message to tell the recovery daemon to fetch a set of records
- */
-#define CTDB_SRVID_VACUUM_FETCH 0xF700000000000000LL
-
-/*
-  a message to tell the recovery daemon to write a talloc memdump
-  to the log
- */
-#define CTDB_SRVID_MEM_DUMP 0xF800000000000000LL
-
-/* 
-   a message ID to get the recovery daemon to push the node flags out
- */
-#define CTDB_SRVID_PUSH_NODE_FLAGS 0xF900000000000000LL
-
-/* 
-   a message ID to get the recovery daemon to reload the nodes file
- */
-#define CTDB_SRVID_RELOAD_NODES 0xFA00000000000000LL
-
-/* 
-   a message ID to get the recovery daemon to perform a takeover run
- */
-#define CTDB_SRVID_TAKEOVER_RUN 0xFB00000000000000LL
-
-/* A message id to ask the recovery daemon to temporarily disable the
-   public ip checks
-*/
-#define CTDB_SRVID_DISABLE_IP_CHECK  0xFC00000000000000LL
-
-/* A dummy port used for sending back ipreallocate resposnes to the main
-   daemon
-*/
-#define CTDB_SRVID_TAKEOVER_RUN_RESPONSE  0xFD00000000000000LL
-
-/* A port reserved for samba (top 32 bits)
- */
-#define CTDB_SRVID_SAMBA_NOTIFY  0xFE00000000000000LL
-
-/* used on the domain socket, send a pdu to the local daemon */
-#define CTDB_CURRENT_NODE     0xF0000001
-/* send a broadcast to all nodes in the cluster, active or not */
-#define CTDB_BROADCAST_ALL    0xF0000002
-/* send a broadcast to all nodes in the current vnn map */
-#define CTDB_BROADCAST_VNNMAP 0xF0000003
-/* send a broadcast to all connected nodes */
-#define CTDB_BROADCAST_CONNECTED 0xF0000004
-
-/* the key used for transaction locking on persistent databases */
-#define CTDB_TRANSACTION_LOCK_KEY "__transaction_lock__"
-
-/* the key used to store persistent db sequence number */
-#define CTDB_DB_SEQNUM_KEY "__db_sequence_number__"
-
-enum control_state {CTDB_CONTROL_WAIT, CTDB_CONTROL_DONE, CTDB_CONTROL_ERROR, CTDB_CONTROL_TIMEOUT};
-
-struct ctdb_client_control_state {
-	struct ctdb_context *ctdb;
-	uint32_t reqid;
-	int32_t status;
-	TDB_DATA outdata;
-	enum control_state state;
-	char *errormsg;
-	struct ctdb_req_control *c;
-
-	/* if we have a callback registered for the completion (or failure) of
-	   this control
-	   if a callback is used, it MUST talloc_free the cb_data passed to it
-	*/
-	struct {
-		void (*fn)(struct ctdb_client_control_state *);
-		void *private_data;
-	} async;	
-};
-
-struct ctdb_client_notify_register {
-	uint64_t srvid;
-	uint32_t len;
-	uint8_t notify_data[1];
-};
-
-struct ctdb_client_notify_deregister {
-	uint64_t srvid;
-};
-
-struct event_context;
-
-/*
-  initialise ctdb subsystem
-*/
-struct ctdb_context *ctdb_init(struct event_context *ev);
-
-/*
-  choose the transport
-*/
-int ctdb_set_transport(struct ctdb_context *ctdb, const char *transport);
-
-/*
-  set the directory for the local databases
-*/
-int ctdb_set_tdb_dir(struct ctdb_context *ctdb, const char *dir);
-int ctdb_set_tdb_dir_persistent(struct ctdb_context *ctdb, const char *dir);
-int ctdb_set_tdb_dir_state(struct ctdb_context *ctdb, const char *dir);
-
-/*
-  set some flags
-*/
-void ctdb_set_flags(struct ctdb_context *ctdb, unsigned flags);
-
-/*
-  set max acess count before a dmaster migration
-*/
-void ctdb_set_max_lacount(struct ctdb_context *ctdb, unsigned count);
-
-/*
-  tell ctdb what address to listen on, in transport specific format
-*/
-int ctdb_set_address(struct ctdb_context *ctdb, const char *address);
-
-int ctdb_set_socketname(struct ctdb_context *ctdb, const char *socketname);
-
-/*
-  tell ctdb what nodes are available. This takes a filename, which will contain
-  1 node address per line, in a transport specific format
-*/
-int ctdb_set_nlist(struct ctdb_context *ctdb, const char *nlist);
-
-/*
-  Check that a specific ip address exists in the node list and returns
-  the id for the node or -1
-*/
-int ctdb_ip_to_nodeid(struct ctdb_context *ctdb, const char *nodeip);
-
-/*
-  start the ctdb protocol
-*/
-int ctdb_start(struct ctdb_context *ctdb);
-int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork, bool use_syslog);
-
-/*
-  attach to a ctdb database
-*/
-struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb, const char *name, bool persistent, uint32_t tdb_flags);
-
-/*
-  find an attached ctdb_db handle given a name
- */
-struct ctdb_db_context *ctdb_db_handle(struct ctdb_context *ctdb, const char *name);
-
-/*
-  error string for last ctdb error
-*/
-const char *ctdb_errstr(struct ctdb_context *);
-
-/* a ctdb call function */
-typedef int (*ctdb_fn_t)(struct ctdb_call_info *);
-
-/*
-  setup a ctdb call function
-*/
-int ctdb_set_call(struct ctdb_db_context *ctdb_db, ctdb_fn_t fn, uint32_t id);
-
-
-
-/*
-  make a ctdb call. The associated ctdb call function will be called on the DMASTER
-  for the given record
-*/
-int ctdb_call(struct ctdb_db_context *ctdb_db, struct ctdb_call *call);
-
-/*
-  initiate an ordered ctdb cluster shutdown
-  this function will never return
-*/
-void ctdb_shutdown(struct ctdb_context *ctdb);
-
-/* return pnn of this node */
-uint32_t ctdb_get_pnn(struct ctdb_context *ctdb);
-
-/*
-  return the number of nodes
-*/
-uint32_t ctdb_get_num_nodes(struct ctdb_context *ctdb);
-
-/* setup a handler for ctdb messages */
-typedef void (*ctdb_message_fn_t)(struct ctdb_context *, uint64_t srvid, 
-				  TDB_DATA data, void *);
-int ctdb_set_message_handler(struct ctdb_context *ctdb, uint64_t srvid, 
-			     ctdb_message_fn_t handler,
-			     void *private_data);
-
-
-int ctdb_call(struct ctdb_db_context *ctdb_db, struct ctdb_call *call);
-struct ctdb_client_call_state *ctdb_call_send(struct ctdb_db_context *ctdb_db, struct ctdb_call *call);
-int ctdb_call_recv(struct ctdb_client_call_state *state, struct ctdb_call *call);
-
-/* send a ctdb message */
-int ctdb_send_message(struct ctdb_context *ctdb, uint32_t pnn,
-		      uint64_t srvid, TDB_DATA data);
-
-
-/* 
-   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);
-
-int ctdb_record_store(struct ctdb_record_handle *h, TDB_DATA data);
+int ctdb_get_fd(struct ctdb_context *ctdb);
 
-int ctdb_fetch(struct ctdb_db_context *ctdb_db, TALLOC_CTX *mem_ctx, 
-	       TDB_DATA key, TDB_DATA *data);
+int ctdb_which_events(struct ctdb_context *ctdb);
 
-int ctdb_register_message_handler(struct ctdb_context *ctdb, 
-				  TALLOC_CTX *mem_ctx,
-				  uint64_t srvid,
-				  ctdb_message_fn_t handler,
-				  void *private_data);
+int ctdb_service(struct ctdb_context *ctdb);
 
-struct ctdb_db_context *find_ctdb_db(struct ctdb_context *ctdb, uint32_t id);
 
 
-struct ctdb_context *ctdb_cmdline_client(struct event_context *ev);
+typedef void ctdb_handle;
 
-struct ctdb_statistics;
-int ctdb_ctrl_statistics(struct ctdb_context *ctdb, uint32_t destnode, struct ctdb_statistics *status);
-
-int ctdb_ctrl_shutdown(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode);
-
-struct ctdb_vnn_map;
-int ctdb_ctrl_getvnnmap(struct ctdb_context *ctdb, 
-		struct timeval timeout, uint32_t destnode, 
-		TALLOC_CTX *mem_ctx, struct ctdb_vnn_map **vnnmap);
-int ctdb_ctrl_setvnnmap(struct ctdb_context *ctdb,
-		struct timeval timeout, uint32_t destnode, 
-		TALLOC_CTX *mem_ctx, struct ctdb_vnn_map *vnnmap);
-
-/* table that contains a list of all dbids on a node
- */
-struct ctdb_dbid_map {
-	uint32_t num;
-	struct ctdb_dbid {
-		uint32_t dbid;
-		bool persistent;
-	} dbs[1];
-};
-int ctdb_ctrl_getdbmap(struct ctdb_context *ctdb, 
-	struct timeval timeout, uint32_t destnode, 
-	TALLOC_CTX *mem_ctx, struct ctdb_dbid_map **dbmap);
-
-
-struct ctdb_node_map;
-
-int ctdb_ctrl_getnodemap(struct ctdb_context *ctdb, 
-		    struct timeval timeout, uint32_t destnode, 
-		    TALLOC_CTX *mem_ctx, struct ctdb_node_map **nodemap);
-
-int ctdb_ctrl_getnodemapv4(struct ctdb_context *ctdb, 
-		    struct timeval timeout, uint32_t destnode, 
-		    TALLOC_CTX *mem_ctx, struct ctdb_node_map **nodemap);
-
-int ctdb_ctrl_reload_nodes_file(struct ctdb_context *ctdb, 
-		    struct timeval timeout, uint32_t destnode);
-
-struct ctdb_key_list {
-	uint32_t dbid;
-	uint32_t num;
-	TDB_DATA *keys;
-	struct ctdb_ltdb_header *headers;
-	TDB_DATA *data;
-};
-
-int ctdb_ctrl_pulldb(
-       struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid,
-       uint32_t lmaster, TALLOC_CTX *mem_ctx,
-       struct timeval timeout, TDB_DATA *outdata);
-
-struct ctdb_client_control_state *ctdb_ctrl_pulldb_send(
-       struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid,
-       uint32_t lmaster, TALLOC_CTX *mem_ctx, struct timeval timeout);
-
-int ctdb_ctrl_pulldb_recv(
-       struct ctdb_context *ctdb,
-       TALLOC_CTX *mem_ctx, struct ctdb_client_control_state *state,
-       TDB_DATA *outdata);
-
-int ctdb_ctrl_pushdb(
-       struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid,
-       TALLOC_CTX *mem_ctx,
-       struct timeval timeout, TDB_DATA indata);
-
-struct ctdb_client_control_state *ctdb_ctrl_pushdb_send(
-       struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid,
-       TALLOC_CTX *mem_ctx, struct timeval timeout,
-       TDB_DATA indata);
-
-int ctdb_ctrl_pushdb_recv(
-       struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx,
-       struct ctdb_client_control_state *state);
-
-
-int ctdb_ctrl_copydb(struct ctdb_context *ctdb, 


-- 
CTDB repository


More information about the samba-cvs mailing list