From 4f8fb979e833fd1dbda8cc46e598cb67f3e590f0 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 24 Nov 2008 13:49:17 -0800 Subject: [PATCH] osd: remove snap collection after it is trimmed We can still end up with empty collections for existing snaps but no local objects. However, they'll eventually go away when the snap is deleted, so who cares. --- src/TODO | 2 -- src/osd/ReplicatedPG.cc | 10 +++++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/TODO b/src/TODO index 3be4dca599c43..2e29775bb98f9 100644 --- a/src/TODO +++ b/src/TODO @@ -162,8 +162,6 @@ mon - osdmon needs to lower-bound old osdmap versions it keeps around? osd -- snap_trimmers should detect, remove unused snap collections (and update snap_collections set)? - - how does an admin intervene when a pg needs to repeer despite a dead osd? - generalize ack semantics? or just change ack from memory to journal? memory/journal/disk... diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 2f2f5a15df3e3..e8e03022fc215 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -535,7 +535,15 @@ bool ReplicatedPG::snap_trimmer() unlock(); lock(); } - + + // remove snap collection + ObjectStore::Transaction t; + dout(10) << "removing snap " << sn << " collection " << c << dendl; + snap_collections.erase(sn); + write_info(t); + t.remove_collection(c); + osd->store->apply_transaction(t); + info.dead_snaps.erase(sn); } -- 2.39.5