diff options
author | Ronnie Sahlberg <ronniesahlberg@gmail.com> | 2012-02-29 16:09:24 +1100 |
---|---|---|
committer | Ronnie Sahlberg <ronniesahlberg@gmail.com> | 2012-02-29 16:09:24 +1100 |
commit | 6f83805183e0a68ece5e5251a0fbb882099262f4 (patch) | |
tree | da81ab4e23f96fa01c276dd9c35b1370b396555f | |
parent | e08633374357d6bae0c8b1900b32c9c895b2698b (diff) | |
download | samba-6f83805183e0a68ece5e5251a0fbb882099262f4.tar.gz samba-6f83805183e0a68ece5e5251a0fbb882099262f4.tar.xz samba-6f83805183e0a68ece5e5251a0fbb882099262f4.zip |
READONLY: skip vacuuming or deleting records with readonly delegations.
they are hot. wait until they have been revoked before we recall them.
(This used to be ctdb commit 7417d994c2a159f71d27d4bcd2f53684862eece3)
-rw-r--r-- | ctdb/server/ctdb_recover.c | 14 | ||||
-rw-r--r-- | ctdb/server/ctdb_vacuum.c | 6 |
2 files changed, 20 insertions, 0 deletions
diff --git a/ctdb/server/ctdb_recover.c b/ctdb/server/ctdb_recover.c index 3d56f77d6c..06b5ed1a92 100644 --- a/ctdb/server/ctdb_recover.c +++ b/ctdb/server/ctdb_recover.c @@ -954,6 +954,20 @@ static int delete_tdb_record(struct ctdb_context *ctdb, struct ctdb_db_context * return -1; } + /* do not allow deleting record that have readonly flags set. */ + if (hdr->flags & (CTDB_REC_RO_HAVE_DELEGATIONS|CTDB_REC_RO_HAVE_READONLY|CTDB_REC_RO_REVOKING_READONLY|CTDB_REC_RO_REVOKE_COMPLETE)) { + tdb_chainunlock(ctdb_db->ltdb->tdb, key); + DEBUG(DEBUG_INFO,(__location__ " Skipping record with readonly flags set\n")); + free(data.dptr); + return -1; + } + if (hdr2->flags & (CTDB_REC_RO_HAVE_DELEGATIONS|CTDB_REC_RO_HAVE_READONLY|CTDB_REC_RO_REVOKING_READONLY|CTDB_REC_RO_REVOKE_COMPLETE)) { + tdb_chainunlock(ctdb_db->ltdb->tdb, key); + DEBUG(DEBUG_INFO,(__location__ " Skipping record with readonly flags set\n")); + free(data.dptr); + return -1; + } + if (hdr2->dmaster == ctdb->pnn) { tdb_chainunlock(ctdb_db->ltdb->tdb, key); DEBUG(DEBUG_INFO,(__location__ " Attempted delete record where we are the dmaster\n")); diff --git a/ctdb/server/ctdb_vacuum.c b/ctdb/server/ctdb_vacuum.c index e0e1e3b508..b492f9b899 100644 --- a/ctdb/server/ctdb_vacuum.c +++ b/ctdb/server/ctdb_vacuum.c @@ -491,6 +491,12 @@ static int delete_record_traverse(void *param, void *data) header = (struct ctdb_ltdb_header *)tdb_data.dptr; + if (header->flags & (CTDB_REC_RO_HAVE_DELEGATIONS|CTDB_REC_RO_HAVE_READONLY|CTDB_REC_RO_REVOKING_READONLY|CTDB_REC_RO_REVOKE_COMPLETE)) { + /* The record has readonly flags set. skip deleting */ + vdata->delete_skipped++; + goto done; + } + if (header->dmaster != ctdb->pnn) { /* The record has been migrated off the node. Skip. */ vdata->delete_skipped++; |