diff options
author | Yehuda Sadeh <yehuda@inktank.com> | 2013-05-01 18:10:54 -0700 |
---|---|---|
committer | Yehuda Sadeh <yehuda@inktank.com> | 2013-05-01 18:10:54 -0700 |
commit | e15b3639589edf82ceced597f4d71940a28825b1 (patch) | |
tree | 6d95eb12b70fb185e2f174ed94e7ba76fe913bdb | |
parent | cdff01d6c47d9a235d7866d9e69698333174738f (diff) | |
download | ceph-e15b3639589edf82ceced597f4d71940a28825b1.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 da47fa76a3e..ac2367dce00 100644 --- a/src/rgw/rgw_bucket.cc +++ b/src/rgw/rgw_bucket.cc @@ -1096,9 +1096,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 7a715459d3d..95b10a1c34d 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" @@ -280,11 +281,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]; |