summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ctdb/common/ctdb.c10
-rw-r--r--ctdb/common/ctdb_call.c2
-rw-r--r--ctdb/common/ctdb_client.c28
-rw-r--r--ctdb/common/ctdb_control.c4
-rw-r--r--ctdb/common/ctdb_daemon.c2
-rw-r--r--ctdb/common/ctdb_message.c2
-rw-r--r--ctdb/common/ctdb_recover.c42
-rw-r--r--ctdb/common/ctdb_recoverd.c2
-rw-r--r--ctdb/common/ctdb_traverse.c12
-rw-r--r--ctdb/common/ctdb_util.c11
-rw-r--r--ctdb/common/util.c14
-rw-r--r--ctdb/direct/ctdbd.c7
-rw-r--r--ctdb/ib/ibw_ctdb_init.c7
-rw-r--r--ctdb/include/ctdb.h11
-rw-r--r--ctdb/include/ctdb_private.h3
-rw-r--r--ctdb/tcp/tcp_init.c8
16 files changed, 27 insertions, 138 deletions
diff --git a/ctdb/common/ctdb.c b/ctdb/common/ctdb.c
index 354b0f64cee..01654fe5182 100644
--- a/ctdb/common/ctdb.c
+++ b/ctdb/common/ctdb.c
@@ -79,14 +79,6 @@ void ctdb_set_flags(struct ctdb_context *ctdb, unsigned flags)
}
/*
- clear some ctdb flags
-*/
-void ctdb_clear_flags(struct ctdb_context *ctdb, unsigned flags)
-{
- ctdb->flags &= ~flags;
-}
-
-/*
set the directory for the local databases
*/
int ctdb_set_tdb_dir(struct ctdb_context *ctdb, const char *dir)
@@ -489,7 +481,7 @@ void ctdb_queue_packet(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
node = ctdb->nodes[hdr->destnode];
- if (hdr->destnode == ctdb->vnn && !(ctdb->flags & CTDB_FLAG_SELF_CONNECT)) {
+ if (hdr->destnode == ctdb->vnn) {
ctdb_defer_packet(ctdb, hdr);
} else {
node->tx_cnt++;
diff --git a/ctdb/common/ctdb_call.c b/ctdb/common/ctdb_call.c
index 1604b0a91c7..0801e60dd76 100644
--- a/ctdb/common/ctdb_call.c
+++ b/ctdb/common/ctdb_call.c
@@ -47,7 +47,7 @@
/*
a varient of input packet that can be used in lock requeue
*/
-void ctdb_call_input_pkt(void *p, struct ctdb_req_header *hdr)
+static void ctdb_call_input_pkt(void *p, struct ctdb_req_header *hdr)
{
struct ctdb_context *ctdb = talloc_get_type(p, struct ctdb_context);
ctdb_input_pkt(ctdb, hdr);
diff --git a/ctdb/common/ctdb_client.c b/ctdb/common/ctdb_client.c
index 5662c61720e..eb3b67560f8 100644
--- a/ctdb/common/ctdb_client.c
+++ b/ctdb/common/ctdb_client.c
@@ -287,8 +287,7 @@ struct ctdb_client_call_state *ctdb_call_send(struct ctdb_db_context *ctdb_db,
ret = ctdb_ltdb_fetch(ctdb_db, call->key, &header, ctdb_db, &data);
- if (ret == 0 &&
- header.dmaster == ctdb->vnn && !(ctdb->flags & CTDB_FLAG_SELF_CONNECT)) {
+ if (ret == 0 && header.dmaster == ctdb->vnn) {
state = ctdb_client_call_local_send(ctdb_db, call, &header, &data);
talloc_free(data.dptr);
ctdb_ltdb_unlock(ctdb_db, call->key);
@@ -1110,31 +1109,6 @@ int ctdb_ctrl_setdmaster(struct ctdb_context *ctdb, struct timeval timeout, uint
}
/*
- delete all records from a tdb
- */
-int ctdb_ctrl_cleardb(struct ctdb_context *ctdb, uint32_t destnode, TALLOC_CTX *mem_ctx, uint32_t dbid)
-{
- int ret;
- TDB_DATA indata;
- int32_t res;
-
- indata.dsize = sizeof(uint32_t);
- indata.dptr = (unsigned char *)talloc_array(mem_ctx, uint32_t, 1);
-
- ((uint32_t *)(&indata.dptr[0]))[0] = dbid;
-
- ret = ctdb_control(ctdb, destnode, 0,
- CTDB_CONTROL_CLEAR_DB, 0, indata,
- NULL, NULL, &res, NULL, NULL);
- if (ret != 0 || res != 0) {
- DEBUG(0,(__location__ " ctdb_control for cleardb failed\n"));
- return -1;
- }
-
- return 0;
-}
-
-/*
ping a node, return number of clients connected
*/
int ctdb_ctrl_ping(struct ctdb_context *ctdb, uint32_t destnode)
diff --git a/ctdb/common/ctdb_control.c b/ctdb/common/ctdb_control.c
index 14ea6732fef..ac2522131f6 100644
--- a/ctdb/common/ctdb_control.c
+++ b/ctdb/common/ctdb_control.c
@@ -112,10 +112,6 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
CHECK_CONTROL_DATA_SIZE(sizeof(struct ctdb_control_set_dmaster));
return ctdb_control_set_dmaster(ctdb, indata);
- case CTDB_CONTROL_CLEAR_DB:
- CHECK_CONTROL_DATA_SIZE(sizeof(uint32_t));
- return ctdb_control_clear_db(ctdb, indata);
-
case CTDB_CONTROL_PUSH_DB:
return ctdb_control_push_db(ctdb, indata);
diff --git a/ctdb/common/ctdb_daemon.c b/ctdb/common/ctdb_daemon.c
index e9b680bd725..36eebbb9ee3 100644
--- a/ctdb/common/ctdb_daemon.c
+++ b/ctdb/common/ctdb_daemon.c
@@ -359,7 +359,7 @@ static void daemon_request_call_from_client(struct ctdb_client *client,
call->call_data.dsize = c->calldatalen;
call->flags = c->flags;
- if (header.dmaster == ctdb->vnn && !(ctdb->flags & CTDB_FLAG_SELF_CONNECT)) {
+ if (header.dmaster == ctdb->vnn) {
state = ctdb_call_local_send(ctdb_db, call, &header, &data);
} else {
state = ctdb_daemon_call_send_remote(ctdb_db, call, &header);
diff --git a/ctdb/common/ctdb_message.c b/ctdb/common/ctdb_message.c
index 862bf985bb0..5b03164d3e4 100644
--- a/ctdb/common/ctdb_message.c
+++ b/ctdb/common/ctdb_message.c
@@ -115,7 +115,7 @@ int ctdb_daemon_send_message(struct ctdb_context *ctdb, uint32_t vnn,
int len;
/* see if this is a message to ourselves */
- if (vnn == ctdb->vnn && !(ctdb->flags & CTDB_FLAG_SELF_CONNECT)) {
+ if (vnn == ctdb->vnn) {
return ctdb_local_message(ctdb, srvid, data);
}
diff --git a/ctdb/common/ctdb_recover.c b/ctdb/common/ctdb_recover.c
index e1e48bfb31e..a27c51263f7 100644
--- a/ctdb/common/ctdb_recover.c
+++ b/ctdb/common/ctdb_recover.c
@@ -392,48 +392,6 @@ int32_t ctdb_control_set_dmaster(struct ctdb_context *ctdb, TDB_DATA indata)
return 0;
}
-
-static int traverse_cleardb(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void *p)
-{
- int ret;
-
- ret = tdb_delete(tdb, key);
- if (ret) {
- DEBUG(0,(__location__ " failed to delete tdb record\n"));
- return ret;
- }
- return 0;
-}
-
-
-int32_t ctdb_control_clear_db(struct ctdb_context *ctdb, TDB_DATA indata)
-{
- uint32_t dbid = *(uint32_t *)indata.dptr;
- struct ctdb_db_context *ctdb_db;
-
- if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
- DEBUG(0,("rejecting ctdb_control_clear_db when not frozen\n"));
- return -1;
- }
-
- ctdb_db = find_ctdb_db(ctdb, dbid);
- if (!ctdb_db) {
- DEBUG(0,(__location__ " Unknown db 0x%08x\n",dbid));
- return -1;
- }
-
- if (ctdb_lock_all_databases_mark(ctdb) != 0) {
- DEBUG(0,(__location__ " Failed to get lock on entired db - failing\n"));
- return -1;
- }
-
- tdb_traverse(ctdb_db->ltdb->tdb, traverse_cleardb, NULL);
-
- ctdb_lock_all_databases_unmark(ctdb);
-
- return 0;
-}
-
struct ctdb_set_recmode_state {
struct ctdb_req_control *c;
uint32_t recmode;
diff --git a/ctdb/common/ctdb_recoverd.c b/ctdb/common/ctdb_recoverd.c
index 36ecb9f2390..600beb22053 100644
--- a/ctdb/common/ctdb_recoverd.c
+++ b/ctdb/common/ctdb_recoverd.c
@@ -662,7 +662,7 @@ static void force_election(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, uint3
/*
the main monitoring loop
*/
-void monitor_cluster(struct ctdb_context *ctdb)
+static void monitor_cluster(struct ctdb_context *ctdb)
{
uint32_t vnn, num_active, recmode, recmaster;
TALLOC_CTX *mem_ctx=NULL;
diff --git a/ctdb/common/ctdb_traverse.c b/ctdb/common/ctdb_traverse.c
index 721448631ef..caff809a677 100644
--- a/ctdb/common/ctdb_traverse.c
+++ b/ctdb/common/ctdb_traverse.c
@@ -116,9 +116,9 @@ static int ctdb_traverse_local_fn(struct tdb_context *tdb, TDB_DATA key, TDB_DAT
The traverse is finished when the callback is called with tdb_null for key and data
*/
-struct ctdb_traverse_local_handle *ctdb_traverse_local(struct ctdb_db_context *ctdb_db,
- ctdb_traverse_fn_t callback,
- void *private_data)
+static struct ctdb_traverse_local_handle *ctdb_traverse_local(struct ctdb_db_context *ctdb_db,
+ ctdb_traverse_fn_t callback,
+ void *private_data)
{
struct ctdb_traverse_local_handle *h;
int ret;
@@ -217,9 +217,9 @@ static void ctdb_traverse_all_timeout(struct event_context *ev, struct timed_eve
The traverse is finished when the callback is called with tdb_null
for key and data
*/
-struct ctdb_traverse_all_handle *ctdb_daemon_traverse_all(struct ctdb_db_context *ctdb_db,
- ctdb_traverse_fn_t callback,
- void *private_data)
+static struct ctdb_traverse_all_handle *ctdb_daemon_traverse_all(struct ctdb_db_context *ctdb_db,
+ ctdb_traverse_fn_t callback,
+ void *private_data)
{
struct ctdb_traverse_all_handle *state;
struct ctdb_context *ctdb = ctdb_db->ctdb;
diff --git a/ctdb/common/ctdb_util.c b/ctdb/common/ctdb_util.c
index 3fbf9882e1c..821ae79b3b7 100644
--- a/ctdb/common/ctdb_util.c
+++ b/ctdb/common/ctdb_util.c
@@ -106,17 +106,6 @@ uint32_t ctdb_hash(const TDB_DATA *key)
}
/*
- hash function for a string
-*/
-uint32_t ctdb_hash_string(const char *str)
-{
- TDB_DATA data;
- data.dptr = (uint8_t *)discard_const(str);
- data.dsize = strlen(str)+1;
- return ctdb_hash(&data);
-}
-
-/*
a type checking varient of idr_find
*/
static void *_idr_find_type(struct idr_context *idp, int id, const char *type, const char *location)
diff --git a/ctdb/common/util.c b/ctdb/common/util.c
index 6ccecc80c4e..40bc75c3fa6 100644
--- a/ctdb/common/util.c
+++ b/ctdb/common/util.c
@@ -47,7 +47,7 @@ double timeval_elapsed(struct timeval *tv)
/**
return a timeval struct with the given elements
*/
-struct timeval timeval_set(uint32_t secs, uint32_t usecs)
+_PUBLIC_ struct timeval timeval_set(uint32_t secs, uint32_t usecs)
{
struct timeval tv;
tv.tv_sec = secs;
@@ -55,7 +55,7 @@ struct timeval timeval_set(uint32_t secs, uint32_t usecs)
return tv;
}
-int timeval_compare(const struct timeval *tv1, const struct timeval *tv2)
+_PUBLIC_ int timeval_compare(const struct timeval *tv1, const struct timeval *tv2)
{
if (tv1->tv_sec > tv2->tv_sec) return 1;
if (tv1->tv_sec < tv2->tv_sec) return -1;
@@ -64,8 +64,8 @@ int timeval_compare(const struct timeval *tv1, const struct timeval *tv2)
return 0;
}
-struct timeval timeval_until(const struct timeval *tv1,
- const struct timeval *tv2)
+_PUBLIC_ struct timeval timeval_until(const struct timeval *tv1,
+ const struct timeval *tv2)
{
struct timeval t;
if (timeval_compare(tv1, tv2) >= 0) {
@@ -81,7 +81,7 @@ struct timeval timeval_until(const struct timeval *tv1,
return t;
}
-_PUBLIC_ struct timeval timeval_add(const struct timeval *tv,
+static struct timeval timeval_add(const struct timeval *tv,
uint32_t secs, uint32_t usecs)
{
struct timeval tv2 = *tv;
@@ -100,7 +100,7 @@ _PUBLIC_ struct timeval timeval_current_ofs(uint32_t secs, uint32_t usecs)
return timeval_add(&tv, secs, usecs);
}
-_PUBLIC_ char *fd_load(int fd, size_t *size, TALLOC_CTX *mem_ctx)
+static char *fd_load(int fd, size_t *size, TALLOC_CTX *mem_ctx)
{
struct stat sbuf;
char *p;
@@ -122,7 +122,7 @@ _PUBLIC_ char *fd_load(int fd, size_t *size, TALLOC_CTX *mem_ctx)
}
-_PUBLIC_ char *file_load(const char *fname, size_t *size, TALLOC_CTX *mem_ctx)
+static char *file_load(const char *fname, size_t *size, TALLOC_CTX *mem_ctx)
{
int fd;
char *p;
diff --git a/ctdb/direct/ctdbd.c b/ctdb/direct/ctdbd.c
index 8376d8b8473..a2092a697b2 100644
--- a/ctdb/direct/ctdbd.c
+++ b/ctdb/direct/ctdbd.c
@@ -48,14 +48,12 @@ static struct {
const char *logfile;
const char *recovery_lock_file;
const char *db_dir;
- int self_connect;
} options = {
.nlist = ETCDIR "/ctdb/nodes",
.transport = "tcp",
.event_script = ETCDIR "/ctdb/events",
.logfile = VARDIR "/log/log.ctdb",
.db_dir = VARDIR "/ctdb",
- .self_connect = 0,
};
@@ -79,7 +77,6 @@ int main(int argc, const char *argv[])
{ "nlist", 0, POPT_ARG_STRING, &options.nlist, 0, "node list file", "filename" },
{ "listen", 0, POPT_ARG_STRING, &options.myaddress, 0, "address to listen on", "address" },
{ "transport", 0, POPT_ARG_STRING, &options.transport, 0, "protocol transport", NULL },
- { "self-connect", 0, POPT_ARG_NONE, &options.self_connect, 0, "enable self connect", "boolean" },
{ "dbdir", 0, POPT_ARG_STRING, &options.db_dir, 0, "directory for the tdb files", NULL },
{ "reclock", 0, POPT_ARG_STRING, &options.recovery_lock_file, 0, "location of recovery lock file", "filename" },
POPT_TABLEEND
@@ -125,10 +122,6 @@ int main(int argc, const char *argv[])
exit(1);
}
- if (options.self_connect) {
- ctdb_set_flags(ctdb, CTDB_FLAG_SELF_CONNECT);
- }
-
ret = ctdb_set_transport(ctdb, options.transport);
if (ret == -1) {
printf("ctdb_set_transport failed - %s\n", ctdb_errstr(ctdb));
diff --git a/ctdb/ib/ibw_ctdb_init.c b/ctdb/ib/ibw_ctdb_init.c
index b5e6c5cffb3..33d6ecaf7f9 100644
--- a/ctdb/ib/ibw_ctdb_init.c
+++ b/ctdb/ib/ibw_ctdb_init.c
@@ -106,10 +106,9 @@ static int ctdb_ibw_start(struct ctdb_context *ctdb)
/* everything async here */
for (i=0;i<ctdb->num_nodes;i++) {
struct ctdb_node *node = ctdb->nodes[i];
- if (!(ctdb->flags & CTDB_FLAG_SELF_CONNECT) &&
- ctdb_same_address(&ctdb->address, &node->address))
- continue;
- ctdb_ibw_node_connect(node);
+ if (!ctdb_same_address(&ctdb->address, &node->address)) {
+ ctdb_ibw_node_connect(node);
+ }
}
return 0;
diff --git a/ctdb/include/ctdb.h b/ctdb/include/ctdb.h
index 74039420fa6..be283a01bf3 100644
--- a/ctdb/include/ctdb.h
+++ b/ctdb/include/ctdb.h
@@ -49,7 +49,6 @@ struct ctdb_call_info {
/*
ctdb flags
*/
-#define CTDB_FLAG_SELF_CONNECT (1<<0)
#define CTDB_FLAG_TORTURE (1<<1)
/*
@@ -103,11 +102,6 @@ int ctdb_set_tdb_dir(struct ctdb_context *ctdb, const char *dir);
void ctdb_set_flags(struct ctdb_context *ctdb, unsigned flags);
/*
- clear some flags
-*/
-void ctdb_clear_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);
@@ -278,11 +272,6 @@ int ctdb_ctrl_setdmaster(struct ctdb_context *ctdb,
TALLOC_CTX *mem_ctx, uint32_t dbid, uint32_t dmaster);
/*
- delete all records from a tdb
- */
-int ctdb_ctrl_cleardb(struct ctdb_context *ctdb, uint32_t destnode, TALLOC_CTX *mem_ctx, uint32_t dbid);
-
-/*
write a record on a specific db (this implicitely updates dmaster of the record to locally be the vnn of the node where the control is executed on)
*/
int ctdb_ctrl_write_record(struct ctdb_context *ctdb, uint32_t destnode, TALLOC_CTX *mem_ctx, uint32_t dbid, TDB_DATA key, TDB_DATA data);
diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h
index 25fb1c685e9..7f7c6412cfd 100644
--- a/ctdb/include/ctdb_private.h
+++ b/ctdb/include/ctdb_private.h
@@ -369,7 +369,7 @@ enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS = 0,
CTDB_CONTROL_GET_DBMAP = 9,
CTDB_CONTROL_GET_NODEMAP = 10,
CTDB_CONTROL_SET_DMASTER = 11,
- CTDB_CONTROL_CLEAR_DB = 12,
+ /* #12 removed */
CTDB_CONTROL_PULL_DB = 13,
CTDB_CONTROL_PUSH_DB = 14,
CTDB_CONTROL_GET_RECMODE = 15,
@@ -893,7 +893,6 @@ struct ctdb_rec_data *ctdb_marshall_record(TALLOC_CTX *mem_ctx, uint32_t reqid,
int32_t ctdb_control_pull_db(struct ctdb_context *ctdb, TDB_DATA indata, TDB_DATA *outdata);
int32_t ctdb_control_push_db(struct ctdb_context *ctdb, TDB_DATA indata);
int32_t ctdb_control_set_dmaster(struct ctdb_context *ctdb, TDB_DATA indata);
-int32_t ctdb_control_clear_db(struct ctdb_context *ctdb, TDB_DATA indata);
int32_t ctdb_control_set_recmode(struct ctdb_context *ctdb,
struct ctdb_req_control *c,
diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c
index 7e751953028..ab1de71ca4a 100644
--- a/ctdb/tcp/tcp_init.c
+++ b/ctdb/tcp/tcp_init.c
@@ -80,10 +80,10 @@ static int ctdb_tcp_start(struct ctdb_context *ctdb)
struct ctdb_node *node = *(ctdb->nodes + i);
struct ctdb_tcp_node *tnode = talloc_get_type(
node->private_data, struct ctdb_tcp_node);
- if (!(ctdb->flags & CTDB_FLAG_SELF_CONNECT) &&
- ctdb_same_address(&ctdb->address, &node->address)) continue;
- event_add_timed(ctdb->ev, tnode, timeval_zero(),
- ctdb_tcp_node_connect, node);
+ if (!ctdb_same_address(&ctdb->address, &node->address)) {
+ event_add_timed(ctdb->ev, tnode, timeval_zero(),
+ ctdb_tcp_node_connect, node);
+ }
}
return 0;