summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Just <sam.just@inktank.com>2012-11-15 13:35:47 -0800
committerSamuel Just <sam.just@inktank.com>2012-11-29 13:51:52 -0800
commit206f39e3b8a6d4e566feb841f1fea475857fae17 (patch)
treea005da8b012b8504e7155f46ef9b21c727fe2c9b
parent8218d8ac0bfe2ba43b3b43187e499236ff802c91 (diff)
downloadceph-206f39e3b8a6d4e566feb841f1fea475857fae17.tar.gz
ReplicatedPG: remove from snap_collections even without objects to trim
Also, make sure to write_info after updating snap_collections. Signed-off-by: Samuel Just <sam.just@inktank.com>
-rw-r--r--src/osd/ReplicatedPG.cc16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc
index 3dd5e9566d6..379205a0168 100644
--- a/src/osd/ReplicatedPG.cc
+++ b/src/osd/ReplicatedPG.cc
@@ -7064,10 +7064,15 @@ boost::statechart::result ReplicatedPG::NotTrimming::react(const SnapTrim&)
dout(10) << "NotTrimming: obs_to_trim empty!" << dendl;
dout(10) << "purged_snaps now " << pg->info.purged_snaps << ", snap_trimq now "
<< pg->snap_trimq << dendl;
- ObjectStore::Transaction *t = new ObjectStore::Transaction;
- t->remove_collection(col_to_trim);
- int r = pg->osd->store->queue_transaction(NULL, t, new ObjectStore::C_DeleteTransaction(t));
- assert(r == 0);
+ if (pg->snap_collections.contains(snap_to_trim)) {
+ ObjectStore::Transaction *t = new ObjectStore::Transaction;
+ pg->snap_collections.erase(snap_to_trim);
+ t->remove_collection(col_to_trim);
+ pg->write_info(*t);
+ int r = pg->osd->store->queue_transaction(
+ NULL, t, new ObjectStore::C_DeleteTransaction(t));
+ assert(r == 0);
+ }
post_event(SnapTrim());
return discard_event();
} else {
@@ -7118,9 +7123,10 @@ boost::statechart::result ReplicatedPG::RepColTrim::react(const SnapTrim&)
t->collection_remove(col_to_trim, *i);
}
t->remove_collection(col_to_trim);
+ pg->snap_collections.erase(snap_to_trim);
+ pg->write_info(*t);
int r = pg->osd->store->queue_transaction(NULL, t, new ObjectStore::C_DeleteTransaction(t));
assert(r == 0);
- pg->snap_collections.erase(snap_to_trim);
return discard_event();
}