cvs: pecl(NON_BLOCKING_IO) /memcache config9.m4 memcache_pool.c memcache_pool.h
| From: | Mikael Johansson | Date: | Thu, 30 Aug 2007 18:04:56 +0000 |
| Subject: | cvs: pecl(NON_BLOCKING_IO) /memcache config9.m4 memcache_pool.c memcache_pool.h | ||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-8491@lists.php.net to get a copy of this message | ||
mikl Thu Aug 30 18:04:56 2007 UTC
Modified files: (Branch: NON_BLOCKING_IO)
/pecl/memcache config9.m4 memcache_pool.c memcache_pool.h
Log:
Upped consistent hash points from 100 to 160
Fixed build with --disable-memcache-session
Merged fix for #11221
http://cvs.php.net/viewvc.cgi/pecl/memcache/config9.m4?r1=1.3.2.2&r2=1.3.2.3&diff_format=u
Index: pecl/memcache/config9.m4
diff -u pecl/memcache/config9.m4:1.3.2.2 pecl/memcache/config9.m4:1.3.2.3
--- pecl/memcache/config9.m4:1.3.2.2 Wed May 30 16:49:06 2007
+++ pecl/memcache/config9.m4 Thu Aug 30 18:04:55 2007
@@ -1,5 +1,5 @@
dnl
-dnl $Id: config9.m4,v 1.3.2.2 2007/05/30 16:49:06 mikl Exp $
+dnl $Id: config9.m4,v 1.3.2.3 2007/08/30 18:04:55 mikl Exp $
dnl
PHP_ARG_ENABLE(memcache, whether to enable memcache support,
@@ -98,7 +98,7 @@
else
AC_MSG_RESULT([disabled])
AC_DEFINE(HAVE_MEMCACHE,1,[Whether you want memcache support])
- PHP_NEW_EXTENSION(memcache, memcache.c, $ext_shared)
+ PHP_NEW_EXTENSION(memcache, memcache.c memcache_pool.c memcache_standard_hash.c
memcache_consistent_hash.c, $ext_shared)
fi
dnl this is needed to build the extension with phpize and -Wall
http://cvs.php.net/viewvc.cgi/pecl/memcache/memcache_pool.c?r1=1.1.2.5&r2=1.1.2.6&diff_format=u
Index: pecl/memcache/memcache_pool.c
diff -u pecl/memcache/memcache_pool.c:1.1.2.5 pecl/memcache/memcache_pool.c:1.1.2.6
--- pecl/memcache/memcache_pool.c:1.1.2.5 Wed May 30 16:49:06 2007
+++ pecl/memcache/memcache_pool.c Thu Aug 30 18:04:55 2007
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: memcache_pool.c,v 1.1.2.5 2007/05/30 16:49:06 mikl Exp $ */
+/* $Id: memcache_pool.c,v 1.1.2.6 2007/08/30 18:04:55 mikl Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -329,8 +329,6 @@
{
char *data = NULL;
unsigned int data_len, data_free = 0;
- smart_str buf = {0};
- php_serialize_data_t var_hash;
if (mmc_prepare_key_ex(key, key_len, request->key, &(request->key_len)) != MMC_OK) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid key");
@@ -353,25 +351,35 @@
flags &= ~MMC_SERIALIZED;
break;
- default:
- PHP_VAR_SERIALIZE_INIT(var_hash);
+ default: {
+ php_serialize_data_t value_hash;
+ zval value_copy, *value_copy_ptr;
+ smart_str buf = {0};
+ /* FIXME: we should be using 'Z' instead of this, but unfortunately it's
PHP5-only */
+ value_copy = *value;
+ zval_copy_ctor(&value_copy);
+ value_copy_ptr = &value_copy;
+
/* TODO: serialize straight into buffer (voids auto-compression) */
- php_var_serialize(&buf, &value, &var_hash TSRMLS_CC);
+ PHP_VAR_SERIALIZE_INIT(value_hash);
+ php_var_serialize(&buf, &value_copy_ptr, &value_hash TSRMLS_CC);
+ PHP_VAR_SERIALIZE_DESTROY(value_hash);
/* you're trying to save null or something went really wrong */
if (buf.c == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to serialize value");
+ zval_dtor(&value_copy);
return MMC_REQUEST_FAILURE;
}
data = buf.c;
data_len = buf.len;
data_free = 1;
-
- PHP_VAR_SERIALIZE_DESTROY(var_hash);
flags |= MMC_SERIALIZED;
- break;
+
+ zval_dtor(&value_copy);
+ }
}
/* autocompress large values */
http://cvs.php.net/viewvc.cgi/pecl/memcache/memcache_pool.h?r1=1.1.2.3&r2=1.1.2.4&diff_format=u
Index: pecl/memcache/memcache_pool.h
diff -u pecl/memcache/memcache_pool.h:1.1.2.3 pecl/memcache/memcache_pool.h:1.1.2.4
--- pecl/memcache/memcache_pool.h:1.1.2.3 Tue May 29 19:25:16 2007
+++ pecl/memcache/memcache_pool.h Thu Aug 30 18:04:55 2007
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: memcache_pool.h,v 1.1.2.3 2007/05/29 19:25:16 mikl Exp $ */
+/* $Id: memcache_pool.h,v 1.1.2.4 2007/08/30 18:04:55 mikl Exp $ */
#ifndef MEMCACHE_POOL_H
#define MEMCACHE_POOL_H
@@ -70,7 +70,7 @@
#define MMC_STANDARD_HASH 1
#define MMC_CONSISTENT_HASH 2
-#define MMC_CONSISTENT_POINTS 100 /* points per server */
+#define MMC_CONSISTENT_POINTS 160 /* points per server */
#define MMC_CONSISTENT_BUCKETS 1024 /* number of precomputed buckets, should be power of 2 */
/* io buffer */