Skip to content

Commit 7d95818

Browse files
authored
Merge pull request ceph#63268 from yuvalif/wip-yuval-71312
rgw/logging: part upload operation name should be REST.PUT.PART
2 parents 0376502 + 8dbe711 commit 7d95818

File tree

5 files changed

+26
-5
lines changed

5 files changed

+26
-5
lines changed

src/rgw/rgw_bucket_logging.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -627,8 +627,8 @@ int log_record(rgw::sal::Driver* driver,
627627
bool async_completion,
628628
bool log_source_bucket) {
629629
if (!s->bucket) {
630-
// logging only bucket operations
631-
return 0;
630+
ldpp_dout(dpp, 1) << "ERROR: only bucket operations are logged in bucket logging" << dendl;
631+
return -EINVAL;
632632
}
633633
// check if bucket logging is needed
634634
const auto& bucket_attrs = s->bucket->get_attrs();

src/rgw/rgw_op.cc

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4797,8 +4797,23 @@ void RGWPutObj::execute(optional_yield y)
47974797
return;
47984798
}
47994799

4800+
auto ret = rgw::bucketlogging::log_record(driver,
4801+
rgw::bucketlogging::LoggingType::Standard,
4802+
s->object.get(),
4803+
s,
4804+
(multipart ? "REST.PUT.PART" : canonical_name()),
4805+
etag,
4806+
s->object->get_size(),
4807+
this,
4808+
y,
4809+
true,
4810+
false);
4811+
if (ret < 0) {
4812+
ldpp_dout(this, 5) << "WARNING: in Standard mode, put object operation ignores bucket logging failure: " << ret << dendl;
4813+
}
4814+
48004815
// send request to notification manager
4801-
int ret = res->publish_commit(this, s->obj_size, mtime, etag, s->object->get_instance());
4816+
ret = res->publish_commit(this, s->obj_size, mtime, etag, s->object->get_instance());
48024817
if (ret < 0) {
48034818
ldpp_dout(this, 1) << "ERROR: publishing notification failed, with error: " << ret << dendl;
48044819
// too late to rollback operation, hence op_ret is not set here

src/rgw/rgw_op.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,8 @@ class RGWOp : public DoutPrefixProvider {
309309
virtual const char* name() const = 0;
310310
virtual RGWOpType get_type() { return RGW_OP_UNKNOWN; }
311311
virtual std::string canonical_name() const { return fmt::format("REST.{}.{}", s->info.method, name()); }
312+
// by default we log all bucket operations
313+
virtual bool always_do_bucket_logging() const { return s->bucket != nullptr; }
312314

313315
virtual uint32_t op_mask() { return 0; }
314316

@@ -1327,6 +1329,7 @@ class RGWPutObj : public RGWOp {
13271329
RGWOpType get_type() override { return RGW_OP_PUT_OBJ; }
13281330
uint32_t op_mask() override { return RGW_OP_TYPE_WRITE; }
13291331
dmc::client_id dmclock_client() override { return dmc::client_id::data; }
1332+
bool always_do_bucket_logging() const override { return false; }
13301333
};
13311334

13321335
class RGWPostObj : public RGWOp {

src/rgw/rgw_process.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ int process_request(const RGWProcessEnv& penv,
466466
rgw_log_op(rest, s, op, penv.olog.get());
467467
}
468468

469-
if (op) {
469+
if (op && op->always_do_bucket_logging()) {
470470
std::ignore = rgw::bucketlogging::log_record(driver,
471471
rgw::bucketlogging::LoggingType::Standard,
472472
s->object.get(),

src/rgw/rgw_rest.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,10 @@ class RGWPutObj_ObjStore : public RGWPutObj
248248
int get_params(optional_yield y) override;
249249
int get_data(bufferlist& bl) override;
250250

251-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.OBJECT", s->info.method); }
251+
virtual std::string canonical_name() const override {
252+
const bool multipart = !multipart_upload_id.empty();
253+
return fmt::format("REST.{}.{}", s->info.method, multipart ? "PART" : "OBJECT");
254+
}
252255
};
253256

254257
class RGWPostObj_ObjStore : public RGWPostObj

0 commit comments

Comments
 (0)