mirror of
https://github.com/ceph/ceph
synced 2025-01-11 13:41:02 +00:00
Merge pull request #8378 from liewegas/wip-pgls-pgid
osdc/Objecter: use full pgid hash in PGNLS ops Reviewed-by: Josh Durgin <jdurgin@redhat.com>
This commit is contained in:
commit
0f81ac5d87
@ -925,8 +925,10 @@ void ReplicatedPG::do_pg_op(OpRequestRef op)
|
||||
// fall through
|
||||
|
||||
case CEPH_OSD_OP_PGNLS:
|
||||
if (m->get_pg() != info.pgid.pgid) {
|
||||
dout(10) << " pgnls pg=" << m->get_pg() << " != " << info.pgid << dendl;
|
||||
if (get_osdmap()->raw_pg_to_pg(m->get_pg()) != info.pgid.pgid) {
|
||||
dout(10) << " pgnls pg=" << m->get_pg()
|
||||
<< " " << get_osdmap()->raw_pg_to_pg(m->get_pg())
|
||||
<< " != " << info.pgid << dendl;
|
||||
result = 0; // hmm?
|
||||
} else {
|
||||
unsigned list_size = MIN(cct->_conf->osd_max_pgls, p->op.pgls.count);
|
||||
@ -946,7 +948,21 @@ void ReplicatedPG::do_pg_op(OpRequestRef op)
|
||||
|
||||
hobject_t next;
|
||||
hobject_t lower_bound = response.handle;
|
||||
dout(10) << " pgnls lower_bound " << lower_bound << dendl;
|
||||
hobject_t pg_start = info.pgid.pgid.get_hobj_start();
|
||||
hobject_t pg_end = info.pgid.pgid.get_hobj_end(pool.info.get_pg_num());
|
||||
dout(10) << " pgnls lower_bound " << lower_bound
|
||||
<< " pg_end " << pg_end << dendl;
|
||||
if (get_sort_bitwise() &&
|
||||
((lower_bound != hobject_t::get_max() &&
|
||||
cmp_bitwise(lower_bound, pg_end) >= 0) ||
|
||||
(lower_bound != hobject_t() &&
|
||||
cmp_bitwise(lower_bound, pg_start) < 0))) {
|
||||
// this should only happen with a buggy client.
|
||||
dout(10) << "outside of PG bounds " << pg_start << " .. "
|
||||
<< pg_end << dendl;
|
||||
result = -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
hobject_t current = lower_bound;
|
||||
osr->flush();
|
||||
@ -1081,7 +1097,7 @@ void ReplicatedPG::do_pg_op(OpRequestRef op)
|
||||
} else {
|
||||
response.handle = next;
|
||||
}
|
||||
dout(10) << "pgls handle=" << response.handle << dendl;
|
||||
dout(10) << "pgnls handle=" << response.handle << dendl;
|
||||
::encode(response, osd_op.outdata);
|
||||
if (filter)
|
||||
::encode(filter_out, osd_op.outdata);
|
||||
@ -1113,8 +1129,10 @@ void ReplicatedPG::do_pg_op(OpRequestRef op)
|
||||
// fall through
|
||||
|
||||
case CEPH_OSD_OP_PGLS:
|
||||
if (m->get_pg() != info.pgid.pgid) {
|
||||
dout(10) << " pgls pg=" << m->get_pg() << " != " << info.pgid << dendl;
|
||||
if (get_osdmap()->raw_pg_to_pg(m->get_pg()) != info.pgid.pgid) {
|
||||
dout(10) << " pgls pg=" << m->get_pg()
|
||||
<< " " << get_osdmap()->raw_pg_to_pg(m->get_pg())
|
||||
<< " != " << info.pgid << dendl;
|
||||
result = 0; // hmm?
|
||||
} else {
|
||||
unsigned list_size = MIN(cct->_conf->osd_max_pgls, p->op.pgls.count);
|
||||
|
@ -2663,7 +2663,15 @@ int Objecter::_calc_target(op_target_t *t, epoch_t *last_force_resend,
|
||||
t->osd = -1;
|
||||
return RECALC_OP_TARGET_POOL_DNE;
|
||||
}
|
||||
pgid = osdmap->raw_pg_to_pg(t->base_pgid);
|
||||
if (osdmap->test_flag(CEPH_OSDMAP_SORTBITWISE)) {
|
||||
// if the SORTBITWISE flag is set, we know all OSDs are running
|
||||
// jewel+.
|
||||
pgid = t->base_pgid;
|
||||
} else {
|
||||
// legacy behavior. pre-jewel OSDs will fail if we send a
|
||||
// full-hash pgid value.
|
||||
pgid = osdmap->raw_pg_to_pg(t->base_pgid);
|
||||
}
|
||||
} else {
|
||||
int ret = osdmap->object_locator_to_pg(t->target_oid, t->target_oloc,
|
||||
pgid);
|
||||
|
@ -234,7 +234,7 @@ ceph_test_rados_api_aio_CXXFLAGS = $(UNITTEST_CXXFLAGS)
|
||||
bin_DEBUGPROGRAMS += ceph_test_rados_api_aio
|
||||
|
||||
ceph_test_rados_api_list_SOURCES = test/librados/list.cc
|
||||
ceph_test_rados_api_list_LDADD = $(LIBRADOS) $(UNITTEST_LDADD) $(RADOS_TEST_LDADD)
|
||||
ceph_test_rados_api_list_LDADD = $(LIBRADOS) $(UNITTEST_LDADD) $(RADOS_TEST_LDADD) $(CEPH_GLOBAL)
|
||||
ceph_test_rados_api_list_CXXFLAGS = $(UNITTEST_CXXFLAGS)
|
||||
bin_DEBUGPROGRAMS += ceph_test_rados_api_list
|
||||
|
||||
|
@ -5,6 +5,10 @@
|
||||
#include "include/stringify.h"
|
||||
#include "test/librados/test.h"
|
||||
#include "test/librados/TestCase.h"
|
||||
#include "global/global_context.h"
|
||||
#include "global/global_init.h"
|
||||
#include "common/ceph_argparse.h"
|
||||
#include "common/common_init.h"
|
||||
|
||||
#include "include/types.h"
|
||||
#include "common/hobject.h"
|
||||
@ -956,3 +960,18 @@ TEST_F(LibRadosListPP, EnumerateObjectsFilterPP) {
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
#pragma GCC diagnostic warning "-Wpragmas"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
|
||||
vector<const char*> args;
|
||||
argv_to_vec(argc, (const char **)argv, args);
|
||||
env_to_vec(args);
|
||||
cout << args << std::endl;
|
||||
|
||||
global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
|
||||
common_init_finish(g_ceph_context);
|
||||
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
@ -5354,6 +5354,7 @@ int main(int argc, char **argv)
|
||||
|
||||
vector<const char*> args;
|
||||
argv_to_vec(argc, (const char **)argv, args);
|
||||
env_to_vec(args),
|
||||
|
||||
global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
|
||||
common_init_finish(g_ceph_context);
|
||||
|
Loading…
Reference in New Issue
Block a user