]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cls_statelog: pass in timestamp
authorYehuda Sadeh <yehuda@inktank.com>
Tue, 18 Jun 2013 23:28:20 +0000 (16:28 -0700)
committerYehuda Sadeh <yehuda@inktank.com>
Tue, 18 Jun 2013 23:28:20 +0000 (16:28 -0700)
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
src/cls/statelog/cls_statelog.cc
src/cls/statelog/cls_statelog_client.cc
src/cls/statelog/cls_statelog_client.h
src/test/cls_statelog/test_cls_statelog.cc

index d9e57b06ff7758998375f83a4f7cf4b2a303b04e..f2cbbf79672ef10370f2d440b74ba2867c3f79ec 100644 (file)
@@ -186,7 +186,7 @@ static int cls_statelog_list(cls_method_context_t hctx, bufferlist *in, bufferli
   if (rc < 0)
     return rc;
 
-CLS_LOG(0, "%s: %d from_index=%s match_prefix=%s", __FILE__, __LINE__, from_index.c_str(), match_prefix.c_str());
+  CLS_LOG(20, "from_index=%s match_prefix=%s", from_index.c_str(), match_prefix.c_str());
   cls_statelog_list_ret ret;
 
   list<cls_statelog_entry>& entries = ret.entries;
@@ -199,7 +199,6 @@ CLS_LOG(0, "%s: %d from_index=%s match_prefix=%s", __FILE__, __LINE__, from_inde
   for (i = 0; i < max_entries && iter != keys.end(); ++i, ++iter) {
     const string& index = iter->first;
     marker = index;
-CLS_LOG(0, "%s: %d index=%s", __FILE__, __LINE__, index.c_str());
 
     bufferlist& bl = iter->second;
     bufferlist::iterator biter = bl.begin();
index 486daf227d4250a782f60454b3daa0b1ce4708aa..70e7ed6a22a1cf7e4e1301b7207519583b045697 100644 (file)
@@ -27,22 +27,23 @@ void cls_statelog_add(librados::ObjectWriteOperation& op, cls_statelog_entry& en
 }
 
 void cls_statelog_add_prepare_entry(cls_statelog_entry& entry, const string& client_id, const string& op_id,
-                 const string& object, uint32_t state, bufferlist& bl)
+                 const string& object, const utime_t& timestamp, uint32_t state, bufferlist& bl)
 {
   entry.client_id = client_id;
   entry.op_id = op_id;
   entry.object = object;
+  entry.timestamp = timestamp;
   entry.state = state;
   entry.data = bl;
 }
 
 void cls_statelog_add(librados::ObjectWriteOperation& op, const string& client_id, const string& op_id,
-                 const string& object, uint32_t state, bufferlist& bl)
+                 const string& object, const utime_t& timestamp, uint32_t state, bufferlist& bl)
 
 {
   cls_statelog_entry entry;
 
-  cls_statelog_add_prepare_entry(entry, client_id, op_id, object, state, bl);
+  cls_statelog_add_prepare_entry(entry, client_id, op_id, object, timestamp, state, bl);
   cls_statelog_add(op, entry);
 }
 
index 310bc44d403d7a6d43e1445c353bb1ad83c76abd..7faf361e1dc9e707f43d6b9c1a69320ff25ec704 100644 (file)
  */
 
 void cls_statelog_add_prepare_entry(cls_statelog_entry& entry, const string& client_id, const string& op_id,
-                 const string& object, uint32_t state, bufferlist& bl);
+                 const string& object, const utime_t& timestamp, uint32_t state, bufferlist& bl);
 
 void cls_statelog_add(librados::ObjectWriteOperation& op, list<cls_statelog_entry>& entry);
 void cls_statelog_add(librados::ObjectWriteOperation& op, cls_statelog_entry& entry);
 void cls_statelog_add(librados::ObjectWriteOperation& op, const string& client_id, const string& op_id,
-                 const string& object, uint32_t state, bufferlist& bl);
+                 const string& object, const utime_t& timestamp, uint32_t state, bufferlist& bl);
 
 void cls_statelog_list(librados::ObjectReadOperation& op,
                        const string& client_id, const string& op_id, const string& object, /* op_id may be empty, also one of client_id, object*/
index ac90157aa9e3385d29b036428e37c2e416eee8f1..294b528f5db2ce97efb9c8108620b0a923689219 100644 (file)
@@ -38,7 +38,9 @@ void add_log(librados::ObjectWriteOperation *op, const string& client_id, const
   bufferlist bl;
   ::encode(state, bl);
 
-  cls_statelog_add(*op, client_id, op_id, obj, state, bl);
+  utime_t ts = ceph_clock_now(g_ceph_context);
+
+  cls_statelog_add(*op, client_id, op_id, obj, ts, state, bl);
 }
 
 void next_op_id(string& op_id, int *id)