Skip to content

Commit 6025789

Browse files
authored
Merge pull request ceph#55536 from Matan-B/wip-crimson-snapmapper-get_next
osd/SnapMapper: Crimson - fix OSDriver::get_next Reviewed-by: Samuel Just <[email protected]> Reviewed-by: chunmei-liu <[email protected]>
2 parents 1c7f8b2 + 8fd9b03 commit 6025789

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/osd/SnapMapper.cc

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ int OSDriver::get_keys(
9595
const std::set<std::string> &keys,
9696
std::map<std::string, ceph::buffer::list> *out)
9797
{
98-
CRIMSON_DEBUG("OSDriver::{}:{}", __func__, __LINE__);
98+
CRIMSON_DEBUG("OSDriver::{}", __func__);
9999
using crimson::os::FuturizedStore;
100100
return interruptor::green_get(os->omap_get_values(
101101
ch, hoid, keys
@@ -107,54 +107,54 @@ int OSDriver::get_keys(
107107
assert(e.value() > 0);
108108
return -e.value();
109109
}))); // this requires seastar::thread
110-
CRIMSON_DEBUG("OSDriver::{}:{}", __func__, __LINE__);
111110
}
112111

113112
int OSDriver::get_next(
114113
const std::string &key,
115114
std::pair<std::string, ceph::buffer::list> *next)
116115
{
117-
CRIMSON_DEBUG("OSDriver::{}:{}", __func__, __LINE__);
116+
CRIMSON_DEBUG("OSDriver::{} key {}", __func__, key);
118117
using crimson::os::FuturizedStore;
119118
return interruptor::green_get(os->omap_get_values(
120119
ch, hoid, key
121120
).safe_then_unpack([&key, next] (bool, FuturizedStore::Shard::omap_values_t&& vals) {
122-
CRIMSON_DEBUG("OSDriver::{}:{}", "get_next", __LINE__);
123-
if (auto nit = std::begin(vals); nit == std::end(vals)) {
124-
CRIMSON_DEBUG("OSDriver::{}:{}", "get_next", __LINE__);
121+
CRIMSON_DEBUG("OSDriver::get_next key {} got omap values", key);
122+
if (auto nit = std::begin(vals);
123+
nit == std::end(vals) || !SnapMapper::is_mapping(nit->first)) {
124+
CRIMSON_DEBUG("OSDriver::get_next key {} no more values", key);
125125
return -ENOENT;
126126
} else {
127-
CRIMSON_DEBUG("OSDriver::{}:{}", "get_next", __LINE__);
127+
CRIMSON_DEBUG("OSDriver::get_next returning next: {}, ", nit->first);
128128
assert(nit->first > key);
129129
*next = *nit;
130130
return 0;
131131
}
132132
}, FuturizedStore::Shard::read_errorator::all_same_way([] {
133-
CRIMSON_DEBUG("OSDriver::{}:{}", "get_next", __LINE__);
133+
CRIMSON_DEBUG("OSDriver::get_next saw error returning EINVAL");
134134
return -EINVAL;
135135
}))); // this requires seastar::thread
136-
CRIMSON_DEBUG("OSDriver::{}:{}", __func__, __LINE__);
137136
}
138137

139138
int OSDriver::get_next_or_current(
140139
const std::string &key,
141140
std::pair<std::string, ceph::buffer::list> *next_or_current)
142141
{
143-
CRIMSON_DEBUG("OSDriver::{}:{}", __func__, __LINE__);
142+
CRIMSON_DEBUG("OSDriver::{} key {}", __func__, key);
144143
using crimson::os::FuturizedStore;
145144
// let's try to get current first
146145
return interruptor::green_get(os->omap_get_values(
147146
ch, hoid, FuturizedStore::Shard::omap_keys_t{key}
148147
).safe_then([&key, next_or_current] (FuturizedStore::Shard::omap_values_t&& vals) {
148+
CRIMSON_DEBUG("OSDriver::get_next_or_current returning {}", key);
149149
assert(vals.size() == 1);
150150
*next_or_current = std::make_pair(key, std::move(vals.begin()->second));
151151
return 0;
152152
}, FuturizedStore::Shard::read_errorator::all_same_way(
153153
[next_or_current, &key, this] {
154+
CRIMSON_DEBUG("OSDriver::get_next_or_current no current, try next {}", key);
154155
// no current, try next
155156
return get_next(key, next_or_current);
156157
}))); // this requires seastar::thread
157-
CRIMSON_DEBUG("OSDriver::{}:{}", __func__, __LINE__);
158158
}
159159
#else
160160
int OSDriver::get_keys(

src/osd/SnapMapper.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,6 @@ class SnapMapper : public Scrub::SnapMapReaderI {
256256
std::pair<std::string, ceph::buffer::list> to_raw(
257257
const std::pair<snapid_t, hobject_t> &to_map) const;
258258

259-
static bool is_mapping(const std::string &to_test);
260-
261259
static std::pair<snapid_t, hobject_t> from_raw(
262260
const std::pair<std::string, ceph::buffer::list> &image);
263261

@@ -317,6 +315,8 @@ class SnapMapper : public Scrub::SnapMapReaderI {
317315
return std::string(buf, r) + '_';
318316
}
319317

318+
static bool is_mapping(const std::string &to_test);
319+
320320
uint32_t mask_bits;
321321
const uint32_t match;
322322
std::string last_key_checked;

0 commit comments

Comments
 (0)