From 5a8c0bb952a13df499b865fd5dc9ff258db27f85 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Fri, 31 Jan 2014 21:42:45 -0800 Subject: [PATCH] os/: allow objects with NO_GEN but non-NO_SHARD shard Signed-off-by: Samuel Just --- src/common/hobject.cc | 3 ++- src/os/DBObjectMap.cc | 5 ++--- src/os/LFNIndex.cc | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/common/hobject.cc b/src/common/hobject.cc index ffc73aa39e3..ecc8cfde4d7 100644 --- a/src/common/hobject.cc +++ b/src/common/hobject.cc @@ -272,7 +272,8 @@ void ghobject_t::generate_test_instances(list& o) ostream& operator<<(ostream& out, const ghobject_t& o) { out << o.hobj; - if (o.generation != ghobject_t::NO_GEN) { + if (o.generation != ghobject_t::NO_GEN || + o.shard_id != ghobject_t::NO_SHARD) { assert(o.shard_id != ghobject_t::NO_SHARD); out << "/" << o.generation << "/" << (unsigned)(o.shard_id); } diff --git a/src/os/DBObjectMap.cc b/src/os/DBObjectMap.cc index f23815a4298..5334521d3cc 100644 --- a/src/os/DBObjectMap.cc +++ b/src/os/DBObjectMap.cc @@ -156,9 +156,8 @@ string DBObjectMap::ghobject_key(const ghobject_t &oid) t += snprintf(t, end - t, ".%llx", (long long unsigned)oid.hobj.pool); snprintf(t, end - t, ".%.*X", (int)(sizeof(oid.hobj.hash)*2), oid.hobj.hash); - if (oid.generation != ghobject_t::NO_GEN) { - assert(oid.shard_id != ghobject_t::NO_SHARD); - + if (oid.generation != ghobject_t::NO_GEN || + oid.shard_id != ghobject_t::NO_SHARD) { t += snprintf(t, end - t, ".%llx", (long long unsigned)oid.generation); t += snprintf(t, end - t, ".%x", (int)oid.shard_id); } diff --git a/src/os/LFNIndex.cc b/src/os/LFNIndex.cc index 92ccebf0249..0310cb5a6c5 100644 --- a/src/os/LFNIndex.cc +++ b/src/os/LFNIndex.cc @@ -661,8 +661,8 @@ string LFNIndex::lfn_generate_object_name(const ghobject_t &oid) t += snprintf(t, end - t, "%llx", (long long unsigned)oid.hobj.pool); full_name += string(buf); - if (oid.generation != ghobject_t::NO_GEN) { - assert(oid.shard_id != ghobject_t::NO_SHARD); + if (oid.generation != ghobject_t::NO_GEN || + oid.shard_id != ghobject_t::NO_SHARD) { full_name.append("_"); t = buf; -- 2.47.3