From 8f45d92985b87b7b0c32f92f8e4c6adf34acd069 Mon Sep 17 00:00:00 2001 From: Sumedh Anantrao Kulkarni Date: Mon, 12 Sep 2022 22:42:07 -0600 Subject: [PATCH] rgw_sal_motr: [CORTX-32697] support user remove with purge data Problem: During Remove User code-flow till the DeleteOp is instantiated for each obj from a bucket, we don't have the access to req_state ptr via RGWObjectCtx. This causes the addb.set_id(rctx) to fail, as it tries to access the req_id from null req_state ptr. Solution: To avoid the situation, guarded the addb.set_id() call by checking if we have the req_state ptr accesible and generated the unique req_id per delete obj request. Signed-off-by: Sumedh Anantrao Kulkarni --- src/rgw/rgw_sal_motr.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/rgw/rgw_sal_motr.cc b/src/rgw/rgw_sal_motr.cc index 16d8b2ae526e3..285a09b7bca5e 100644 --- a/src/rgw/rgw_sal_motr.cc +++ b/src/rgw/rgw_sal_motr.cc @@ -2071,7 +2071,17 @@ MotrObject::MotrDeleteOp::MotrDeleteOp(MotrObject *_source, RGWObjectCtx *_rctx) source(_source), rctx(_rctx) { - addb_logger.set_id(rctx); + // - In case of the operation remove_user with --purge-data, we don't + // have access to the `req_state* s` via `RGWObjectCtx* rctx`. + // - In this case, we are generating a new req_id per obj deletion operation. + // This will retrict us from traking all delete req per user_remove req in ADDB + // untill we make changes to access req_state without using RGWObjectCtx ptr. + + if (rctx->get_private()) { + addb_logger.set_id(rctx); + } else { + addb_logger.set_id(_source->store->get_new_req_id()); + } } // Implementation of DELETE OBJ also requires MotrObject::get_obj_state()