diff options
author | Yehuda Sadeh <yehuda@inktank.com> | 2013-06-18 16:28:20 -0700 |
---|---|---|
committer | Yehuda Sadeh <yehuda@inktank.com> | 2013-06-18 16:28:20 -0700 |
commit | 0b932bfdd99b58042e1aefe47569846ba01cb5a6 (patch) | |
tree | 405cabbba24521bcb83410be5d3926245e85eb94 | |
parent | cba4de11127b3f41977dd5002cd71f99c02c0931 (diff) | |
download | ceph-0b932bfdd99b58042e1aefe47569846ba01cb5a6.tar.gz |
cls_statelog: pass in timestamp
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
-rw-r--r-- | src/cls/statelog/cls_statelog.cc | 3 | ||||
-rw-r--r-- | src/cls/statelog/cls_statelog_client.cc | 7 | ||||
-rw-r--r-- | src/cls/statelog/cls_statelog_client.h | 4 | ||||
-rw-r--r-- | src/test/cls_statelog/test_cls_statelog.cc | 4 |
4 files changed, 10 insertions, 8 deletions
diff --git a/src/cls/statelog/cls_statelog.cc b/src/cls/statelog/cls_statelog.cc index d9e57b06ff7..f2cbbf79672 100644 --- a/src/cls/statelog/cls_statelog.cc +++ b/src/cls/statelog/cls_statelog.cc @@ -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(); diff --git a/src/cls/statelog/cls_statelog_client.cc b/src/cls/statelog/cls_statelog_client.cc index 486daf227d4..70e7ed6a22a 100644 --- a/src/cls/statelog/cls_statelog_client.cc +++ b/src/cls/statelog/cls_statelog_client.cc @@ -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); } diff --git a/src/cls/statelog/cls_statelog_client.h b/src/cls/statelog/cls_statelog_client.h index 310bc44d403..7faf361e1dc 100644 --- a/src/cls/statelog/cls_statelog_client.h +++ b/src/cls/statelog/cls_statelog_client.h @@ -10,12 +10,12 @@ */ 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*/ diff --git a/src/test/cls_statelog/test_cls_statelog.cc b/src/test/cls_statelog/test_cls_statelog.cc index ac90157aa9e..294b528f5db 100644 --- a/src/test/cls_statelog/test_cls_statelog.cc +++ b/src/test/cls_statelog/test_cls_statelog.cc @@ -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) |