diff options
author | Michael Adam <obnox@samba.org> | 2011-02-03 16:32:23 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2011-03-14 13:35:51 +0100 |
commit | e77ed68c1a6581a5edbf5780d3de553cd50d9f7e (patch) | |
tree | e1599f06bd1a5c7a961958f28a4e464e11ce0595 | |
parent | 9c91e1695503fa7d989469f0f0536750dce9e9b7 (diff) | |
download | samba-e77ed68c1a6581a5edbf5780d3de553cd50d9f7e.tar.gz samba-e77ed68c1a6581a5edbf5780d3de553cd50d9f7e.tar.xz samba-e77ed68c1a6581a5edbf5780d3de553cd50d9f7e.zip |
ctdb_ltdb_store_server: honour the AUTOMATIC record flag
Do not delete empty records that carry this flag but store
them and schedule them for deletetion. Do not store the flag
in the ltdb though, since this is internal only and should not
be visible to the client.
(This used to be ctdb commit f898ff21fa338358179e79381215b13a6bc77c53)
-rw-r--r-- | ctdb/server/ctdb_ltdb_server.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/ctdb/server/ctdb_ltdb_server.c b/ctdb/server/ctdb_ltdb_server.c index c919b73109..92fb0f6640 100644 --- a/ctdb/server/ctdb_ltdb_server.c +++ b/ctdb/server/ctdb_ltdb_server.c @@ -102,6 +102,17 @@ static int ctdb_ltdb_store_server(struct ctdb_db_context *ctdb_db, keep = true; } else if (ctdb_db->persistent) { keep = true; + } else if (header->flags & CTDB_REC_FLAG_AUTOMATIC) { + /* + * The record is not created by the client but + * automatically by the ctdb_ltdb_fetch logic that + * creates a record with an initial header in the + * ltdb before trying to migrate the record from + * the current lmaster. Keep it instead of trying + * to delete the non-existing record... + */ + keep = true; + schedule_for_deletion = true; } else if (header->flags & CTDB_REC_FLAG_MIGRATED_WITH_DATA) { keep = true; } else if (ctdb_db->ctdb->pnn == lmaster) { @@ -157,6 +168,14 @@ store: */ header->flags &= ~CTDB_REC_FLAG_VACUUM_MIGRATED; + /* + * Similarly, clear the AUTOMATIC flag which should not enter + * the local database copy since this would require client + * modifications to clear the flag when the client stores + * the record. + */ + header->flags &= ~CTDB_REC_FLAG_AUTOMATIC; + rec.dsize = sizeof(*header) + data.dsize; rec.dptr = talloc_size(ctdb, rec.dsize); CTDB_NO_MEMORY(ctdb, rec.dptr); |