[SCM] CTDB repository - branch master updated -
ccf9334bd20b1398623dd649987aa15119dac14e
Ronnie Sahlberg
sahlberg at samba.org
Thu Jul 17 04:01:53 GMT 2008
The branch, master has been updated
via ccf9334bd20b1398623dd649987aa15119dac14e (commit)
via 1ffccb3e0b3b5bd376c5302304029af393709518 (commit)
from 8140825e1d06053a900fd0adf0a150622c0fc146 (commit)
http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit ccf9334bd20b1398623dd649987aa15119dac14e
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Thu Jul 17 13:56:17 2008 +1000
new version 1.0.48
commit 1ffccb3e0b3b5bd376c5302304029af393709518
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Thu Jul 17 13:50:55 2008 +1000
Add two new controls to start and cancel a persistent update.
This allows ctdb to automatically start a new full blown recovery
if a client has started updating the local tdb for a persistent database
but is kill -9ed before it has ensured the update is distributed clusterwide.
-----------------------------------------------------------------------
Summary of changes:
include/ctdb_private.h | 9 ++++++++
packaging/RPM/ctdb.spec | 13 ++++++++++-
server/ctdb_control.c | 6 +++++
server/ctdb_daemon.c | 6 +++++
server/ctdb_persistent.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 80 insertions(+), 2 deletions(-)
Changeset truncated at 500 lines:
diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index 4124f64..66e7709 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -161,6 +161,7 @@ struct ctdb_client {
uint32_t client_id;
pid_t pid;
struct ctdb_tcp_list *tcp_list;
+ uint32_t num_persistent_updates;
};
@@ -544,6 +545,8 @@ enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS = 0,
CTDB_CONTROL_DEL_PUBLIC_IP = 78,
CTDB_CONTROL_RUN_EVENTSCRIPTS = 79,
CTDB_CONTROL_GET_CAPABILITIES = 80,
+ CTDB_CONTROL_START_PERSISTENT_UPDATE = 81,
+ CTDB_CONTROL_CANCEL_PERSISTENT_UPDATE= 82,
};
/*
@@ -812,6 +815,12 @@ int ctdb_ltdb_store(struct ctdb_db_context *ctdb_db, TDB_DATA key,
struct ctdb_ltdb_header *header, TDB_DATA data);
int ctdb_ltdb_persistent_store(struct ctdb_db_context *ctdb_db, TDB_DATA key,
struct ctdb_ltdb_header *header, TDB_DATA data);
+int32_t ctdb_control_start_persistent_update(struct ctdb_context *ctdb,
+ struct ctdb_req_control *c,
+ TDB_DATA recdata);
+int32_t ctdb_control_cancel_persistent_update(struct ctdb_context *ctdb,
+ struct ctdb_req_control *c,
+ TDB_DATA recdata);
void ctdb_queue_packet(struct ctdb_context *ctdb, struct ctdb_req_header *hdr);
void ctdb_queue_packet_opcode(struct ctdb_context *ctdb, struct ctdb_req_header *hdr, unsigned opcode);
int ctdb_ltdb_lock_requeue(struct ctdb_db_context *ctdb_db,
diff --git a/packaging/RPM/ctdb.spec b/packaging/RPM/ctdb.spec
index 07ae721..84f9cf6 100644
--- a/packaging/RPM/ctdb.spec
+++ b/packaging/RPM/ctdb.spec
@@ -5,7 +5,7 @@ Vendor: Samba Team
Packager: Samba Team <samba at samba.org>
Name: ctdb
Version: 1.0
-Release: 47
+Release: 48
Epoch: 0
License: GNU GPL version 3
Group: System Environment/Daemons
@@ -118,7 +118,16 @@ fi
%{_includedir}/ctdb_private.h
%changelog
-* Fri Jul 11 2008 : Version 1.0.48-pre
+* Thu Jul 17 2008 : Version 1.0.48
+ - Update the spec file.
+ - Do not start new user-triggered eventscripts if we are already
+ inside recovery mode.
+ - Add two new controls to start/cancel a persistent update.
+ A client such as samba can use these to tell ctdbd that it will soon
+ be writing directly to the persistent database tdb file. So if
+ samba is -9ed before it has eitehr done the persistent_store or
+ canceled the operation, ctdb knows that the persistent databases
+ 'may' be out of sync and therefore a full blown recovery is called for.
- Add two new options :
CTDB_SAMBA_SKIP_CONF_CHECK and CTDB_SAMBA_CHECK_PORTS that can be used
to override what checks to do when monitoring samba health.
diff --git a/server/ctdb_control.c b/server/ctdb_control.c
index aaadbae..1ae8e85 100644
--- a/server/ctdb_control.c
+++ b/server/ctdb_control.c
@@ -394,6 +394,12 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
case CTDB_CONTROL_GET_CAPABILITIES:
return ctdb_control_get_capabilities(ctdb, outdata);
+ case CTDB_CONTROL_START_PERSISTENT_UPDATE:
+ return ctdb_control_start_persistent_update(ctdb, c, indata);
+
+ case CTDB_CONTROL_CANCEL_PERSISTENT_UPDATE:
+ return ctdb_control_cancel_persistent_update(ctdb, c, indata);
+
default:
DEBUG(DEBUG_CRIT,(__location__ " Unknown CTDB control opcode %u\n", opcode));
return -1;
diff --git a/server/ctdb_daemon.c b/server/ctdb_daemon.c
index c153a97..aeb0cbd 100644
--- a/server/ctdb_daemon.c
+++ b/server/ctdb_daemon.c
@@ -210,6 +210,12 @@ static int ctdb_client_destructor(struct ctdb_client *client)
ctdb_takeover_client_destructor_hook(client);
ctdb_reqid_remove(client->ctdb, client->client_id);
client->ctdb->statistics.num_clients--;
+
+ if (client->num_persistent_updates != 0) {
+ DEBUG(DEBUG_ERR,(__location__ " Client disconnecting with %u persistent updates in flight. Starting recovery\n", client->num_persistent_updates));
+ client->ctdb->recovery_mode = CTDB_RECOVERY_ACTIVE;
+ }
+
return 0;
}
diff --git a/server/ctdb_persistent.c b/server/ctdb_persistent.c
index 713950a..66311a9 100644
--- a/server/ctdb_persistent.c
+++ b/server/ctdb_persistent.c
@@ -81,9 +81,16 @@ int32_t ctdb_control_persistent_store(struct ctdb_context *ctdb,
struct ctdb_req_control *c,
TDB_DATA recdata, bool *async_reply)
{
+ struct ctdb_client *client = ctdb_reqid_find(ctdb, c->client_id, struct ctdb_client);
struct ctdb_persistent_state *state;
int i;
+ if (client == NULL) {
+ DEBUG(DEBUG_ERR,(__location__ " can not match persistent_store to a client. Returning error\n"));
+ return -1;
+ }
+ client->num_persistent_updates--;
+
state = talloc_zero(ctdb, struct ctdb_persistent_state);
CTDB_NO_MEMORY(ctdb, state);
@@ -410,3 +417,44 @@ int32_t ctdb_control_update_record(struct ctdb_context *ctdb,
return 0;
}
+
+
+
+/*
+ start a persistent store operation. passing both the key, header and
+ data to the daemon. If the client disconnects before it has issued
+ a persistent_update call to the daemon we trigger a full recovery
+ to ensure the databases are brought back in sync.
+ for now we ignore the recdata that the client has passed to us.
+ */
+int32_t ctdb_control_start_persistent_update(struct ctdb_context *ctdb,
+ struct ctdb_req_control *c,
+ TDB_DATA recdata)
+{
+ struct ctdb_client *client = ctdb_reqid_find(ctdb, c->client_id, struct ctdb_client);
+
+ if (client == NULL) {
+ DEBUG(DEBUG_ERR,(__location__ " can not match start_persistent_update to a client. Returning error\n"));
+ return -1;
+ }
+
+ client->num_persistent_updates++;
+
+ return 0;
+}
+
+int32_t ctdb_control_cancel_persistent_update(struct ctdb_context *ctdb,
+ struct ctdb_req_control *c,
+ TDB_DATA recdata)
+{
+ struct ctdb_client *client = ctdb_reqid_find(ctdb, c->client_id, struct ctdb_client);
+
+ if (client == NULL) {
+ DEBUG(DEBUG_ERR,(__location__ " can not match cancel_persistent_update to a client. Returning error\n"));
+ return -1;
+ }
+
+ client->num_persistent_updates--;
+
+ return 0;
+}
--
CTDB repository
More information about the samba-cvs
mailing list