2 #include "rgw_coroutine.h"
3 #include "rgw_cr_rados.h"
5 #include "cls/lock/cls_lock_client.h"
6 #include "cls/rgw/cls_rgw_client.h"
8 #include <boost/asio/yield.hpp>
10 #define dout_context g_ceph_context
11 #define dout_subsys ceph_subsys_rgw
13 bool RGWAsyncRadosProcessor::RGWWQ::_enqueue(RGWAsyncRadosRequest
*req
) {
14 if (processor
->is_going_down()) {
18 processor
->m_req_queue
.push_back(req
);
19 dout(20) << "enqueued request req=" << hex
<< req
<< dec
<< dendl
;
24 bool RGWAsyncRadosProcessor::RGWWQ::_empty() {
25 return processor
->m_req_queue
.empty();
28 RGWAsyncRadosRequest
*RGWAsyncRadosProcessor::RGWWQ::_dequeue() {
29 if (processor
->m_req_queue
.empty())
31 RGWAsyncRadosRequest
*req
= processor
->m_req_queue
.front();
32 processor
->m_req_queue
.pop_front();
33 dout(20) << "dequeued request req=" << hex
<< req
<< dec
<< dendl
;
38 void RGWAsyncRadosProcessor::RGWWQ::_process(RGWAsyncRadosRequest
*req
, ThreadPool::TPHandle
& handle
) {
39 processor
->handle_request(req
);
40 processor
->req_throttle
.put(1);
43 void RGWAsyncRadosProcessor::RGWWQ::_dump_queue() {
44 if (!g_conf
->subsys
.should_gather(ceph_subsys_rgw
, 20)) {
47 deque
<RGWAsyncRadosRequest
*>::iterator iter
;
48 if (processor
->m_req_queue
.empty()) {
49 dout(20) << "RGWWQ: empty" << dendl
;
52 dout(20) << "RGWWQ:" << dendl
;
53 for (iter
= processor
->m_req_queue
.begin(); iter
!= processor
->m_req_queue
.end(); ++iter
) {
54 dout(20) << "req: " << hex
<< *iter
<< dec
<< dendl
;
58 RGWAsyncRadosProcessor::RGWAsyncRadosProcessor(RGWRados
*_store
, int num_threads
)
59 : store(_store
), m_tp(store
->ctx(), "RGWAsyncRadosProcessor::m_tp", "rados_async", num_threads
),
60 req_throttle(store
->ctx(), "rgw_async_rados_ops", num_threads
* 2),
61 req_wq(this, g_conf
->rgw_op_thread_timeout
,
62 g_conf
->rgw_op_thread_suicide_timeout
, &m_tp
) {
65 void RGWAsyncRadosProcessor::start() {
69 void RGWAsyncRadosProcessor::stop() {
73 for (auto iter
= m_req_queue
.begin(); iter
!= m_req_queue
.end(); ++iter
) {
78 void RGWAsyncRadosProcessor::handle_request(RGWAsyncRadosRequest
*req
) {
83 void RGWAsyncRadosProcessor::queue(RGWAsyncRadosRequest
*req
) {
88 int RGWAsyncGetSystemObj::_send_request()
90 return store
->get_system_obj(*obj_ctx
, read_state
, objv_tracker
, obj
, *pbl
, ofs
, end
, pattrs
, NULL
);
93 RGWAsyncGetSystemObj::RGWAsyncGetSystemObj(RGWCoroutine
*caller
, RGWAioCompletionNotifier
*cn
, RGWRados
*_store
, RGWObjectCtx
*_obj_ctx
,
94 RGWObjVersionTracker
*_objv_tracker
, const rgw_raw_obj
& _obj
,
95 bufferlist
*_pbl
, off_t _ofs
, off_t _end
) : RGWAsyncRadosRequest(caller
, cn
), store(_store
), obj_ctx(_obj_ctx
),
96 objv_tracker(_objv_tracker
), obj(_obj
), pbl(_pbl
), pattrs(NULL
),
101 int RGWSimpleRadosReadAttrsCR::send_request()
103 req
= new RGWAsyncGetSystemObj(this, stack
->create_completion_notifier(),
104 store
, &obj_ctx
, NULL
,
108 req
->set_read_attrs(pattrs
);
110 async_rados
->queue(req
);
114 int RGWSimpleRadosReadAttrsCR::request_complete()
116 return req
->get_ret_status();
119 int RGWAsyncPutSystemObj::_send_request()
121 return store
->put_system_obj_data(NULL
, obj
, bl
, -1, exclusive
, objv_tracker
);
124 RGWAsyncPutSystemObj::RGWAsyncPutSystemObj(RGWCoroutine
*caller
, RGWAioCompletionNotifier
*cn
, RGWRados
*_store
,
125 RGWObjVersionTracker
*_objv_tracker
, rgw_raw_obj
& _obj
,
126 bool _exclusive
, bufferlist
& _bl
)
127 : RGWAsyncRadosRequest(caller
, cn
), store(_store
), objv_tracker(_objv_tracker
),
128 obj(_obj
), exclusive(_exclusive
), bl(_bl
)
132 int RGWAsyncPutSystemObjAttrs::_send_request()
134 return store
->system_obj_set_attrs(NULL
, obj
, *attrs
, NULL
, objv_tracker
);
137 RGWAsyncPutSystemObjAttrs::RGWAsyncPutSystemObjAttrs(RGWCoroutine
*caller
, RGWAioCompletionNotifier
*cn
, RGWRados
*_store
,
138 RGWObjVersionTracker
*_objv_tracker
, const rgw_raw_obj
& _obj
,
139 map
<string
, bufferlist
> *_attrs
) : RGWAsyncRadosRequest(caller
, cn
), store(_store
),
140 objv_tracker(_objv_tracker
), obj(_obj
),
146 RGWOmapAppend::RGWOmapAppend(RGWAsyncRadosProcessor
*_async_rados
, RGWRados
*_store
, const rgw_raw_obj
& _obj
,
147 uint64_t _window_size
)
148 : RGWConsumerCR
<string
>(_store
->ctx()), async_rados(_async_rados
),
149 store(_store
), obj(_obj
), going_down(false), num_pending_entries(0), window_size(_window_size
), total_entries(0)
153 int RGWAsyncLockSystemObj::_send_request()
156 int r
= store
->get_raw_obj_ref(obj
, &ref
);
158 lderr(store
->ctx()) << "ERROR: failed to get ref for (" << obj
<< ") ret=" << r
<< dendl
;
162 rados::cls::lock::Lock
l(lock_name
);
163 utime_t
duration(duration_secs
, 0);
164 l
.set_duration(duration
);
165 l
.set_cookie(cookie
);
168 return l
.lock_exclusive(&ref
.ioctx
, ref
.oid
);
171 RGWAsyncLockSystemObj::RGWAsyncLockSystemObj(RGWCoroutine
*caller
, RGWAioCompletionNotifier
*cn
, RGWRados
*_store
,
172 RGWObjVersionTracker
*_objv_tracker
, const rgw_raw_obj
& _obj
,
173 const string
& _name
, const string
& _cookie
, uint32_t _duration_secs
) : RGWAsyncRadosRequest(caller
, cn
), store(_store
),
177 duration_secs(_duration_secs
)
181 int RGWAsyncUnlockSystemObj::_send_request()
184 int r
= store
->get_raw_obj_ref(obj
, &ref
);
186 lderr(store
->ctx()) << "ERROR: failed to get ref for (" << obj
<< ") ret=" << r
<< dendl
;
190 rados::cls::lock::Lock
l(lock_name
);
192 l
.set_cookie(cookie
);
194 return l
.unlock(&ref
.ioctx
, ref
.oid
);
197 RGWAsyncUnlockSystemObj::RGWAsyncUnlockSystemObj(RGWCoroutine
*caller
, RGWAioCompletionNotifier
*cn
, RGWRados
*_store
,
198 RGWObjVersionTracker
*_objv_tracker
, const rgw_raw_obj
& _obj
,
199 const string
& _name
, const string
& _cookie
) : RGWAsyncRadosRequest(caller
, cn
), store(_store
),
201 lock_name(_name
), cookie(_cookie
)
205 RGWRadosSetOmapKeysCR::RGWRadosSetOmapKeysCR(RGWRados
*_store
,
206 const rgw_raw_obj
& _obj
,
207 map
<string
, bufferlist
>& _entries
) : RGWSimpleCoroutine(_store
->ctx()),
212 stringstream
& s
= set_description();
213 s
<< "set omap keys dest=" << obj
<< " keys=[" << s
.str() << "]";
214 for (auto i
= entries
.begin(); i
!= entries
.end(); ++i
) {
215 if (i
!= entries
.begin()) {
223 int RGWRadosSetOmapKeysCR::send_request()
225 int r
= store
->get_raw_obj_ref(obj
, &ref
);
227 lderr(store
->ctx()) << "ERROR: failed to get ref for (" << obj
<< ") ret=" << r
<< dendl
;
231 set_status() << "sending request";
233 librados::ObjectWriteOperation op
;
234 op
.omap_set(entries
);
236 cn
= stack
->create_completion_notifier();
237 return ref
.ioctx
.aio_operate(ref
.oid
, cn
->completion(), &op
);
240 int RGWRadosSetOmapKeysCR::request_complete()
242 int r
= cn
->completion()->get_return_value();
244 set_status() << "request complete; ret=" << r
;
249 RGWRadosGetOmapKeysCR::RGWRadosGetOmapKeysCR(RGWRados
*_store
,
250 const rgw_raw_obj
& _obj
,
251 const string
& _marker
,
252 std::set
<std::string
> *_entries
, int _max_entries
) : RGWSimpleCoroutine(_store
->ctx()),
255 entries(_entries
), max_entries(_max_entries
),
258 set_description() << "set omap keys dest=" << obj
<< " marker=" << marker
;
261 int RGWRadosGetOmapKeysCR::send_request() {
262 int r
= store
->get_raw_obj_ref(obj
, &ref
);
264 lderr(store
->ctx()) << "ERROR: failed to get ref for (" << obj
<< ") ret=" << r
<< dendl
;
268 set_status() << "send request";
270 librados::ObjectReadOperation op
;
271 op
.omap_get_keys2(marker
, max_entries
, entries
, nullptr, nullptr);
273 cn
= stack
->create_completion_notifier();
274 return ref
.ioctx
.aio_operate(ref
.oid
, cn
->completion(), &op
, NULL
);
277 int RGWRadosGetOmapKeysCR::request_complete()
279 int r
= cn
->completion()->get_return_value();
281 set_status() << "request complete; ret=" << r
;
286 RGWRadosRemoveOmapKeysCR::RGWRadosRemoveOmapKeysCR(RGWRados
*_store
,
287 const rgw_raw_obj
& _obj
,
288 const set
<string
>& _keys
) : RGWSimpleCoroutine(_store
->ctx()),
293 set_description() << "remove omap keys dest=" << obj
<< " keys=" << keys
;
296 int RGWRadosRemoveOmapKeysCR::send_request() {
297 int r
= store
->get_raw_obj_ref(obj
, &ref
);
299 lderr(store
->ctx()) << "ERROR: failed to get ref for (" << obj
<< ") ret=" << r
<< dendl
;
303 set_status() << "send request";
305 librados::ObjectWriteOperation op
;
306 op
.omap_rm_keys(keys
);
308 cn
= stack
->create_completion_notifier();
309 return ref
.ioctx
.aio_operate(ref
.oid
, cn
->completion(), &op
);
312 int RGWRadosRemoveOmapKeysCR::request_complete()
314 int r
= cn
->completion()->get_return_value();
316 set_status() << "request complete; ret=" << r
;
321 RGWRadosRemoveCR::RGWRadosRemoveCR(RGWRados
*store
, const rgw_raw_obj
& obj
)
322 : RGWSimpleCoroutine(store
->ctx()), store(store
), obj(obj
)
324 set_description() << "remove dest=" << obj
;
327 int RGWRadosRemoveCR::send_request()
329 auto rados
= store
->get_rados_handle();
330 int r
= rados
->ioctx_create(obj
.pool
.name
.c_str(), ioctx
);
332 lderr(cct
) << "ERROR: failed to open pool (" << obj
.pool
.name
<< ") ret=" << r
<< dendl
;
335 ioctx
.locator_set_key(obj
.loc
);
337 set_status() << "send request";
339 librados::ObjectWriteOperation op
;
342 cn
= stack
->create_completion_notifier();
343 return ioctx
.aio_operate(obj
.oid
, cn
->completion(), &op
);
346 int RGWRadosRemoveCR::request_complete()
348 int r
= cn
->completion()->get_return_value();
350 set_status() << "request complete; ret=" << r
;
355 RGWSimpleRadosLockCR::RGWSimpleRadosLockCR(RGWAsyncRadosProcessor
*_async_rados
, RGWRados
*_store
,
356 const rgw_raw_obj
& _obj
,
357 const string
& _lock_name
,
358 const string
& _cookie
,
359 uint32_t _duration
) : RGWSimpleCoroutine(_store
->ctx()),
360 async_rados(_async_rados
),
362 lock_name(_lock_name
),
368 set_description() << "rados lock dest=" << obj
<< " lock=" << lock_name
<< " cookie=" << cookie
<< " duration=" << duration
;
371 void RGWSimpleRadosLockCR::request_cleanup()
379 int RGWSimpleRadosLockCR::send_request()
381 set_status() << "sending request";
382 req
= new RGWAsyncLockSystemObj(this, stack
->create_completion_notifier(),
383 store
, NULL
, obj
, lock_name
, cookie
, duration
);
384 async_rados
->queue(req
);
388 int RGWSimpleRadosLockCR::request_complete()
390 set_status() << "request complete; ret=" << req
->get_ret_status();
391 return req
->get_ret_status();
394 RGWSimpleRadosUnlockCR::RGWSimpleRadosUnlockCR(RGWAsyncRadosProcessor
*_async_rados
, RGWRados
*_store
,
395 const rgw_raw_obj
& _obj
,
396 const string
& _lock_name
,
397 const string
& _cookie
) : RGWSimpleCoroutine(_store
->ctx()),
398 async_rados(_async_rados
),
400 lock_name(_lock_name
),
405 set_description() << "rados unlock dest=" << obj
<< " lock=" << lock_name
<< " cookie=" << cookie
;
408 void RGWSimpleRadosUnlockCR::request_cleanup()
416 int RGWSimpleRadosUnlockCR::send_request()
418 set_status() << "sending request";
420 req
= new RGWAsyncUnlockSystemObj(this, stack
->create_completion_notifier(),
421 store
, NULL
, obj
, lock_name
, cookie
);
422 async_rados
->queue(req
);
426 int RGWSimpleRadosUnlockCR::request_complete()
428 set_status() << "request complete; ret=" << req
->get_ret_status();
429 return req
->get_ret_status();
432 int RGWOmapAppend::operate() {
435 if (!has_product() && going_down
) {
436 set_status() << "going down";
439 set_status() << "waiting for product";
440 yield
wait_for_product();
443 while (consume(&entry
)) {
444 set_status() << "adding entry: " << entry
;
445 entries
[entry
] = bufferlist();
446 if (entries
.size() >= window_size
) {
450 if (entries
.size() >= window_size
|| going_down
) {
451 set_status() << "flushing to omap";
452 call(new RGWRadosSetOmapKeysCR(store
, obj
, entries
));
456 if (get_ret_status() < 0) {
457 ldout(cct
, 0) << "ERROR: failed to store entries in omap" << dendl
;
458 return set_state(RGWCoroutine_Error
);
461 /* done with coroutine */
462 return set_state(RGWCoroutine_Done
);
467 void RGWOmapAppend::flush_pending() {
468 receive(pending_entries
);
469 num_pending_entries
= 0;
472 bool RGWOmapAppend::append(const string
& s
) {
477 pending_entries
.push_back(s
);
478 if (++num_pending_entries
>= (int)window_size
) {
484 bool RGWOmapAppend::finish() {
491 int RGWAsyncGetBucketInstanceInfo::_send_request()
493 RGWObjectCtx
obj_ctx(store
);
494 int r
= store
->get_bucket_instance_from_oid(obj_ctx
, oid
, *bucket_info
, NULL
, NULL
);
496 ldout(store
->ctx(), 0) << "ERROR: failed to get bucket instance info for "
504 RGWRadosBILogTrimCR::RGWRadosBILogTrimCR(RGWRados
*store
,
505 const RGWBucketInfo
& bucket_info
,
507 const std::string
& start_marker
,
508 const std::string
& end_marker
)
509 : RGWSimpleCoroutine(store
->ctx()), bs(store
),
510 start_marker(BucketIndexShardsManager::get_shard_marker(start_marker
)),
511 end_marker(BucketIndexShardsManager::get_shard_marker(end_marker
))
513 bs
.init(bucket_info
, shard_id
);
516 int RGWRadosBILogTrimCR::send_request()
519 cls_rgw_bi_log_trim_op call
;
520 call
.start_marker
= std::move(start_marker
);
521 call
.end_marker
= std::move(end_marker
);
524 librados::ObjectWriteOperation op
;
525 op
.exec(RGW_CLASS
, RGW_BI_LOG_TRIM
, in
);
527 cn
= stack
->create_completion_notifier();
528 return bs
.index_ctx
.aio_operate(bs
.bucket_obj
, cn
->completion(), &op
);
531 int RGWRadosBILogTrimCR::request_complete()
533 int r
= cn
->completion()->get_return_value();
534 set_status() << "request complete; ret=" << r
;
538 int RGWAsyncFetchRemoteObj::_send_request()
540 RGWObjectCtx
obj_ctx(store
);
544 snprintf(buf
, sizeof(buf
), ".%lld", (long long)store
->instance_id());
545 string client_id
= store
->zone_id() + buf
;
546 string op_id
= store
->unique_id(store
->get_new_req_id());
547 map
<string
, bufferlist
> attrs
;
549 rgw_obj
src_obj(bucket_info
.bucket
, key
);
551 rgw_obj
dest_obj(src_obj
);
553 int r
= store
->fetch_remote_obj(obj_ctx
,
557 false, /* don't record op state in ops log */
562 bucket_info
, /* dest */
563 bucket_info
, /* source */
564 NULL
, /* real_time* src_mtime, */
565 NULL
, /* real_time* mtime, */
566 NULL
, /* const real_time* mod_ptr, */
567 NULL
, /* const real_time* unmod_ptr, */
568 false, /* high precision time */
569 NULL
, /* const char *if_match, */
570 NULL
, /* const char *if_nomatch, */
571 RGWRados::ATTRSMOD_NONE
,
574 RGW_OBJ_CATEGORY_MAIN
,
576 real_time(), /* delete_at */
577 &key
.instance
, /* string *version_id, */
578 NULL
, /* string *ptag, */
579 NULL
, /* string *petag, */
580 NULL
, /* void (*progress_cb)(off_t, void *), */
581 NULL
, /* void *progress_data*); */
585 ldout(store
->ctx(), 0) << "store->fetch_remote_obj() returned r=" << r
<< dendl
;
590 int RGWAsyncStatRemoteObj::_send_request()
592 RGWObjectCtx
obj_ctx(store
);
596 snprintf(buf
, sizeof(buf
), ".%lld", (long long)store
->instance_id());
597 string client_id
= store
->zone_id() + buf
;
598 string op_id
= store
->unique_id(store
->get_new_req_id());
600 rgw_obj
src_obj(bucket_info
.bucket
, key
);
602 rgw_obj
dest_obj(src_obj
);
604 int r
= store
->stat_remote_obj(obj_ctx
,
607 nullptr, /* req_info */
610 bucket_info
, /* source */
611 pmtime
, /* real_time* src_mtime, */
612 psize
, /* uint64_t * */
613 nullptr, /* const real_time* mod_ptr, */
614 nullptr, /* const real_time* unmod_ptr, */
615 true, /* high precision time */
616 nullptr, /* const char *if_match, */
617 nullptr, /* const char *if_nomatch, */
620 nullptr, /* string *ptag, */
621 nullptr); /* string *petag, */
624 ldout(store
->ctx(), 0) << "store->fetch_remote_obj() returned r=" << r
<< dendl
;
630 int RGWAsyncRemoveObj::_send_request()
632 RGWObjectCtx
obj_ctx(store
);
634 rgw_obj
obj(bucket_info
.bucket
, key
);
636 ldout(store
->ctx(), 0) << __func__
<< "(): deleting obj=" << obj
<< dendl
;
638 obj_ctx
.obj
.set_atomic(obj
);
642 int ret
= store
->get_obj_state(&obj_ctx
, bucket_info
, obj
, &state
);
644 ldout(store
->ctx(), 20) << __func__
<< "(): get_obj_state() obj=" << obj
<< " returned ret=" << ret
<< dendl
;
648 /* has there been any racing object write? */
649 if (del_if_older
&& (state
->mtime
> timestamp
)) {
650 ldout(store
->ctx(), 20) << __func__
<< "(): skipping object removal obj=" << obj
<< " (obj mtime=" << state
->mtime
<< ", request timestamp=" << timestamp
<< ")" << dendl
;
654 RGWAccessControlPolicy policy
;
657 map
<string
, bufferlist
>::iterator iter
= state
->attrset
.find(RGW_ATTR_ACL
);
658 if (iter
!= state
->attrset
.end()) {
659 bufferlist::iterator bliter
= iter
->second
.begin();
661 policy
.decode(bliter
);
662 } catch (buffer::error
& err
) {
663 ldout(store
->ctx(), 0) << "ERROR: could not decode policy, caught buffer::error" << dendl
;
668 RGWRados::Object
del_target(store
, bucket_info
, obj_ctx
, obj
);
669 RGWRados::Object::Delete
del_op(&del_target
);
671 del_op
.params
.bucket_owner
= bucket_info
.owner
;
672 del_op
.params
.obj_owner
= policy
.get_owner();
674 del_op
.params
.unmod_since
= timestamp
;
677 del_op
.params
.versioning_status
= BUCKET_VERSIONED
;
679 del_op
.params
.olh_epoch
= versioned_epoch
;
680 del_op
.params
.marker_version_id
= marker_version_id
;
681 del_op
.params
.obj_owner
.set_id(owner
);
682 del_op
.params
.obj_owner
.set_name(owner_display_name
);
683 del_op
.params
.mtime
= timestamp
;
684 del_op
.params
.high_precision_time
= true;
685 del_op
.params
.zones_trace
= zones_trace
;
687 ret
= del_op
.delete_obj();
689 ldout(store
->ctx(), 20) << __func__
<< "(): delete_obj() obj=" << obj
<< " returned ret=" << ret
<< dendl
;
694 int RGWContinuousLeaseCR::operate()
697 caller
->set_sleeping(false);
698 return set_cr_done();
701 while (!going_down
) {
702 yield
call(new RGWSimpleRadosLockCR(async_rados
, store
, obj
, lock_name
, cookie
, interval
));
704 caller
->set_sleeping(false); /* will only be relevant when we return, that's why we can do it early */
707 ldout(store
->ctx(), 20) << *this << ": couldn't lock " << obj
<< ":" << lock_name
<< ": retcode=" << retcode
<< dendl
;
708 return set_state(RGWCoroutine_Error
, retcode
);
711 yield
wait(utime_t(interval
/ 2, 0));
713 set_locked(false); /* moot at this point anyway */
714 yield
call(new RGWSimpleRadosUnlockCR(async_rados
, store
, obj
, lock_name
, cookie
));
715 return set_state(RGWCoroutine_Done
);
720 RGWRadosTimelogAddCR::RGWRadosTimelogAddCR(RGWRados
*_store
, const string
& _oid
,
721 const cls_log_entry
& entry
) : RGWSimpleCoroutine(_store
->ctx()),
725 stringstream
& s
= set_description();
726 s
<< "timelog add entry oid=" << oid
<< "entry={id=" << entry
.id
<< ", section=" << entry
.section
<< ", name=" << entry
.name
<< "}";
727 entries
.push_back(entry
);
730 int RGWRadosTimelogAddCR::send_request()
732 set_status() << "sending request";
734 cn
= stack
->create_completion_notifier();
735 return store
->time_log_add(oid
, entries
, cn
->completion(), true);
738 int RGWRadosTimelogAddCR::request_complete()
740 int r
= cn
->completion()->get_return_value();
742 set_status() << "request complete; ret=" << r
;
747 RGWRadosTimelogTrimCR::RGWRadosTimelogTrimCR(RGWRados
*store
,
748 const std::string
& oid
,
749 const real_time
& start_time
,
750 const real_time
& end_time
,
751 const std::string
& from_marker
,
752 const std::string
& to_marker
)
753 : RGWSimpleCoroutine(store
->ctx()), store(store
), oid(oid
),
754 start_time(start_time
), end_time(end_time
),
755 from_marker(from_marker
), to_marker(to_marker
)
757 set_description() << "timelog trim oid=" << oid
758 << " start_time=" << start_time
<< " end_time=" << end_time
759 << " from_marker=" << from_marker
<< " to_marker=" << to_marker
;
762 int RGWRadosTimelogTrimCR::send_request()
764 set_status() << "sending request";
766 cn
= stack
->create_completion_notifier();
767 return store
->time_log_trim(oid
, start_time
, end_time
, from_marker
,
768 to_marker
, cn
->completion());
771 int RGWRadosTimelogTrimCR::request_complete()
773 int r
= cn
->completion()->get_return_value();
775 set_status() << "request complete; ret=" << r
;
781 RGWSyncLogTrimCR::RGWSyncLogTrimCR(RGWRados
*store
, const std::string
& oid
,
782 const std::string
& to_marker
,
783 std::string
*last_trim_marker
)
784 : RGWRadosTimelogTrimCR(store
, oid
, real_time
{}, real_time
{},
785 std::string
{}, to_marker
),
786 cct(store
->ctx()), last_trim_marker(last_trim_marker
)
790 int RGWSyncLogTrimCR::request_complete()
792 int r
= RGWRadosTimelogTrimCR::request_complete();
793 if (r
< 0 && r
!= -ENODATA
) {
796 if (*last_trim_marker
< to_marker
) {
797 *last_trim_marker
= to_marker
;
803 int RGWAsyncStatObj::_send_request()
806 store
->obj_to_raw(bucket_info
.placement_rule
, obj
, &raw_obj
);
807 return store
->raw_obj_stat(raw_obj
, psize
, pmtime
, pepoch
,
808 nullptr, nullptr, objv_tracker
);
811 RGWStatObjCR::RGWStatObjCR(RGWAsyncRadosProcessor
*async_rados
, RGWRados
*store
,
812 const RGWBucketInfo
& _bucket_info
, const rgw_obj
& obj
, uint64_t *psize
,
813 real_time
* pmtime
, uint64_t *pepoch
,
814 RGWObjVersionTracker
*objv_tracker
)
815 : RGWSimpleCoroutine(store
->ctx()), store(store
), async_rados(async_rados
),
816 bucket_info(_bucket_info
), obj(obj
), psize(psize
), pmtime(pmtime
), pepoch(pepoch
),
817 objv_tracker(objv_tracker
)
821 void RGWStatObjCR::request_cleanup()
829 int RGWStatObjCR::send_request()
831 req
= new RGWAsyncStatObj(this, stack
->create_completion_notifier(),
832 store
, bucket_info
, obj
, psize
, pmtime
, pepoch
, objv_tracker
);
833 async_rados
->queue(req
);
837 int RGWStatObjCR::request_complete()
839 return req
->get_ret_status();
842 RGWRadosNotifyCR::RGWRadosNotifyCR(RGWRados
*store
, const rgw_raw_obj
& obj
,
843 bufferlist
& request
, uint64_t timeout_ms
,
844 bufferlist
*response
)
845 : RGWSimpleCoroutine(store
->ctx()), store(store
), obj(obj
),
846 request(request
), timeout_ms(timeout_ms
), response(response
)
848 set_description() << "notify dest=" << obj
;
851 int RGWRadosNotifyCR::send_request()
853 int r
= store
->get_raw_obj_ref(obj
, &ref
);
855 lderr(store
->ctx()) << "ERROR: failed to get ref for (" << obj
<< ") ret=" << r
<< dendl
;
859 set_status() << "sending request";
861 cn
= stack
->create_completion_notifier();
862 return ref
.ioctx
.aio_notify(ref
.oid
, cn
->completion(), request
,
863 timeout_ms
, response
);
866 int RGWRadosNotifyCR::request_complete()
868 int r
= cn
->completion()->get_return_value();
870 set_status() << "request complete; ret=" << r
;