From: Yehuda Sadeh Date: Thu, 2 May 2013 01:10:54 +0000 (-0700) Subject: rgw: limit num of buckets in data changes log X-Git-Tag: v0.67-rc1~128^2~145 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=39b258c2d823a6478f8d4fcc541cc0081fd2c6e6;p=ceph.git rgw: limit num of buckets in data changes log Signed-off-by: Yehuda Sadeh --- 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 ChangeStatusPtr; - map changes; + lru_map 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];