Skip to content

Commit 6fc2885

Browse files
authored
Merge pull request ceph#57125 from xxhdx1985126/wip-65679
crimson/osd/pg: reset the snap mapper's backend when pg interval changes Reviewed-by: Samuel Just <[email protected]> Reviewed-by: Radosław Zarzyński <[email protected]> Reviewed-by: Matan Breizman <[email protected]>
2 parents f0b9411 + 9f6ccaf commit 6fc2885

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

src/common/map_cacher.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ class MapCacher {
8585
public:
8686
MapCacher(StoreDriver<K, V> *driver) : driver(driver) {}
8787

88+
void reset() {
89+
in_progress.reset();
90+
}
91+
8892
/// Fetch first key/value std::pair after specified key
8993
int get_next(
9094
K key, ///< [in] key after which to get next

src/common/sharedptr_registry.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <map>
1919
#include <memory>
2020
#include "common/ceph_mutex.h"
21+
#include "include/ceph_assert.h"
2122

2223
/**
2324
* Provides a registry of shared_ptr<V> indexed by K while
@@ -61,6 +62,11 @@ class SharedPtrRegistry {
6162
waiting(0)
6263
{}
6364

65+
void reset() {
66+
ceph_assert(!waiting);
67+
contents.clear();
68+
}
69+
6470
bool empty() {
6571
std::lock_guard l(lock);
6672
return contents.empty();

src/crimson/osd/pg.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1626,6 +1626,7 @@ void PG::on_change(ceph::os::Transaction &t) {
16261626
// is save and in time.
16271627
peering_state.state_clear(PG_STATE_SNAPTRIM);
16281628
peering_state.state_clear(PG_STATE_SNAPTRIM_ERROR);
1629+
snap_mapper.reset_backend();
16291630
}
16301631

16311632
void PG::context_registry_on_change() {

src/osd/SnapMapper.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,11 @@ class SnapMapper : public Scrub::SnapMapReaderI {
356356
return prefix_itr;
357357
}
358358

359+
/// reset the MapCacher backend, this should be called on pg interval change
360+
void reset_backend() {
361+
backend.reset();
362+
}
363+
359364
/// Update snaps for oid, empty new_snaps removes the mapping
360365
int update_snaps(
361366
const hobject_t &oid, ///< [in] oid to update

0 commit comments

Comments
 (0)