The branch, master has been updated
via 0fd3bf919b1b8e5aaa98444c306c6770a6a3209f (commit)
via 11dee7f3f881494cf5089d6c69fd40e74f07e670 (commit)
via 303134cf10a08ce61954d5de9025d9bbcb5f75ef (commit)
from d3c54ae9cc83f74d15f40bbfff95404b270d2f80 (commit)
http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 0fd3bf919b1b8e5aaa98444c306c6770a6a3209f
Merge: d3c54ae9cc83f74d15f40bbfff95404b270d2f80
11dee7f3f881494cf5089d6c69fd40e74f07e670
Author: Ronnie Sahlberg <[email protected]>
Date: Mon Feb 20 21:30:13 2012 +1100
Merge branch 'master' of 10.1.1.27:/shared/ctdb/ctdb-master
commit 11dee7f3f881494cf5089d6c69fd40e74f07e670
Author: Ronnie Sahlberg <[email protected]>
Date: Mon Feb 20 21:22:56 2012 +1100
ReadOnly: We can not use ctdb_ltdb_store from a client/child context since
it sometimes (for empty records) needs to be able to initiate traffic unde
rhte daemon context.
This should furhter updated later to allow the use also from non-daemon
context.
commit 303134cf10a08ce61954d5de9025d9bbcb5f75ef
Author: Ronnie Sahlberg <[email protected]>
Date: Mon Feb 20 21:13:46 2012 +1100
ReadOnly: Make sure we dont try to fast-vacuum records that are set for
readonly delegation
-----------------------------------------------------------------------
Summary of changes:
server/ctdb_ltdb_server.c | 2 ++
server/ctdb_persistent.c | 33 +++++++++++++++++++++++----------
2 files changed, 25 insertions(+), 10 deletions(-)
Changeset truncated at 500 lines:
diff --git a/server/ctdb_ltdb_server.c b/server/ctdb_ltdb_server.c
index e5437b9..e699c2a 100644
--- a/server/ctdb_ltdb_server.c
+++ b/server/ctdb_ltdb_server.c
@@ -83,6 +83,8 @@ static int ctdb_ltdb_store_server(struct ctdb_db_context
*ctdb_db,
*/
if (data.dsize != 0) {
keep = true;
+ } else if (header->flags &
(CTDB_REC_RO_HAVE_DELEGATIONS|CTDB_REC_RO_HAVE_READONLY)) {
+ keep = true;
} else if (ctdb_db->persistent) {
keep = true;
} else if (header->flags & CTDB_REC_FLAG_AUTOMATIC) {
diff --git a/server/ctdb_persistent.c b/server/ctdb_persistent.c
index dd8d479..0f4f4da 100644
--- a/server/ctdb_persistent.c
+++ b/server/ctdb_persistent.c
@@ -456,12 +456,12 @@ static int ctdb_persistent_store(struct
ctdb_persistent_write_state *state)
}
for (i=0;i<m->count;i++) {
- struct ctdb_ltdb_header oldheader;
- struct ctdb_ltdb_header header;
+ struct ctdb_ltdb_header *oldheader;
+ struct ctdb_ltdb_header *header;
TDB_DATA key, data, olddata;
TALLOC_CTX *tmp_ctx = talloc_new(state);
- rec = ctdb_marshall_loop_next(m, rec, NULL, &header, &key,
&data);
+ rec = ctdb_marshall_loop_next(m, rec, NULL, NULL, &key, &data);
if (rec == NULL) {
DEBUG(DEBUG_ERR,("Failed to get next record %d for
db_id 0x%08x in ctdb_persistent_store\n",
@@ -469,29 +469,42 @@ static int ctdb_persistent_store(struct
ctdb_persistent_write_state *state)
talloc_free(tmp_ctx);
goto failed;
}
+ header = (struct ctdb_ltdb_header *)&data.dptr[0];
/* fetch the old header and ensure the rsn is less than the new
rsn */
- ret = ctdb_ltdb_fetch(state->ctdb_db, key, &oldheader, tmp_ctx,
&olddata);
- if (ret != 0) {
+ olddata = tdb_fetch(state->ctdb_db->ltdb->tdb, key);
+ if (olddata.dptr == NULL) {
DEBUG(DEBUG_ERR,("Failed to fetch old record for db_id
0x%08x in ctdb_persistent_store\n",
state->ctdb_db->db_id));
talloc_free(tmp_ctx);
goto failed;
}
+ if (olddata.dsize < sizeof(struct ctdb_ltdb_header)) {
+ DEBUG(DEBUG_ERR,("Not enough header for record for
db_id 0x%08x in ctdb_persistent_store\n",
+ state->ctdb_db->db_id));
+ talloc_free(tmp_ctx);
+ free(olddata.dptr);
+ goto failed;
+ }
+ oldheader = (struct ctdb_ltdb_header *)&olddata.dptr[0];
- if (oldheader.rsn >= header.rsn &&
- (olddata.dsize != data.dsize ||
- memcmp(olddata.dptr, data.dptr, data.dsize) != 0)) {
+ if (oldheader->rsn >= header->rsn &&
+ (olddata.dsize != data.dsize ||
+ memcmp(&olddata.dptr[sizeof(struct ctdb_ltdb_header)],
+ &data.dptr[sizeof(struct ctdb_ltdb_header)],
+ data.dsize - sizeof(struct ctdb_ltdb_header)) != 0)) {
DEBUG(DEBUG_CRIT,("existing header for db_id 0x%08x has
larger RSN %llu than new RSN %llu in ctdb_persistent_store\n",
state->ctdb_db->db_id,
- (unsigned long long)oldheader.rsn,
(unsigned long long)header.rsn));
+ (unsigned long long)oldheader->rsn,
(unsigned long long)header->rsn));
talloc_free(tmp_ctx);
+ free(olddata.dptr);
goto failed;
}
talloc_free(tmp_ctx);
+ free(olddata.dptr);
- ret = ctdb_ltdb_store(state->ctdb_db, key, &header, data);
+ ret = tdb_store(state->ctdb_db->ltdb->tdb, key, data,
TDB_REPLACE);
if (ret != 0) {
DEBUG(DEBUG_CRIT,("Failed to store record for db_id
0x%08x in ctdb_persistent_store\n",
state->ctdb_db->db_id));
--
CTDB repository