diff options
author | Yehuda Sadeh <yehuda@inktank.com> | 2013-05-01 18:10:54 -0700 |
---|---|---|
committer | Yehuda Sadeh <yehuda@inktank.com> | 2013-05-08 11:22:08 -0700 |
commit | 39b258c2d823a6478f8d4fcc541cc0081fd2c6e6 (patch) | |
tree | 4010104f605a8195b1437ed26952055307444608 | |
parent | d5da15259b37b7729d080133656d9c411d248017 (diff) | |
download | ceph-39b258c2d823a6478f8d4fcc541cc0081fd2c6e6.tar.gz |
rgw: limit num of buckets in data changes log
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
-rw-r--r-- | src/rgw/rgw_bucket.cc | 6 | ||||
-rw-r--r-- | src/rgw/rgw_bucket.h | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/rgw/rgw_bucket.cc b/src/rgw/rgw_bucket.cc index 646176e1147..b256ceb93f4 100644 --- a/src/rgw/rgw_bucket.cc +++ b/src/rgw/rgw_bucket.cc @@ -1057,9 +1057,11 @@ int RGWDataChangesLog::choose_oid(rgw_bucket& bucket) { int RGWDataChangesLog::add_entry(rgw_bucket& bucket) { lock.Lock(); - ChangeStatusPtr& status = changes[bucket.name]; - if (!status) { + + ChangeStatusPtr status; + if (!changes.find(bucket.name, status)) { status = ChangeStatusPtr(new ChangeStatus); + changes.add(bucket.name, status); } lock.Unlock(); diff --git a/src/rgw/rgw_bucket.h b/src/rgw/rgw_bucket.h index b8492b54a3d..ff4992a8455 100644 --- a/src/rgw/rgw_bucket.h +++ b/src/rgw/rgw_bucket.h @@ -13,6 +13,7 @@ #include "rgw_string.h" #include "common/Formatter.h" +#include "common/lru_map.h" #include "rgw_formats.h" @@ -277,11 +278,12 @@ class RGWDataChangesLog { typedef std::tr1::shared_ptr<ChangeStatus> ChangeStatusPtr; - map<string, ChangeStatusPtr> changes; + lru_map<string, ChangeStatusPtr> changes; public: - RGWDataChangesLog(CephContext *_cct, RGWRados *_store) : cct(_cct), store(_store), lock("RGWDataChangesLog") { + RGWDataChangesLog(CephContext *_cct, RGWRados *_store) : cct(_cct), store(_store), lock("RGWDataChangesLog"), + changes(1000) /* FIXME */ { num_shards = 128; /* FIXME */ oids = new string[num_shards]; |