cerr << " bucket rm remove bucket\n";
cerr << " bucket check check bucket index\n";
cerr << " object rm remove object\n";
+ cerr << " object unlink unlink object from bucket index\n";
cerr << " cluster info show cluster params info\n";
cerr << " pool add add an existing pool for data placement\n";
cerr << " pool rm remove an existing pool from data placement set\n";
OPT_USAGE_TRIM,
OPT_TEMP_REMOVE,
OPT_OBJECT_RM,
+ OPT_OBJECT_UNLINK,
OPT_GC_LIST,
OPT_GC_PROCESS,
OPT_CLUSTER_INFO,
strcmp(cmd, "key") == 0 ||
strcmp(cmd, "buckets") == 0 ||
strcmp(cmd, "bucket") == 0 ||
+ strcmp(cmd, "object") == 0 ||
strcmp(cmd, "pool") == 0 ||
strcmp(cmd, "pools") == 0 ||
strcmp(cmd, "log") == 0 ||
} else if (strcmp(prev_cmd, "object") == 0) {
if (strcmp(cmd, "rm") == 0)
return OPT_OBJECT_RM;
+ if (strcmp(cmd, "unlink") == 0)
+ return OPT_OBJECT_UNLINK;
} else if (strcmp(prev_cmd, "cluster") == 0) {
if (strcmp(cmd, "info") == 0)
return OPT_CLUSTER_INFO;
}
}
+ if (opt_cmd == OPT_OBJECT_UNLINK) {
+ int ret = store->remove_obj_from_index(bucket, object);
+ if (ret < 0) {
+ cerr << "ERROR: remove_obj_from_index() returned error: " << cpp_strerror(-ret) << std::endl;
+ return 1;
+ }
+ }
+
if (opt_cmd == OPT_BUCKET_CHECK) {
map<RGWObjCategory, RGWBucketStats> existing_stats;
map<RGWObjCategory, RGWBucketStats> calculated_stats;
store->params.dump(formatter);
formatter->flush(cout);
}
+
return 0;
}
return r;
}
+int RGWRados::remove_obj_from_index(rgw_bucket& bucket, const string& oid)
+{
+ librados::IoCtx io_ctx;
+
+ int r = open_bucket_ctx(bucket, io_ctx);
+ if (r < 0)
+ return r;
+
+ string dir_oid = dir_oid_prefix;
+ dir_oid.append(bucket.marker);
+
+ rgw_bucket_dir_entry entry;
+ entry.epoch = (uint64_t)-1; // ULLONG_MAX, needed to that objclass doesn't skip out request
+ entry.name = oid;
+
+ bufferlist updates;
+ updates.append(CEPH_RGW_REMOVE);
+ ::encode(entry, updates);
+
+ bufferlist out;
+
+ r = io_ctx.exec(dir_oid, "rgw", "dir_suggest_changes", updates, out);
+
+ return r;
+}
+
int RGWRados::check_disk_state(librados::IoCtx io_ctx,
rgw_bucket& bucket,
rgw_bucket_dir_entry& list_state,
map<RGWObjCategory, RGWBucketStats> *existing_stats,
map<RGWObjCategory, RGWBucketStats> *calculated_stats);
int bucket_rebuild_index(rgw_bucket& bucket);
+ int remove_obj_from_index(rgw_bucket& bucket, const string& oid);
+
private:
int process_intent_log(rgw_bucket& bucket, string& oid,
time_t epoch, int flags, bool purge);