]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/: allow objects with NO_GEN but non-NO_SHARD shard
authorSamuel Just <sam.just@inktank.com>
Sat, 1 Feb 2014 05:42:45 +0000 (21:42 -0800)
committerSamuel Just <sam.just@inktank.com>
Tue, 18 Feb 2014 04:12:14 +0000 (20:12 -0800)
Signed-off-by: Samuel Just <sam.just@inktank.com>
src/common/hobject.cc
src/os/DBObjectMap.cc
src/os/LFNIndex.cc

index ffc73aa39e3d7287287f35ce870eb4d274f9aede..ecc8cfde4d715170a6df6c3a06657bf6a343729a 100644 (file)
@@ -272,7 +272,8 @@ void ghobject_t::generate_test_instances(list<ghobject_t*>& 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);
   }
index f23815a42987c68710b053e37038dc680aadc94b..5334521d3cc5306d78d1139381a8f1b0708b9027 100644 (file)
@@ -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);
   }
index 92ccebf024989fd1758784b2d893c1da26fdff1a..0310cb5a6c58bb7ae2f483e2051e42c6b3aa02b9 100644 (file)
@@ -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;