[SCM] CTDB repository - branch 1.2 updated - ctdb-1.9.1-273-gc7798ef
Ronnie Sahlberg
sahlberg at samba.org
Sun Dec 12 20:33:28 MST 2010
The branch, 1.2 has been updated
via c7798ef2fe8fe0036a43f7102a5016c171e6fc68 (commit)
via b1617c50fe89b5801c3eae665faeb4172e72fab9 (commit)
via 716e321c74d8a23d794880ef1e1ef9dc459ea88a (commit)
via 5082dfacb7489de524dfb86b9af2745450a7ee80 (commit)
via 18cfc1b7e0e031f1726928bb5c8e77b9e6f04feb (commit)
via 8a5e2f062ed18b07c368864527667a85f9a95755 (commit)
from ae1aeacc05a39177d274ed8fb90e24163a59bae8 (commit)
http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=1.2
- Log -----------------------------------------------------------------
commit c7798ef2fe8fe0036a43f7102a5016c171e6fc68
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Mon Dec 13 14:20:37 2010 +1100
New version 1.2.15
* Mon Dec 13 2010 : Version 1.2.15
- Add two new debugging commands "ctdb readkey/writekey"
- idtree overflow bugfix
- only run "serverid wipe" when we are actually running samba
- libctdb, add roper input queueing so we can support calling
sync functions from an async callback
- lvs updates
- addip, always wait across at least one ip reallocation, making the
command slower, but making it easier to use in scripts
commit b1617c50fe89b5801c3eae665faeb4172e72fab9
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Mon Dec 13 12:39:01 2010 +1100
Revert "server: when we migrate off a record with data, set the MIGRATED_WITH_DATA flag"
This reverts commit c63dab9763d45fd4f9be77b9c9f463bd457de808.
commit 716e321c74d8a23d794880ef1e1ef9dc459ea88a
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Mon Dec 13 12:38:39 2010 +1100
Revert "Add a new header flag for "migrated with data" and set this to 1"
This reverts commit d22e7e47a7f3d450bbbc2267322dadbdbf192e84.
commit 5082dfacb7489de524dfb86b9af2745450a7ee80
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Mon Dec 13 12:06:01 2010 +1100
ctdb addip:
After finishing "ctdb addip" wait for an implicit "iptakeover" to complete
the assignment to a node.
This makes it more wasteful and timeconsuming when adding multiple ips
at once, or the same ip to multiple nodes,
but makes it easier to script the use of this command.
commit 18cfc1b7e0e031f1726928bb5c8e77b9e6f04feb
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Sun Dec 12 19:38:39 2010 +1100
LVS
update lvs configuration on ipreallocated events too
commit 8a5e2f062ed18b07c368864527667a85f9a95755
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Sun Dec 12 14:22:20 2010 +1100
When assigning the single-public-ip during startup,
flag the interface as initially being "link ok"
so that we can add it and startup.
The eventscript can later drop the flag if required
-----------------------------------------------------------------------
Summary of changes:
config/events.d/91.lvs | 2 +-
packaging/RPM/ctdb.spec.in | 11 ++-
server/ctdb_call.c | 28 +----
server/ctdb_takeover.c | 9 ++
tools/ctdb.c | 281 ++++++++++++++++++++++----------------------
5 files changed, 166 insertions(+), 165 deletions(-)
Changeset truncated at 500 lines:
diff --git a/config/events.d/91.lvs b/config/events.d/91.lvs
index 3fbc57d..ff95811 100755
--- a/config/events.d/91.lvs
+++ b/config/events.d/91.lvs
@@ -37,7 +37,7 @@ case "$1" in
echo 1 > /proc/sys/net/ipv4/route/flush
;;
- recovered|stopped)
+ recovered|stopped|ipreallocated)
# kill off any tcp connections
ipvsadm -D -t $CTDB_LVS_PUBLIC_IP:0
ipvsadm -D -u $CTDB_LVS_PUBLIC_IP:0
diff --git a/packaging/RPM/ctdb.spec.in b/packaging/RPM/ctdb.spec.in
index 6ccbf9d..5900b1d 100644
--- a/packaging/RPM/ctdb.spec.in
+++ b/packaging/RPM/ctdb.spec.in
@@ -3,7 +3,7 @@ Name: ctdb
Summary: Clustered TDB
Vendor: Samba Team
Packager: Samba Team <samba at samba.org>
-Version: 1.2.14
+Version: 1.2.15
Release: 1GITHASH
Epoch: 0
License: GNU GPL version 3
@@ -143,6 +143,15 @@ development libraries for ctdb
%{_libdir}/libctdb.a
%changelog
+* Mon Dec 13 2010 : Version 1.2.15
+ - Add two new debugging commands "ctdb readkey/writekey"
+ - idtree overflow bugfix
+ - only run "serverid wipe" when we are actually running samba
+ - libctdb, add roper input queueing so we can support calling
+ sync functions from an async callback
+ - lvs updates
+ - addip, always wait across at least one ip reallocation, making the
+ command slower, but making it easier to use in scripts
* Mon Dec 6 2010 : Version 1.2.14
- detect when ip allocation is inconsistent and some hosts show -1
as the node for the ip.
diff --git a/server/ctdb_call.c b/server/ctdb_call.c
index a675e7f..d6c0866 100644
--- a/server/ctdb_call.c
+++ b/server/ctdb_call.c
@@ -201,11 +201,6 @@ static void ctdb_call_send_dmaster(struct ctdb_db_context *ctdb_db,
return;
}
- if (data->dsize != 0) {
- header->flags |= CTDB_REC_FLAG_MIGRATED_WITH_DATA;
- }
-
-
if (lmaster == ctdb->pnn) {
ctdb_send_dmaster_reply(ctdb_db, header, *key, *data,
c->hdr.srcnode, c->hdr.reqid);
@@ -227,19 +222,10 @@ static void ctdb_call_send_dmaster(struct ctdb_db_context *ctdb_db,
memcpy(&r->data[key->dsize], data->dptr, data->dsize);
header->dmaster = c->hdr.srcnode;
-
- if (data->dsize == 0
- && lmaster != ctdb->pnn
- && (header->flags & CTDB_REC_FLAG_MIGRATED_WITH_DATA) == 0) {
- if (ctdb_ltdb_delete(ctdb_db, *key) != 0) {
- ctdb_fatal(ctdb, "Failed to delete empty record when migrating it off the node");
- }
- } else {
- if (ctdb_ltdb_store(ctdb_db, *key, header, *data) != 0) {
- ctdb_fatal(ctdb, "Failed to store record in ctdb_call_send_dmaster");
- }
+ if (ctdb_ltdb_store(ctdb_db, *key, header, *data) != 0) {
+ ctdb_fatal(ctdb, "Failed to store record in ctdb_call_send_dmaster");
}
-
+
ctdb_queue_packet(ctdb, &r->hdr);
talloc_free(r);
@@ -267,10 +253,6 @@ static void ctdb_become_dmaster(struct ctdb_db_context *ctdb_db,
header.rsn = rsn + 1;
header.dmaster = ctdb->pnn;
- if (data.dsize != 0) {
- header.flags |= CTDB_REC_FLAG_MIGRATED_WITH_DATA;
- }
-
if (ctdb_ltdb_store(ctdb_db, key, &header, data) != 0) {
ctdb_fatal(ctdb, "ctdb_reply_dmaster store failed\n");
@@ -369,10 +351,6 @@ void ctdb_request_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr
return;
}
- if (data.dsize != 0) {
- header.flags |= CTDB_REC_FLAG_MIGRATED_WITH_DATA;
- }
-
if (ctdb_lmaster(ctdb, &key) != ctdb->pnn) {
DEBUG(DEBUG_ALERT,("pnn %u dmaster request to non-lmaster lmaster=%u gen=%u curgen=%u\n",
ctdb->pnn, ctdb_lmaster(ctdb, &key),
diff --git a/server/ctdb_takeover.c b/server/ctdb_takeover.c
index 682d17b..e3e6787 100644
--- a/server/ctdb_takeover.c
+++ b/server/ctdb_takeover.c
@@ -1000,6 +1000,7 @@ int ctdb_set_single_public_ip(struct ctdb_context *ctdb,
const char *ip)
{
struct ctdb_vnn *svnn;
+ struct ctdb_iface *cur = NULL;
bool ok;
int ret;
@@ -1028,6 +1029,14 @@ int ctdb_set_single_public_ip(struct ctdb_context *ctdb,
return -1;
}
+ /* assume the single public ip interface is initially "good" */
+ cur = ctdb_find_iface(ctdb, iface);
+ if (cur == NULL) {
+ DEBUG(DEBUG_CRIT,("Can not find public interface %s used by --single-public-ip", iface));
+ return -1;
+ }
+ cur->link_up = true;
+
ret = ctdb_vnn_assign_iface(ctdb, svnn);
if (ret != 0) {
talloc_free(svnn);
diff --git a/tools/ctdb.c b/tools/ctdb.c
index d54ff10..5e4b9ed 100644
--- a/tools/ctdb.c
+++ b/tools/ctdb.c
@@ -1473,6 +1473,143 @@ find_other_host_for_public_ip(struct ctdb_context *ctdb, ctdb_sock_addr *addr)
return -1;
}
+static uint32_t ipreallocate_finished;
+
+/*
+ handler for receiving the response to ipreallocate
+*/
+static void ip_reallocate_handler(struct ctdb_context *ctdb, uint64_t srvid,
+ TDB_DATA data, void *private_data)
+{
+ ipreallocate_finished = 1;
+}
+
+static void ctdb_every_second(struct event_context *ev, struct timed_event *te, struct timeval t, void *p)
+{
+ struct ctdb_context *ctdb = talloc_get_type(p, struct ctdb_context);
+
+ event_add_timed(ctdb->ev, ctdb,
+ timeval_current_ofs(1, 0),
+ ctdb_every_second, ctdb);
+}
+
+/*
+ ask the recovery daemon on the recovery master to perform a ip reallocation
+ */
+static int control_ipreallocate(struct ctdb_context *ctdb, int argc, const char **argv)
+{
+ int i, ret;
+ TDB_DATA data;
+ struct takeover_run_reply rd;
+ uint32_t recmaster;
+ struct ctdb_node_map *nodemap=NULL;
+ int retries=0;
+ struct timeval tv = timeval_current();
+
+ /* we need some events to trigger so we can timeout and restart
+ the loop
+ */
+ event_add_timed(ctdb->ev, ctdb,
+ timeval_current_ofs(1, 0),
+ ctdb_every_second, ctdb);
+
+ rd.pnn = ctdb_ctrl_getpnn(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE);
+ if (rd.pnn == -1) {
+ DEBUG(DEBUG_ERR, ("Failed to get pnn of local node\n"));
+ return -1;
+ }
+ rd.srvid = getpid();
+
+ /* register a message port for receiveing the reply so that we
+ can receive the reply
+ */
+ ctdb_client_set_message_handler(ctdb, rd.srvid, ip_reallocate_handler, NULL);
+
+ data.dptr = (uint8_t *)&rd;
+ data.dsize = sizeof(rd);
+
+again:
+ /* check that there are valid nodes available */
+ if (ctdb_ctrl_getnodemap(ctdb, TIMELIMIT(), options.pnn, ctdb, &nodemap) != 0) {
+ DEBUG(DEBUG_ERR, ("Unable to get nodemap from local node\n"));
+ return -1;
+ }
+ for (i=0; i<nodemap->num;i++) {
+ if ((nodemap->nodes[i].flags & (NODE_FLAGS_DELETED|NODE_FLAGS_BANNED|NODE_FLAGS_STOPPED)) == 0) {
+ break;
+ }
+ }
+ if (i==nodemap->num) {
+ DEBUG(DEBUG_ERR,("No recmaster available, no need to wait for cluster convergence\n"));
+ return 0;
+ }
+
+
+ ret = ctdb_ctrl_getrecmaster(ctdb, ctdb, TIMELIMIT(), options.pnn, &recmaster);
+ if (ret != 0) {
+ DEBUG(DEBUG_ERR, ("Unable to get recmaster from node %u\n", options.pnn));
+ return ret;
+ }
+
+ /* verify the node exists */
+ if (ctdb_ctrl_getnodemap(ctdb, TIMELIMIT(), recmaster, ctdb, &nodemap) != 0) {
+ DEBUG(DEBUG_ERR, ("Unable to get nodemap from local node\n"));
+ return -1;
+ }
+
+
+ /* check tha there are nodes available that can act as a recmaster */
+ for (i=0; i<nodemap->num; i++) {
+ if (nodemap->nodes[i].flags & (NODE_FLAGS_DELETED|NODE_FLAGS_BANNED|NODE_FLAGS_STOPPED)) {
+ continue;
+ }
+ break;
+ }
+ if (i == nodemap->num) {
+ DEBUG(DEBUG_ERR,("No possible nodes to host addresses.\n"));
+ return 0;
+ }
+
+ /* verify the recovery master is not STOPPED, nor BANNED */
+ if (nodemap->nodes[recmaster].flags & (NODE_FLAGS_DELETED|NODE_FLAGS_BANNED|NODE_FLAGS_STOPPED)) {
+ DEBUG(DEBUG_ERR,("No suitable recmaster found. Try again\n"));
+ retries++;
+ sleep(1);
+ goto again;
+ }
+
+ /* verify the recovery master is not STOPPED, nor BANNED */
+ if (nodemap->nodes[recmaster].flags & (NODE_FLAGS_DELETED|NODE_FLAGS_BANNED|NODE_FLAGS_STOPPED)) {
+ DEBUG(DEBUG_ERR,("No suitable recmaster found. Try again\n"));
+ retries++;
+ sleep(1);
+ goto again;
+ }
+
+ ipreallocate_finished = 0;
+ ret = ctdb_client_send_message(ctdb, recmaster, CTDB_SRVID_TAKEOVER_RUN, data);
+ if (ret != 0) {
+ DEBUG(DEBUG_ERR,("Failed to send ip takeover run request message to %u\n", options.pnn));
+ return -1;
+ }
+
+ tv = timeval_current();
+ /* this loop will terminate when we have received the reply */
+ while (timeval_elapsed(&tv) < 5.0 && ipreallocate_finished == 0) {
+ event_loop_once(ctdb->ev);
+ }
+ if (ipreallocate_finished == 1) {
+ return 0;
+ }
+
+ retries++;
+ sleep(1);
+ goto again;
+
+ return 0;
+}
+
+
/*
add a public ip address to a node
*/
@@ -1544,6 +1681,12 @@ static int control_addip(struct ctdb_context *ctdb, int argc, const char **argv)
return -1;
}
+ ret = control_ipreallocate(ctdb, argc, argv);
+ if (ret != 0) {
+ DEBUG(DEBUG_ERR, ("IP Reallocate failed on node %u\n", options.pnn));
+ return ret;
+ }
+
talloc_free(tmp_ctx);
return 0;
}
@@ -2163,144 +2306,6 @@ static int control_getpid(struct ctdb_context *ctdb, int argc, const char **argv
return 0;
}
-static uint32_t ipreallocate_finished;
-
-/*
- handler for receiving the response to ipreallocate
-*/
-static void ip_reallocate_handler(struct ctdb_context *ctdb, uint64_t srvid,
- TDB_DATA data, void *private_data)
-{
- ipreallocate_finished = 1;
-}
-
-static void ctdb_every_second(struct event_context *ev, struct timed_event *te, struct timeval t, void *p)
-{
- struct ctdb_context *ctdb = talloc_get_type(p, struct ctdb_context);
-
- event_add_timed(ctdb->ev, ctdb,
- timeval_current_ofs(1, 0),
- ctdb_every_second, ctdb);
-}
-
-/*
- ask the recovery daemon on the recovery master to perform a ip reallocation
- */
-static int control_ipreallocate(struct ctdb_context *ctdb, int argc, const char **argv)
-{
- int i, ret;
- TDB_DATA data;
- struct takeover_run_reply rd;
- uint32_t recmaster;
- struct ctdb_node_map *nodemap=NULL;
- int retries=0;
- struct timeval tv = timeval_current();
-
- /* we need some events to trigger so we can timeout and restart
- the loop
- */
- event_add_timed(ctdb->ev, ctdb,
- timeval_current_ofs(1, 0),
- ctdb_every_second, ctdb);
-
- rd.pnn = ctdb_ctrl_getpnn(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE);
- if (rd.pnn == -1) {
- DEBUG(DEBUG_ERR, ("Failed to get pnn of local node\n"));
- return -1;
- }
- rd.srvid = getpid();
-
- /* register a message port for receiveing the reply so that we
- can receive the reply
- */
- ctdb_client_set_message_handler(ctdb, rd.srvid, ip_reallocate_handler, NULL);
-
- data.dptr = (uint8_t *)&rd;
- data.dsize = sizeof(rd);
-
-again:
- /* check that there are valid nodes available */
- if (ctdb_ctrl_getnodemap(ctdb, TIMELIMIT(), options.pnn, ctdb, &nodemap) != 0) {
- DEBUG(DEBUG_ERR, ("Unable to get nodemap from local node\n"));
- return -1;
- }
- for (i=0; i<nodemap->num;i++) {
- if ((nodemap->nodes[i].flags & (NODE_FLAGS_DELETED|NODE_FLAGS_BANNED|NODE_FLAGS_STOPPED)) == 0) {
- break;
- }
- }
- if (i==nodemap->num) {
- DEBUG(DEBUG_ERR,("No recmaster available, no need to wait for cluster convergence\n"));
- return 0;
- }
-
-
- ret = ctdb_ctrl_getrecmaster(ctdb, ctdb, TIMELIMIT(), options.pnn, &recmaster);
- if (ret != 0) {
- DEBUG(DEBUG_ERR, ("Unable to get recmaster from node %u\n", options.pnn));
- return ret;
- }
-
- /* verify the node exists */
- if (ctdb_ctrl_getnodemap(ctdb, TIMELIMIT(), recmaster, ctdb, &nodemap) != 0) {
- DEBUG(DEBUG_ERR, ("Unable to get nodemap from local node\n"));
- return -1;
- }
-
-
- /* check tha there are nodes available that can act as a recmaster */
- for (i=0; i<nodemap->num; i++) {
- if (nodemap->nodes[i].flags & (NODE_FLAGS_DELETED|NODE_FLAGS_BANNED|NODE_FLAGS_STOPPED)) {
- continue;
- }
- break;
- }
- if (i == nodemap->num) {
- DEBUG(DEBUG_ERR,("No possible nodes to host addresses.\n"));
- return 0;
- }
-
- /* verify the recovery master is not STOPPED, nor BANNED */
- if (nodemap->nodes[recmaster].flags & (NODE_FLAGS_DELETED|NODE_FLAGS_BANNED|NODE_FLAGS_STOPPED)) {
- DEBUG(DEBUG_ERR,("No suitable recmaster found. Try again\n"));
- retries++;
- sleep(1);
- goto again;
- }
-
-
- /* verify the recovery master is not STOPPED, nor BANNED */
- if (nodemap->nodes[recmaster].flags & (NODE_FLAGS_DELETED|NODE_FLAGS_BANNED|NODE_FLAGS_STOPPED)) {
- DEBUG(DEBUG_ERR,("No suitable recmaster found. Try again\n"));
- retries++;
- sleep(1);
- goto again;
- }
-
- ipreallocate_finished = 0;
- ret = ctdb_client_send_message(ctdb, recmaster, CTDB_SRVID_TAKEOVER_RUN, data);
- if (ret != 0) {
- DEBUG(DEBUG_ERR,("Failed to send ip takeover run request message to %u\n", options.pnn));
- return -1;
- }
-
- tv = timeval_current();
- /* this loop will terminate when we have received the reply */
- while (timeval_elapsed(&tv) < 3.0) {
- event_loop_once(ctdb->ev);
- }
- if (ipreallocate_finished == 1) {
- return 0;
- }
-
- retries++;
- sleep(1);
- goto again;
-
- return 0;
-}
-
-
/*
disable a remote node
*/
--
CTDB repository
More information about the samba-cvs
mailing list