cvs: pecl /memcache memcache.c package.xml php_memcache.h

From: Date: Tue, 03 Oct 2006 10:09:27 +0000
Subject: cvs: pecl /memcache memcache.c package.xml php_memcache.h
Groups: php.pecl.cvs 
Request: Send a blank email to pecl-cvs+get-6450@lists.php.net to get a copy of this message
tony2001 Tue Oct 3 10:09:27 2006 UTC Modified files: /pecl/memcache memcache.c package.xml php_memcache.h Log: add memcache.max_failover_attempts http://cvs.php.net/viewvc.cgi/pecl/memcache/memcache.c?r1=1.59&r2=1.60&diff_format=u Index: pecl/memcache/memcache.c diff -u pecl/memcache/memcache.c:1.59 pecl/memcache/memcache.c:1.60 --- pecl/memcache/memcache.c:1.59 Mon Sep 4 21:30:22 2006 +++ pecl/memcache/memcache.c Tue Oct 3 10:09:27 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: memcache.c,v 1.59 2006/09/04 21:30:22 mikl Exp $ */ +/* $Id: memcache.c,v 1.60 2006/10/03 10:09:27 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -140,9 +140,24 @@ } /* }}} */ +static PHP_INI_MH(OnUpdateFailoverAttempts) /* {{{ */ +{ + long int lval; + + lval = strtol(new_value, NULL, 10); + if (lval <= 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "memcache.max_failover_attempts must be a positive integer ('%s' given)", new_value); + return FAILURE; + } + + return OnUpdateLong(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); +} +/* }}} */ + /* {{{ PHP_INI */ PHP_INI_BEGIN() STD_PHP_INI_ENTRY("memcache.allow_failover", "1", PHP_INI_ALL, OnUpdateLong, allow_failover, zend_memcache_globals, memcache_globals) + STD_PHP_INI_ENTRY("memcache.max_failover_attempts", "20", PHP_INI_ALL, OnUpdateFailoverAttempts, max_failover_attempts, zend_memcache_globals, memcache_globals) STD_PHP_INI_ENTRY("memcache.default_port", "11211", PHP_INI_ALL, OnUpdateLong, default_port, zend_memcache_globals, memcache_globals) STD_PHP_INI_ENTRY("memcache.chunk_size", "8192", PHP_INI_ALL, OnUpdateChunkSize, chunk_size, zend_memcache_globals, memcache_globals) PHP_INI_END() @@ -269,7 +284,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "memcache support", "enabled"); php_info_print_table_row(2, "Active persistent connections", buf); - php_info_print_table_row(2, "Revision", "$Revision: 1.59 $"); + php_info_print_table_row(2, "Revision", "$Revision: 1.60 $"); php_info_print_table_end(); DISPLAY_INI_ENTRIES(); @@ -726,7 +741,7 @@ mmc = pool->buckets[hash % pool->num_buckets]; /* perform failover if needed */ - for (i=0; !mmc_open(mmc, 0, NULL, NULL TSRMLS_CC) && (i<20 || i<pool->num_buckets) && MEMCACHE_G(allow_failover); i++) { + for (i=0; !mmc_open(mmc, 0, NULL, NULL TSRMLS_CC) && i<pool->num_buckets && MEMCACHE_G(allow_failover) && i<MEMCACHE_G(max_failover_attempts); i++) { char *next_key = emalloc(key_len + MAX_LENGTH_OF_LONG + 1); int next_len = sprintf(next_key, "%d%s", i+1, key); MMC_DEBUG(("mmc_server_find: failed to connect to server '%s:%d' status %d, trying next", mmc->host, mmc->port, mmc->status)); @@ -1077,7 +1092,7 @@ smart_str_free(&(pool->requests[j]->outbuf)); } - } while (result_status < 0 && i++ < 20); + } while (result_status < 0 && i++ < MEMCACHE_G(max_failover_attempts)); return result_status; } http://cvs.php.net/viewvc.cgi/pecl/memcache/package.xml?r1=1.23&r2=1.24&diff_format=u Index: pecl/memcache/package.xml diff -u pecl/memcache/package.xml:1.23 pecl/memcache/package.xml:1.24 --- pecl/memcache/package.xml:1.23 Fri Aug 4 09:10:01 2006 +++ pecl/memcache/package.xml Tue Oct 3 10:09:27 2006 @@ -31,7 +31,9 @@ - Individual server params and up/down status may be changed at runtime - New methods: setServerParams(), getServerStatus() - Statistics methods support fetching other kinds of stats (slabs, items, cachedump, ...) - - Fixed PECL bugs #7631, #8117 (errorous line feeds in config.m4) + - Fixed PECL bugs #7631, #8117 (erroneous line feeds in config.m4) + - Added memcache.max_failover_attempts ini directive, which can be used to configure max number of + servers to try when setting and getting data. </notes> </release> <filelist> http://cvs.php.net/viewvc.cgi/pecl/memcache/php_memcache.h?r1=1.18&r2=1.19&diff_format=u Index: pecl/memcache/php_memcache.h diff -u pecl/memcache/php_memcache.h:1.18 pecl/memcache/php_memcache.h:1.19 --- pecl/memcache/php_memcache.h:1.18 Fri Aug 4 09:10:01 2006 +++ pecl/memcache/php_memcache.h Tue Oct 3 10:09:27 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_memcache.h,v 1.18 2006/08/04 09:10:01 mikl Exp $ */ +/* $Id: php_memcache.h,v 1.19 2006/10/03 10:09:27 tony2001 Exp $ */ #ifndef PHP_MEMCACHE_H #define PHP_MEMCACHE_H @@ -109,6 +109,7 @@ long compression_level; long allow_failover; long chunk_size; + long max_failover_attempts; ZEND_END_MODULE_GLOBALS(memcache) #ifdef ZTS

« previous php.pecl.cvs (#6450) next »