From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on sa.int.altlinux.org X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.4 Date: Mon, 8 Sep 2008 17:40:47 +0400 From: Alexey Morsov To: ALT Devel discussion list Message-ID: <20080908134047.GC28253@ricom.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="/unnNtmY43mpUSKx" Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-29) X-Virus-Scanned: by amavisd-new at ricom.ru Subject: [devel] patch for libmemcache X-BeenThere: devel@lists.altlinux.org X-Mailman-Version: 2.1.10b3 Precedence: list Reply-To: ALT Linux Team development discussions List-Id: ALT Linux Team development discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Sep 2008 13:41:01 -0000 Archived-At: List-Archive: List-Post: --/unnNtmY43mpUSKx Content-Type: multipart/mixed; boundary="ALfTUftag+2gvp1h" Content-Disposition: inline --ALfTUftag+2gvp1h Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable =D0=9F=D1=80=D0=B8=D0=B2=D0=B5=D1=82=D1=81=D1=82=D0=B2=D1=83=D1=8E. =D0=93=D0=BE=D1=81=D0=BF=D0=BE=D0=B4=D0=B0 =D0=B3=D1=83=D1=80=D1=83, =D1=85= =D0=BE=D1=82=D0=B5=D0=BB=D0=BE=D1=81=D1=8C =D0=B1=D1=8B =D1=87=D1=82=D0=BE = =D0=B1=D1=8B =D0=BF=D0=BE=D1=81=D0=BC=D0=BE=D1=82=D1=80=D0=B5=D0=BB=D0=B8 = =D0=B2=D1=8B =D0=BD=D0=B0 =D0=BF=D0=B0=D1=82=D1=87 =D0=BE=D0=B4=D0=B8=D0=BD= =D0=BA libmemcache. =D0=AF =D1=82=D1=83=D1=82 =D0=BE=D0=B7=D0=B0=D0=B4=D0=B0=D1=87=D0=B8=D0=B2= =D0=B0=D0=BB=D1=81=D1=8F (=D1=81=D0=BE=D0=B1=D0=B8=D1=80=D0=B0=D0=BB cmemca= che =D1=81=D0=B5=D0=B1=D0=B5 =D0=BD=D0=B0 ALS4) =D0=B8 =D1=82=D0=B0=D0=BC = =D0=BF=D1=80=D0=B5=D0=B4=D0=BB=D0=B0=D0=B3=D0=B0=D0=BB=D0=BE=D1=81=D1=8C =D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D0=B9 =D0=BF=D0=B0=D1=82=D1=87=D0=B8=D0=BA = =D0=BD=D0=B0 libmemcache =D1=81=D1=82=D0=B0=D0=B2=D0=B8=D1=82=D1=8C ) http://gijsbert.org/downloads/cmemcache/libmemcache-1.4.0.rc2.readme =D0=A3 =D0=BC=D0=B5=D0=BD=D1=8F =D0=BE=D0=BD=D0=BE =D0=B2=D1=80=D0=BE=D0=B4= =D0=B5 =D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=D0=B5=D1=82 (apache2+wsgi memca= ched django), =D0=BD=D0=BE =D1=81=D0=B0=D0=B9=D1=82 =D0=BD=D0=B5 =D1=80=D0= =B0=D0=B7=D1=83 =D0=BD=D0=B5 =D0=BD=D0=B0=D0=B3=D1=80=D1=83=D0=B6=D0=B5=D0=BD =D0=BF=D0=BE= =D1=82=D0=BE=D0=BC=D1=83 =D0=B8 =D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=B8= =D1=82=D1=8C =D1=82=D0=BE=D0=BB=D0=BA=D0=BE=D0=BC =D0=BD=D0=B5 =D0=BC=D0=BE= =D0=B3=D1=83 (=D0=BD=D1=83 ab2 =D1=87=D1=83=D1=82=D1=8C =D0=BD=D0=B0=D1=82= =D1=80=D0=B0=D0=B2=D0=B8=D0=BB =D0=B4=D0=B0 =D0=B8 =D0=B2=D1=81=D0=B5). --=20 WBR, Alexey Morsov =D0=BF=D1=80=D0=BE=D0=B3=D1=80=D0=B0=D0=BC=D0=BC=D0=B8=D1=81=D1=82 =D0=97= =D0=90=D0=9E "=D0=98=D0=9A "=D0=A0=D0=B8=D0=BA=D0=BE=D0=BC-=D0=A2=D1=80=D0= =B0=D1=81=D1=82" Jabber: samurai@www.fondmarket.ru ALT Linux Team Member [...] =D1=8F =D0=BD=D0=B5 =D0=B2=D0=B5=D1=80=D1=8E, =D1=87=D1=82=D0=BE =D1= =82=D0=B5, =D1=83 =D0=BA=D0=BE=D0=B3=D0=BE =D1=81=D0=B5=D1=80=D0=B2=D0=B5= =D1=80=D1=8B =D0=BD=D0=B0 Sisyphus, =D1=81=D0=B4=D0=B5=D0=BB=D0=B0=D0=BB=D0= =B8 =D1=8D=D1=82=D0=BE =D0=BD=D0=B5=D1=87=D0=B0=D1=8F=D0=BD=D0=BD=D0=BE. =D0= =98=D0=BD=D0=BE=D0=B3=D0=B4=D0=B0 =D1=8D=D1=82=D0=BE =D0=B2=D0=B7=D0=B2=D0= =B5=D1=88=D0=B5=D0=BD=D0=BD=D1=8B=D0=B9 =D0=B8 =D0=BE=D1=86=D0=B5=D0=BD=D0= =B5=D0=BD=D0=BD=D1=8B=D0=B9 =D1=80=D0=B8=D1=81=D0=BA. -- mike in devel@ --ALfTUftag+2gvp1h Content-Type: text/plain; charset=utf-8; name="libmemcached.patch" Content-Disposition: attachment; filename="libmemcached.patch" Content-Transfer-Encoding: quoted-printable diff --git a/libmemcache/src/memcache.c b/libmemcache/src/memcache.c index 227758d..b927b40 100644 --- a/libmemcache/src/memcache.c +++ b/libmemcache/src/memcache.c @@ -978,17 +978,17 @@ mcm_err(const struct memcache_ctxt *ctxt, const u_int= 32_t flags, const char *fun =20 int mcm_err_filter_add(struct memcache_ctxt *ctxt, const u_int32_t err_mask) { - if ((ctxt->MCM_ERR_MASK & err_mask) =3D=3D ctxt->MCM_ERR_MASK) + if ((ctxt->MCM_ERR_MASK & err_mask) =3D=3D err_mask) return 0; =20 - ctxt->MCM_ERR_MASK &=3D err_mask; + ctxt->MCM_ERR_MASK !=3D err_mask; return 1; } =20 =20 int mcm_err_filter_del(struct memcache_ctxt *ctxt, const u_int32_t err_mask) { - if ((ctxt->MCM_ERR_MASK & err_mask) =3D=3D ctxt->MCM_ERR_MASK) + if ((ctxt->MCM_ERR_MASK & err_mask) =3D=3D 0) return 0; =20 ctxt->MCM_ERR_MASK &=3D ~err_mask; @@ -1131,6 +1131,9 @@ mcm_fetch_cmd(struct memcache_ctxt *ctxt, struct memc= ache *mc, struct memcache_r /* Even though we haven't sent the request, mark the response as * having been attempted. */ res->_flags |=3D MCM_RES_ATTEMPTED; + /* This res might have been used before, so reset found flag */ + res->_flags &=3D ~MCM_RES_FOUND; + =20 /* While we're looping, might as well see if we should be auto * deleting any of these keys. */ diff --git a/libmemcache/test/benchmark/benchmark.c b/libmemcache/test/benc= hmark/benchmark.c index 259f7ca..b6e6c21 100644 --- a/libmemcache/test/benchmark/benchmark.c +++ b/libmemcache/test/benchmark/benchmark.c @@ -70,7 +70,7 @@ main(int argc, char *argv[]) { tests =3D strdup(argv[3]); =20 if (tests =3D=3D NULL) - tests =3D strdup("adgs"); + tests =3D strdup("adgGs"); =20 if (valsize =3D=3D 0) valsize =3D 50; @@ -138,6 +138,30 @@ main(int argc, char *argv[]) { printf(fmt, "get", num_tests / tt(&t1, &t2), tt(&t1, &t2), tt(&t1, &t2= ) / num_tests); } =20 + /* same get benchmark, but with overhead for each request. */ + if (strchr(tests, (int)'G') !=3D NULL) { + /* BEGIN get request */ + if (gettimeofday(&t1, NULL) !=3D 0) + err(EX_OSERR, "gettimeofday(2)"); + =20 + for (i =3D 0; i < num_tests; i) { + req =3D mc_req_new(); + res =3D mc_req_add(req, key, keylen); + res->size =3D valsize; + res->val =3D malloc(res->size); + mc_res_free_on_delete(res, 1); + =20 + mc_get(mc, req); + mc_req_free(req); + } + =20 + if (gettimeofday(&t2, NULL) !=3D 0) + err(EX_OSERR, "gettimeofday(2)"); + =20 + /* END get test */ + printf(fmt, "fget", num_tests / tt(&t1, &t2), tt(&t1, &t2), tt(&t1, &t2= ) / num_tests); + } + =20 =20 =20 if (strchr(tests, 'a') !=3D NULL || strchr(tests, 'd') !=3D NULL) { diff --git a/libmemcache/test/regress/regress.c b/libmemcache/test/regress/= regress.c index 71b4cfe..7d8df87 100644 --- a/libmemcache/test/regress/regress.c +++ b/libmemcache/test/regress/regress.c @@ -33,6 +33,7 @@ #include #include #include +#include =20 #include =20 @@ -70,8 +71,14 @@ main(int argc, char *argv[]) { num_tests =3D 10; =20 mc =3D mc_new(); - mc_err_filter_del(MCM_ERR_LVL_INFO); - mc_err_filter_del(MCM_ERR_LVL_NOTICE); + + /* test filter add/del and make sure info and level are NOT filtered out= */ + assert(mc_err_filter_del(MCM_ERR_LVL_INFO) =3D=3D 0); + assert(mc_err_filter_del(MCM_ERR_LVL_NOTICE) =3D=3D 0); + assert(mc_err_filter_add(MCM_ERR_LVL_NOTICE) =3D=3D 1); + assert(mc_err_filter_add(MCM_ERR_LVL_NOTICE) =3D=3D 0); + assert(mc_err_filter_del(MCM_ERR_LVL_NOTICE) =3D=3D 1); + assert(mc_err_filter_get() =3D=3D 0); =20 if (mc =3D=3D NULL) err(EX_OSERR, "Unable to allocate a new memcache object"); --ALfTUftag+2gvp1h-- --/unnNtmY43mpUSKx Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iQEcBAEBAgAGBQJIxStfAAoJEKYzuLoFSr5ygWMIAKK+YJ2XNrhHxOc1xtuVwNfl 0HchZgIldtXUaquEGkMQfyTFDyc03qfXx4fX7kSBUJwgG2udU9c1qXixyaWtXvKM aFy5JBda0V7DNbZ34GxuQp/3/Z+3O6SJmk7J3zKYUxeF7MqZYYwmPBQdBupF5EP8 OYGfqOU0JhUX08M877SFgv9WFdYKMCKfd7xGtLqST3o3QWpshNUw6omePuKz/X9R eBczcv1C5Dl85J+1P4nWsZaszFLo5Ec5RLh/QR3GBITZW9avR2ikzD/7SSO1ClbT oy62BWRT9BCzjzBMO0cCL3GTwyPOcrIwtyjUgGULvA05HjeCJEWAB8UuyXDmOzQ= =r3oF -----END PGP SIGNATURE----- --/unnNtmY43mpUSKx--