READONLY: skip vacuuming or deleting records with readonly delegations.
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Wed, 29 Feb 2012 05:09:24 +0000 (16:09 +1100)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Wed, 29 Feb 2012 05:09:24 +0000 (16:09 +1100)
they are hot. wait until they have been revoked before we recall them.

(This used to be ctdb commit 7417d994c2a159f71d27d4bcd2f53684862eece3)

ctdb/server/ctdb_recover.c
ctdb/server/ctdb_vacuum.c

index 3d56f77d6c28bc36e49e0d2048ba80bdf33007d5..06b5ed1a9224ad0cf89af109708856c87bdc2de1 100644 (file)
@@ -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"));
index e0e1e3b50890e506adc744ad67f5ce0f6ac570b7..b492f9b899f387a30846a60273b431f808c205d5 100644 (file)
@@ -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++;