@@ -21,67 +21,6 @@ using namespace librados;
2121const string BucketIndexShardsManager::KEY_VALUE_SEPARATOR = " #" ;
2222const string BucketIndexShardsManager::SHARDS_SEPARATOR = " ," ;
2323
24-
25- int CLSRGWConcurrentIO::operator ()() {
26- int ret = 0 ;
27- iter = objs_container.begin ();
28- for (; iter != objs_container.end () && max_aio-- > 0 ; ++iter) {
29- ret = issue_op (iter->first , iter->second );
30- if (ret < 0 )
31- break ;
32- }
33-
34- int num_completions = 0 , r = 0 ;
35- std::map<int , std::string> completed_objs;
36- std::map<int , std::string> retry_objs;
37- while (manager.wait_for_completions (valid_ret_code (), &num_completions, &r,
38- need_multiple_rounds () ? &completed_objs : nullptr ,
39- !need_multiple_rounds () ? &retry_objs : nullptr )) {
40- if (r >= 0 && ret >= 0 ) {
41- for (; num_completions && iter != objs_container.end (); --num_completions, ++iter) {
42- int issue_ret = issue_op (iter->first , iter->second );
43- if (issue_ret < 0 ) {
44- ret = issue_ret;
45- break ;
46- }
47- }
48- } else if (ret >= 0 ) {
49- ret = r;
50- }
51-
52- // if we're at the end with this round, see if another round is needed
53- if (iter == objs_container.end ()) {
54- if (need_multiple_rounds () && !completed_objs.empty ()) {
55- // For those objects which need another round, use them to reset
56- // the container
57- reset_container (completed_objs);
58- iter = objs_container.begin ();
59- } else if (! need_multiple_rounds () && !retry_objs.empty ()) {
60- reset_container (retry_objs);
61- iter = objs_container.begin ();
62- }
63-
64- // re-issue ops if container was reset above (i.e., iter !=
65- // objs_container.end()); if it was not reset above (i.e., iter
66- // == objs_container.end()) the loop will exit immediately
67- // without iterating
68- for (; num_completions && iter != objs_container.end (); --num_completions, ++iter) {
69- int issue_ret = issue_op (iter->first , iter->second );
70- if (issue_ret < 0 ) {
71- ret = issue_ret;
72- break ;
73- }
74- }
75- }
76- }
77-
78- if (ret < 0 ) {
79- cleanup ();
80- }
81- return ret;
82- } // CLSRGWConcurrentIO::operator()()
83-
84-
8524/* *
8625 * This class represents the bucket index object operation callback context.
8726 */
@@ -192,44 +131,12 @@ void cls_rgw_bucket_init_index(ObjectWriteOperation& o)
192131 o.exec (RGW_CLASS, RGW_BUCKET_INIT_INDEX, in);
193132}
194133
195- static bool issue_bucket_index_init_op (librados::IoCtx& io_ctx,
196- const int shard_id,
197- const string& oid,
198- BucketIndexAioManager *manager) {
199- bufferlist in;
200- librados::ObjectWriteOperation op;
201- op.create (true );
202- cls_rgw_bucket_init_index (op);
203- return manager->aio_operate (io_ctx, shard_id, oid, &op);
204- }
205-
206134void cls_rgw_bucket_init_index2 (ObjectWriteOperation& o)
207135{
208136 bufferlist in;
209137 o.exec (RGW_CLASS, RGW_BUCKET_INIT_INDEX2, in);
210138}
211139
212- static bool issue_bucket_index_init_op2 (librados::IoCtx& io_ctx,
213- const int shard_id,
214- const string& oid,
215- BucketIndexAioManager *manager) {
216- bufferlist in;
217- librados::ObjectWriteOperation op;
218- op.create (true );
219- cls_rgw_bucket_init_index2 (op);
220- return manager->aio_operate (io_ctx, shard_id, oid, &op);
221- }
222-
223- static bool issue_bucket_index_clean_op (librados::IoCtx& io_ctx,
224- const int shard_id,
225- const string& oid,
226- BucketIndexAioManager *manager) {
227- bufferlist in;
228- librados::ObjectWriteOperation op;
229- op.remove ();
230- return manager->aio_operate (io_ctx, shard_id, oid, &op);
231- }
232-
233140void cls_rgw_bucket_set_tag_timeout (librados::ObjectWriteOperation& op,
234141 uint64_t timeout)
235142{
@@ -239,52 +146,6 @@ void cls_rgw_bucket_set_tag_timeout(librados::ObjectWriteOperation& op,
239146 op.exec (RGW_CLASS, RGW_BUCKET_SET_TAG_TIMEOUT, in);
240147}
241148
242- static bool issue_bucket_set_tag_timeout_op (librados::IoCtx& io_ctx,
243- const int shard_id,
244- const string& oid,
245- uint64_t timeout,
246- BucketIndexAioManager *manager) {
247- ObjectWriteOperation op;
248- cls_rgw_bucket_set_tag_timeout (op, timeout);
249- return manager->aio_operate (io_ctx, shard_id, oid, &op);
250- }
251-
252- int CLSRGWIssueBucketIndexInit::issue_op (const int shard_id, const string& oid)
253- {
254- return issue_bucket_index_init_op (io_ctx, shard_id, oid, &manager);
255- }
256-
257- int CLSRGWIssueBucketIndexInit2::issue_op (const int shard_id, const string& oid)
258- {
259- return issue_bucket_index_init_op2 (io_ctx, shard_id, oid, &manager);
260- }
261-
262- void CLSRGWIssueBucketIndexInit::cleanup ()
263- {
264- // Do best effort removal
265- for (auto citer = objs_container.begin (); citer != iter; ++citer) {
266- io_ctx.remove (citer->second );
267- }
268- }
269-
270- void CLSRGWIssueBucketIndexInit2::cleanup ()
271- {
272- // Do best effort removal
273- for (auto citer = objs_container.begin (); citer != iter; ++citer) {
274- io_ctx.remove (citer->second );
275- }
276- }
277-
278- int CLSRGWIssueBucketIndexClean::issue_op (const int shard_id, const string& oid)
279- {
280- return issue_bucket_index_clean_op (io_ctx, shard_id, oid, &manager);
281- }
282-
283- int CLSRGWIssueSetTagTimeout::issue_op (const int shard_id, const string& oid)
284- {
285- return issue_bucket_set_tag_timeout_op (io_ctx, shard_id, oid, tag_timeout, &manager);
286- }
287-
288149void cls_rgw_bucket_update_stats (librados::ObjectWriteOperation& o,
289150 bool absolute,
290151 const map<RGWObjCategory, rgw_bucket_category_stats>& stats,
@@ -363,54 +224,6 @@ void cls_rgw_bucket_list_op(librados::ObjectReadOperation& op,
363224 new ClsBucketIndexOpCtx<rgw_cls_list_ret>(result, NULL ));
364225}
365226
366- static bool issue_bucket_list_op (librados::IoCtx& io_ctx,
367- const int shard_id,
368- const std::string& oid,
369- const cls_rgw_obj_key& start_obj,
370- const std::string& filter_prefix,
371- const std::string& delimiter,
372- uint32_t num_entries,
373- bool list_versions,
374- BucketIndexAioManager *manager,
375- rgw_cls_list_ret *pdata)
376- {
377- librados::ObjectReadOperation op;
378- cls_rgw_bucket_list_op (op,
379- start_obj, filter_prefix, delimiter,
380- num_entries, list_versions, pdata);
381- return manager->aio_operate (io_ctx, shard_id, oid, &op);
382- }
383-
384- int CLSRGWIssueBucketList::issue_op (const int shard_id, const string& oid)
385- {
386- // set the marker depending on whether we've already queried this
387- // shard and gotten a RGWBIAdvanceAndRetryError (defined
388- // constant) return value; if we have use the marker in the return
389- // to advance the search, otherwise use the marker passed in by the
390- // caller
391- cls_rgw_obj_key marker;
392- auto iter = result.find (shard_id);
393- if (iter != result.end ()) {
394- marker = iter->second .marker ;
395- } else {
396- marker = start_obj;
397- }
398-
399- return issue_bucket_list_op (io_ctx, shard_id, oid,
400- marker, filter_prefix, delimiter,
401- num_entries, list_versions, &manager,
402- &result[shard_id]);
403- }
404-
405-
406- void CLSRGWIssueBucketList::reset_container (std::map<int , std::string>& objs)
407- {
408- objs_container.swap (objs);
409- iter = objs_container.begin ();
410- objs.clear ();
411- }
412-
413-
414227void cls_rgw_remove_obj (librados::ObjectWriteOperation& o, list<string>& keep_attr_prefixes)
415228{
416229 bufferlist in;
@@ -687,21 +500,6 @@ void cls_rgw_bilog_list(librados::ObjectReadOperation& op,
687500 op.exec (RGW_CLASS, RGW_BI_LOG_LIST, in, new ClsBucketIndexOpCtx<cls_rgw_bi_log_list_ret>(pdata, ret));
688501}
689502
690- static bool issue_bi_log_list_op (librados::IoCtx& io_ctx, const string& oid, const int shard_id,
691- BucketIndexShardsManager& marker_mgr, uint32_t max,
692- BucketIndexAioManager *manager,
693- cls_rgw_bi_log_list_ret *pdata)
694- {
695- librados::ObjectReadOperation op;
696- cls_rgw_bilog_list (op, marker_mgr.get (shard_id, " " ), max, pdata, nullptr );
697- return manager->aio_operate (io_ctx, shard_id, oid, &op);
698- }
699-
700- int CLSRGWIssueBILogList::issue_op (const int shard_id, const string& oid)
701- {
702- return issue_bi_log_list_op (io_ctx, oid, shard_id, marker_mgr, max, &manager, &result[shard_id]);
703- }
704-
705503void cls_rgw_bilog_trim (librados::ObjectWriteOperation& op,
706504 const std::string& start_marker,
707505 const std::string& end_marker)
@@ -715,39 +513,12 @@ void cls_rgw_bilog_trim(librados::ObjectWriteOperation& op,
715513 op.exec (RGW_CLASS, RGW_BI_LOG_TRIM, in);
716514}
717515
718- static bool issue_bi_log_trim (librados::IoCtx& io_ctx, const string& oid, const int shard_id,
719- BucketIndexShardsManager& start_marker_mgr,
720- BucketIndexShardsManager& end_marker_mgr, BucketIndexAioManager *manager) {
721- cls_rgw_bi_log_trim_op call;
722- librados::ObjectWriteOperation op;
723- cls_rgw_bilog_trim (op, start_marker_mgr.get (shard_id, " " ),
724- end_marker_mgr.get (shard_id, " " ));
725- return manager->aio_operate (io_ctx, shard_id, oid, &op);
726- }
727-
728- int CLSRGWIssueBILogTrim::issue_op (const int shard_id, const string& oid)
729- {
730- return issue_bi_log_trim (io_ctx, oid, shard_id, start_marker_mgr, end_marker_mgr, &manager);
731- }
732-
733516void cls_rgw_bucket_reshard_log_trim (librados::ObjectWriteOperation& op)
734517{
735518 bufferlist in;
736519 op.exec (RGW_CLASS, RGW_RESHARD_LOG_TRIM, in);
737520}
738521
739- static bool issue_reshard_log_trim (librados::IoCtx& io_ctx, const string& oid, int shard_id,
740- BucketIndexAioManager *manager) {
741- ObjectWriteOperation op;
742- cls_rgw_bucket_reshard_log_trim (op);
743- return manager->aio_operate (io_ctx, shard_id, oid, &op);
744- }
745-
746- int CLSRGWIssueReshardLogTrim::issue_op (int shard_id, const string& oid)
747- {
748- return issue_reshard_log_trim (io_ctx, oid, shard_id, &manager);
749- }
750-
751522void cls_rgw_bucket_check_index (librados::ObjectReadOperation& op,
752523 bufferlist& out)
753524{
@@ -762,38 +533,12 @@ void cls_rgw_bucket_check_index_decode(const bufferlist& out,
762533 decode (result, p);
763534}
764535
765- static bool issue_bucket_check_index_op (IoCtx& io_ctx, const int shard_id, const string& oid, BucketIndexAioManager *manager,
766- rgw_cls_check_index_ret *pdata) {
767- bufferlist in;
768- librados::ObjectReadOperation op;
769- op.exec (RGW_CLASS, RGW_BUCKET_CHECK_INDEX, in, new ClsBucketIndexOpCtx<rgw_cls_check_index_ret>(
770- pdata, NULL ));
771- return manager->aio_operate (io_ctx, shard_id, oid, &op);
772- }
773-
774- int CLSRGWIssueBucketCheck::issue_op (int shard_id, const string& oid)
775- {
776- return issue_bucket_check_index_op (io_ctx, shard_id, oid, &manager, &result[shard_id]);
777- }
778-
779536void cls_rgw_bucket_rebuild_index (librados::ObjectWriteOperation& op)
780537{
781538 bufferlist in;
782539 op.exec (RGW_CLASS, RGW_BUCKET_REBUILD_INDEX, in);
783540}
784541
785- static bool issue_bucket_rebuild_index_op (IoCtx& io_ctx, const int shard_id, const string& oid,
786- BucketIndexAioManager *manager) {
787- librados::ObjectWriteOperation op;
788- cls_rgw_bucket_rebuild_index (op);
789- return manager->aio_operate (io_ctx, shard_id, oid, &op);
790- }
791-
792- int CLSRGWIssueBucketRebuild::issue_op (const int shard_id, const string& oid)
793- {
794- return issue_bucket_rebuild_index_op (io_ctx, shard_id, oid, &manager);
795- }
796-
797542void cls_rgw_encode_suggestion (char op, rgw_bucket_dir_entry& dirent, bufferlist& updates)
798543{
799544 updates.append (op);
@@ -805,52 +550,18 @@ void cls_rgw_suggest_changes(ObjectWriteOperation& o, bufferlist& updates)
805550 o.exec (RGW_CLASS, RGW_DIR_SUGGEST_CHANGES, updates);
806551}
807552
808- int CLSRGWIssueGetDirHeader::issue_op (const int shard_id, const string& oid)
809- {
810- cls_rgw_obj_key empty_key;
811- string empty_prefix;
812- string empty_delimiter;
813- return issue_bucket_list_op (io_ctx, shard_id, oid,
814- empty_key, empty_prefix, empty_delimiter,
815- 0 , false , &manager, &result[shard_id]);
816- }
817-
818553void cls_rgw_bilog_start (ObjectWriteOperation& op)
819554{
820555 bufferlist in;
821556 op.exec (RGW_CLASS, RGW_BI_LOG_RESYNC, in);
822557}
823558
824- static bool issue_resync_bi_log (librados::IoCtx& io_ctx, const int shard_id, const string& oid, BucketIndexAioManager *manager)
825- {
826- librados::ObjectWriteOperation op;
827- cls_rgw_bilog_start (op);
828- return manager->aio_operate (io_ctx, shard_id, oid, &op);
829- }
830-
831- int CLSRGWIssueResyncBucketBILog::issue_op (const int shard_id, const string& oid)
832- {
833- return issue_resync_bi_log (io_ctx, shard_id, oid, &manager);
834- }
835-
836559void cls_rgw_bilog_stop (ObjectWriteOperation& op)
837560{
838561 bufferlist in;
839562 op.exec (RGW_CLASS, RGW_BI_LOG_STOP, in);
840563}
841564
842- static bool issue_bi_log_stop (librados::IoCtx& io_ctx, const int shard_id, const string& oid, BucketIndexAioManager *manager)
843- {
844- librados::ObjectWriteOperation op;
845- cls_rgw_bilog_stop (op);
846- return manager->aio_operate (io_ctx, shard_id, oid, &op);
847- }
848-
849- int CLSRGWIssueBucketBILogStop::issue_op (const int shard_id, const string& oid)
850- {
851- return issue_bi_log_stop (io_ctx, shard_id, oid, &manager);
852- }
853-
854565class GetDirHeaderCompletion : public ObjectOperationCompletion {
855566 boost::intrusive_ptr<RGWGetDirHeader_CB> cb;
856567public:
@@ -1300,18 +1011,3 @@ void cls_rgw_set_bucket_resharding(librados::ObjectWriteOperation& op,
13001011 op.assert_exists (); // the shard must exist; if not fail rather than recreate
13011012 op.exec (RGW_CLASS, RGW_SET_BUCKET_RESHARDING, in);
13021013}
1303-
1304- static bool issue_set_bucket_resharding (librados::IoCtx& io_ctx,
1305- const int shard_id, const string& oid,
1306- const cls_rgw_bucket_instance_entry& entry,
1307- BucketIndexAioManager *manager) {
1308- librados::ObjectWriteOperation op;
1309- cls_rgw_set_bucket_resharding (op, entry.reshard_status );
1310- return manager->aio_operate (io_ctx, shard_id, oid, &op);
1311- }
1312-
1313- int CLSRGWIssueSetBucketResharding::issue_op (const int shard_id, const string& oid)
1314- {
1315- return issue_set_bucket_resharding (io_ctx, shard_id, oid, entry, &manager);
1316- }
1317-
0 commit comments