Merge pull request #43428 from cfsnyder/wip-52818-random-rgw-req-id

rgw/rgw_rados: make RGW request IDs non-deterministic

Reviewed-by: Matt Benjamin <mbenjami@redhat.com>
Reviewed-by: Adam C. Emerson <aemerson@redhat.com>
This commit is contained in:
Casey Bodley 2021-10-15 14:03:37 -04:00 committed by GitHub
commit fff75ecc01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,6 +9,7 @@
#include "include/rados/librados.hpp" #include "include/rados/librados.hpp"
#include "include/Context.h" #include "include/Context.h"
#include "include/random.h"
#include "common/RefCountedObj.h" #include "common/RefCountedObj.h"
#include "common/ceph_time.h" #include "common/ceph_time.h"
#include "common/Timer.h" #include "common/Timer.h"
@ -356,7 +357,7 @@ class RGWRados
int open_pool_ctx(const DoutPrefixProvider *dpp, const rgw_pool& pool, librados::IoCtx& io_ctx, int open_pool_ctx(const DoutPrefixProvider *dpp, const rgw_pool& pool, librados::IoCtx& io_ctx,
bool mostly_omap); bool mostly_omap);
std::atomic<int64_t> max_req_id = { 0 };
ceph::mutex lock = ceph::make_mutex("rados_timer_lock"); ceph::mutex lock = ceph::make_mutex("rados_timer_lock");
SafeTimer *timer; SafeTimer *timer;
@ -507,7 +508,7 @@ public:
} }
uint64_t get_new_req_id() { uint64_t get_new_req_id() {
return ++max_req_id; return ceph::util::generate_random_number<uint64_t>();
} }
librados::IoCtx* get_lc_pool_ctx() { librados::IoCtx* get_lc_pool_ctx() {