From 022648039175d7f2e05da530ef77149335d8515d Mon Sep 17 00:00:00 2001 From: Brian Aker Date: Tue, 9 Feb 2010 10:20:33 -0800 Subject: [PATCH] Minor code code cleanup, plus modification to while() loop around poll in order to catch events/replay them. --- ChangeLog | 561 ++++++++++++++++++++++------------------------ libmemcached/io.c | 34 ++- 2 files changed, 294 insertions(+), 301 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5732f2e9..b731085c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,366 +1,345 @@ 0.38 - - * C++ interface for libhashkit. - - * Modified memcached_set_memory_allocators() so that it requires a context - pointer. - - * memcached_clone() now runs 5 times faster. - - * Functions used for callbacks are now given const memcached_st. - - * Added MEMCACHED_BEHAVIOR_CORK. - - * memslap now creates a configuration file at ~/.memslap.cnf - - * memcached_purge() now calls any callbacks registered during get - execution. +* C++ interface for libhashkit. +* Modified memcached_set_memory_allocators() so that it requires a context pointer. +* memcached_clone() now runs 5 times faster. +* Functions used for callbacks are now given const memcached_st. +* Added MEMCACHED_BEHAVIOR_CORK. +* memslap now creates a configuration file at ~/.memslap.cnf +* memcached_purge() now calls any callbacks registered during get execution. +* Many fixes to memslap. +* Updates for memcapable. 0.37 Mon Jan 11 16:29:57 PST 2010 - * Fixed build for libhashkit. - * Fixed install path regression. - * Modified RPM to strict check install. - * Added documentation for memcached_server_cursor(); - * Added memcached_servers_reset(). - * Modified memcached_st to remove dead cursor_server member. +* Fixed build for libhashkit. +* Fixed install path regression. +* Modified RPM to strict check install. +* Added documentation for memcached_server_cursor(); +* Added memcached_servers_reset(). +* Modified memcached_st to remove dead cursor_server member. 0.36 Wed Jan 6 18:23:50 PST 2010 - * Merged in new memslap utility. - * All of constants.h has been updated to match style (all old identifiers - continue to work). - * Added first pass for libhashkit. - * Updated test Framework/extended tests. - * Random read support during replication added. - * Modified use_sort so that the option can be applied to any distribution type. - * We removed the MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE added in 0.35. Instead use - memcached_behavior_set_distribution(). +* Merged in new memslap utility. +* All of constants.h has been updated to match style (all old identifiers continue to work). +* Added first pass for libhashkit. +* Updated test Framework/extended tests. +* Random read support during replication added. +* Modified use_sort so that the option can be applied to any distribution type. +* We removed the MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE added in 0.35. Instead use memcached_behavior_set_distribution(). 0.35 Mon Nov 9 11:18:33 PST 2009 - * Added support for by_key operations for inc/dec methods. - * Added mget test to memslap. - * Support for compatible ketama for SpyMemcached - * Update C++ interface. - * Fix for memcp +* Added support for by_key operations for inc/dec methods. +* Added mget test to memslap. +* Support for compatible ketama for SpyMemcached +* Update C++ interface. +* Fix for memcp 0.34 Tue Oct 13 08:39:51 PDT 2009 - * Added support for setting behavior flags on a connection pool. - * Don't increment server_failure_counter on normal disconnects. - * Added prototype for a callback based protocol parser (server side) - with examples so that you could let your own application speak the - memcached protocol - * Updated memcapable to test ASCII protocol. - * Changed behavior so that server can be removed at first sign of failure. - * Added memcached_server_get_last_disconnect() call +* Added support for setting behavior flags on a connection pool. +* Don't increment server_failure_counter on normal disconnects. +* Added prototype for a callback based protocol parser (server side) with examples so that you could let your own application speak the memcached protocol +* Updated memcapable to test ASCII protocol. +* Changed behavior so that server can be removed at first sign of failure. +* Added memcached_server_get_last_disconnect() call 0.33 Wed Sep 23 10:11:58 PDT 2009 - * Added memcapable to test servers for binary compatibility. - * Updated C++ interface. Added basic support for C++ exceptions. Added - multiple constructors the memcached client object. The C++ interface - now takes parameters which are C++ types (such as std::string). - * Several bug fixes for binary protocol support. - * Fixed crashing issue with dumping from memcachd server (server internals - were changed without documenting change). +* Added memcapable to test servers for binary compatibility. +* Updated C++ interface. Added basic support for C++ exceptions. Added +multiple constructors the memcached client object. The C++ interface +now takes parameters which are C++ types (such as std::string). +* Several bug fixes for binary protocol support. +* Fixed crashing issue with dumping from memcachd server (server internals were changed without documenting change). 0.32 Tue Sep 15 15:49:09 PDT 2009 - * Change of behavior where linger is only modified for no-block and then - it is set to zero. - * Added Twitter's memcached_server_error() functions. - * Fix for OSX compiles in development builds. - * Updated C++ interface. - * Updated memcached_mget and memcached_mget_by_key to take a size_t - as a parameter instead of an unsigned int for number_of_keys. +* Change of behavior where linger is only modified for no-block and then +it is set to zero. +* Added Twitter's memcached_server_error() functions. +* Fix for OSX compiles in development builds. +* Updated C++ interface. +* Updated memcached_mget and memcached_mget_by_key to take a size_t +as a parameter instead of an unsigned int for number_of_keys. 0.31 Fri Jul 10 09:02:50 PDT 2009 - * Added support or HA via replication. - * malloc() removed for server key usage. - * Update build system. - * Added support for memcached_set_memory_allocators(). - * Fixed bug in configure.ac for have_htoll. +* Added support or HA via replication. +* malloc() removed for server key usage. +* Update build system. +* Added support for memcached_set_memory_allocators(). +* Fixed bug in configure.ac for have_htoll. 0.30 Sun May 31 17:31:52 PDT 2009 - * Added memcachd_dump command (and framework for memdump tool). - * Realigned all structures to remove padding (and line up important bits for 64bit caches. - * Remove some of sprintf() in storage calls(). - * Removed printf() in stat call for unknown stat member. - * memcached_generate_hash() function added. - * Added tests to make sure all hash functions are stable. +* Added memcachd_dump command (and framework for memdump tool). +* Realigned all structures to remove padding (and line up important bits for 64bit caches. +* Remove some of sprintf() in storage calls(). +* Removed printf() in stat call for unknown stat member. +* memcached_generate_hash() function added. +* Added tests to make sure all hash functions are stable. 0.29 Tue May 19 08:26:48 PDT 2009 - * Fixed malloc usage to calloc for spots where we need zero filled memory. - * All code warnings now treated as errors. - * Fixes for debian packaging. - * Added new pooling mechanism. - * MEMCACHED_BEHAVIOR_NO_BLOCK no longer also sets MEMCACHED_BEHAVIOR_BUFFER_REQUESTS. - * Updated generic rpm. +* Fixed malloc usage to calloc for spots where we need zero filled memory. +* All code warnings now treated as errors. +* Fixes for debian packaging. +* Added new pooling mechanism. +* MEMCACHED_BEHAVIOR_NO_BLOCK no longer also sets MEMCACHED_BEHAVIOR_BUFFER_REQUESTS. +* Updated generic rpm. 0.28 Tue Apr 14 18:56:28 PDT 2009 - * Fixed bug in init sructure (reapplied) - * Fixed bug in get/set by key (nikkhils@gmail.com) +* Fixed bug in init sructure (reapplied) +* Fixed bug in get/set by key (nikkhils@gmail.com) 0.27 Sun Mar 29 22:33:01 PDT 2009 - * Added new UDP fire-forget mode. - * Reworked performance for mget() to better make use of async protocol - * Cleaned up execution of fetch (just one set of code now) - * Fixed Jenkin's for big endian hosts. - * Updates for memstat to determine network latency. - * Updates for binary protocol. - * Many updates to documentation. +* Added new UDP fire-forget mode. +* Reworked performance for mget() to better make use of async protocol +* Cleaned up execution of fetch (just one set of code now) +* Fixed Jenkin's for big endian hosts. +* Updates for memstat to determine network latency. +* Updates for binary protocol. +* Many updates to documentation. 0.26 Thu Jan 29 13:05:50 PST 2009 - * Fix for decrement on hash key - * Fixed assert that was catching bad memset() call in host_reset() - * Fix purge issue for blocked IO which has been stacked. +* Fix for decrement on hash key +* Fixed assert that was catching bad memset() call in host_reset() +* Fix purge issue for blocked IO which has been stacked. 0.25 Fri Nov 28 09:59:35 PST 2008 - * Jenkins HASH added. - * Update of Murmur hash code - * Support explicit weights (Robey Pointer, Evan Weaver) - * Bugfix for ketama continuum (Robey Pointer) - * New behavior MEMCACHED_BEHAVIOR_HASH_WITH_PREFIX_KEY (Robey Pointer) - * Don't ever call stats for weighting servers, because it is unstable. +* Jenkins HASH added. +* Update of Murmur hash code +* Support explicit weights (Robey Pointer, Evan Weaver) +* Bugfix for ketama continuum (Robey Pointer) +* New behavior MEMCACHED_BEHAVIOR_HASH_WITH_PREFIX_KEY (Robey Pointer) +* Don't ever call stats for weighting servers, because it is unstable. 0.24 Tue Sep 16 02:59:03 PDT 2008 (never released) - * Cleanup compile warnings. - * Fix issues in partitioning by keys. - * Fixed "fail case" to make sure when calling memcached_clone() no - memcached_st is over written. - * New memcached_server_by_key() method for finding a server from - a key. - * memcached_server_free() was added for freeing server structures. - +* Cleanup compile warnings. +* Fix issues in partitioning by keys. +* Fixed "fail case" to make sure when calling memcached_clone() no +memcached_st is over written. +* New memcached_server_by_key() method for finding a server from +a key. +* memcached_server_free() was added for freeing server structures. + 0.23 Sun Sep 7 08:13:59 PDT 2008 - * Added strings.h header for Solaris 9 - * Solaris 64bit fix. - * Support for weighted Ketama from Yin Chen. - * Fix for Chinese - * Fix for 0 length key to trigger bad key. - * Added behaviors MEMCACHED_BEHAVIOR_SND_TIMEOUT, MEMCACHED_BEHAVIOR_RCV_TIMEOUT - * Support for Binary Protocol added +* Added strings.h header for Solaris 9 +* Solaris 64bit fix. +* Support for weighted Ketama from Yin Chen. +* Fix for Chinese +* Fix for 0 length key to trigger bad key. +* Added behaviors MEMCACHED_BEHAVIOR_SND_TIMEOUT, MEMCACHED_BEHAVIOR_RCV_TIMEOUT +* Support for Binary Protocol added 0.22 Mon Jul 14 09:24:11 PDT 2008 - * Fix where master key was no being checked for "bad key" - * Fixed bugs in stats output (thread output was wrong) - * Clarified MEMCACHED_BAD_KEY_PROVIDED is return for bad prefix key. - * Found a bug in Flags return (Jacek Ostrowski) - * Fixed issue with compiling on Visual Studio +* Fix where master key was no being checked for "bad key" +* Fixed bugs in stats output (thread output was wrong) +* Clarified MEMCACHED_BAD_KEY_PROVIDED is return for bad prefix key. +* Found a bug in Flags return (Jacek Ostrowski) +* Fixed issue with compiling on Visual Studio 0.21 Fri May 23 18:34:09 PDT 2008 - * Change of char * to const char * for all key based functions. - * New MEMCACHED_CALLBACK_PREFIX_KEY added. You can now create domains for - values. - * Fixed bug introducd in last version on memcp - * Fix for death of file io to call shutdown() +* Change of char * to const char * for all key based functions. +* New MEMCACHED_CALLBACK_PREFIX_KEY added. You can now create domains for +values. +* Fixed bug introducd in last version on memcp +* Fix for death of file io to call shutdown() 0.20 Mon May 5 08:34:26 PDT 2008 - * New consistent distribution tests. - * Found a memory leak when a server constantly fails. - * Fix in watchpoint macro - * Changed default timeout to 1 second for poll timeouts - * Wheel uses less memory/dynamic allocation for size (no longer limited to - 512 hosts by default. - * memslap memory leak fix - * Added Ketama distribution - * Fix assert.h compile problem on CentOS +* New consistent distribution tests. +* Found a memory leak when a server constantly fails. +* Fix in watchpoint macro +* Changed default timeout to 1 second for poll timeouts +* Wheel uses less memory/dynamic allocation for size (no longer limited to 512 hosts by default. +* memslap memory leak fix +* Added Ketama distribution +* Fix assert.h compile problem on CentOS 0.19 Wed Apr 9 09:30:53 PDT 2008 - * Documentation fix in libmemcached. - * Fixed bug where sort was always occuring on hosts - * Logic fix in branch prediction (thanks Jay!) - * Read through cached support. - * Fixed for cas by key operation. - * Fix for memcached_server_st list structures to have correct count. - * Added callback MEMCACHED_CALLBACK_DELETE_TRIGGER - * Removed function call in favor of macro (aka cut out some instructions) +* Documentation fix in libmemcached. +* Fixed bug where sort was always occuring on hosts +* Logic fix in branch prediction (thanks Jay!) +* Read through cached support. +* Fixed for cas by key operation. +* Fix for memcached_server_st list structures to have correct count. +* Added callback MEMCACHED_CALLBACK_DELETE_TRIGGER +* Removed function call in favor of macro (aka cut out some instructions) 0.18 Sun Mar 16 21:57:55 PDT 2008 - * Fix plus tests for non-zero value objects and flags. - * MEMCACHED_HASH_MURMUR added for murmur algorithm provided. - * MEMCACHED_BEHAVIOR_RETRY_TIMEOUT added to keep connecting from looping - on timeout. - * gcc branch prediction optimizations - * Refactored entire tree to make include files cleaner - * Fixed leaked socket. +* Fix plus tests for non-zero value objects and flags. +* MEMCACHED_HASH_MURMUR added for murmur algorithm provided. +* MEMCACHED_BEHAVIOR_RETRY_TIMEOUT added to keep connecting from looping on timeout. +* gcc branch prediction optimizations +* Refactored entire tree to make include files cleaner +* Fixed leaked socket. 0.17 Wed Feb 27 03:33:29 PST 2008 - * MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT added for connect timeout in - non-block mode. - * Incompatible change in memcached_behavior_set() api. We now use a - uint64_t, instead of a pointer. - * Fix for storage of values for zero. - * memcached_server_cursor() function added to API for cycling through servers. +* MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT added for connect timeout in +non-block mode. +* Incompatible change in memcached_behavior_set() api. We now use a +uint64_t, instead of a pointer. +* Fix for storage of values for zero. +* memcached_server_cursor() function added to API for cycling through servers. 0.16 Mon Feb 18 00:30:25 PST 2008 - * Work on the UDP protocol - * Added get_by_key, set_by_key tests for C++ API - * Fix for limit_maxbytes to be 64bit in stats - * Added Atom Smasher test (scale baby, scale!) - * Servers are now sorted, meaning that servers are now ordered so that - clients with the same lists, will have same distribution. (Idea from - Ross McFarland). MEMCACHED_BEHAVIOR_SORT_HOSTS was added to enable - this support. - * Added MEMCACHED_BAD_KEY_PROVIDED error for auto, set, and get operations. - MEMCACHED_BEHAVIOR_VERIFY_KEY was added to enable this feature. - * More error messages on command line tools. - * Fixed bugs in memcached_cas() operator. - * Fix to loop through interfaces - +* Work on the UDP protocol +* Added get_by_key, set_by_key tests for C++ API +* Fix for limit_maxbytes to be 64bit in stats +* Added Atom Smasher test (scale baby, scale!) +* Servers are now sorted, meaning that servers are now ordered so that clients with the same lists, will have same distribution. (Idea from Ross McFarland). MEMCACHED_BEHAVIOR_SORT_HOSTS was added to enable this support. +* Added MEMCACHED_BAD_KEY_PROVIDED error for auto, set, and get operations. MEMCACHED_BEHAVIOR_VERIFY_KEY was added to enable this feature. +* More error messages on command line tools. +* Fixed bugs in memcached_cas() operator. +* Fix to loop through interfaces + 0.15 Tue Jan 29 14:55:44 PST 2008 - * More work on the C++ API. - * Bug fixes around block corner cases. - * Slight performance increase in both read() and write(). +* More work on the C++ API. +* Bug fixes around block corner cases. +* Slight performance increase in both read() and write(). 0.14 Tue Jan 22 06:21:49 PST 2008 - * For for bug found by Evan Weaver where increment() was not returning - propper error of value was not found. - * Fix for bad null pointer on flag by Toru Maesaka. - * Refactor of all IO to just pass in the active server - * Problem configuring (PKG_CHECK_MODULES) fixed by removal of "rpath" in - support/libmemcached.pc.in (Thanks to Ross McFarland). - * Added memcached_callback_get()/set() - * First prototype of C++ interface - * Updated docs for uint16_t changes in previous release +* For for bug found by Evan Weaver where increment() was not returning +propper error of value was not found. +* Fix for bad null pointer on flag by Toru Maesaka. +* Refactor of all IO to just pass in the active server +* Problem configuring (PKG_CHECK_MODULES) fixed by removal of "rpath" in +support/libmemcached.pc.in (Thanks to Ross McFarland). +* Added memcached_callback_get()/set() +* First prototype of C++ interface +* Updated docs for uint16_t changes in previous release 0.13 Sun Jan 13 06:51:50 PST 2008 - * MEMCACHED_BEHAVIOR_USER_DATA added to store user pointer. - * Fix for failure to connect to invalidate socket. - * Patch from Marc Rossi to add --hash option for memcp, memrm, and memcat. - * Kevin's patch for fixing EOF issues during a read. - * Toru Maesaka patch for stats mismatch - * Fix for when CRC return 0 - * Fixed uint16_t issues around flags. Turns out the documentation on the - protocol was wrong. - * Lingering socket fixes for FreeBSD. - * Patches from Kevin Dalley for FreeBSD 4.0 - * Added multi delete functions. - * All get key returns have C style null termination - * If memcached_server_list_append is passed NULLs instead of pointers it - returns NULL. - * Added memcached_fetch_execute() method - * Found a bug where memcached_fetch() was not null terminating the result - value. - * memcached_behavior() now has the ability to set "buffering" so that - data is not automatically flushed. - * Behavior change, buffered commands now return MEMCACHED_BUFFERED +* MEMCACHED_BEHAVIOR_USER_DATA added to store user pointer. +* Fix for failure to connect to invalidate socket. +* Patch from Marc Rossi to add --hash option for memcp, memrm, and memcat. +* Kevin's patch for fixing EOF issues during a read. +* Toru Maesaka patch for stats mismatch +* Fix for when CRC return 0 +* Fixed uint16_t issues around flags. Turns out the documentation on the +protocol was wrong. +* Lingering socket fixes for FreeBSD. +* Patches from Kevin Dalley for FreeBSD 4.0 +* Added multi delete functions. +* All get key returns have C style null termination +* If memcached_server_list_append is passed NULLs instead of pointers it +returns NULL. +* Added memcached_fetch_execute() method +* Found a bug where memcached_fetch() was not null terminating the result +value. +* memcached_behavior() now has the ability to set "buffering" so that +data is not automatically flushed. +* Behavior change, buffered commands now return MEMCACHED_BUFFERED 0.12 Tue Dec 11 15:20:55 PST 2007 - * Updates for consistent hashing - * IPV6 support - * Static allocation for hostname (performance) - * Fixed bug where in non-block mode all data might not have been sent on - close(). - * Refactor of memcached_get() to use common code. - * Change in value fetch, MEMCACHED_END is now returned when keys are no - longer in the pipe. - * Fixed bug where key could be out of range of characters - * Added _by_key() methods to allow partitioning of values to particular - servers. - * MEMCACHED_DEFAILT_TIMEOUT is now set to a non -1 value. - * Performance improvements in get operations. +* Updates for consistent hashing +* IPV6 support +* Static allocation for hostname (performance) +* Fixed bug where in non-block mode all data might not have been sent on +close(). +* Refactor of memcached_get() to use common code. +* Change in value fetch, MEMCACHED_END is now returned when keys are no +longer in the pipe. +* Fixed bug where key could be out of range of characters +* Added _by_key() methods to allow partitioning of values to particular +servers. +* MEMCACHED_DEFAILT_TIMEOUT is now set to a non -1 value. +* Performance improvements in get operations. 0.11 Mon Nov 26 01:05:52 PST 2007 - * Added option to memcache_behavior_set() so that poll() can be timed out. - * Fixed memory leak in case of using memcached_fetch_result() where no - value was returned. - * Bug fixed in memcached_connect() which would cause servers that - did not need to be enabled to be enabled (performance issue). - * Rewrote bounds checking code for get calls. - * "make test" now starts its own memcached servers. - * Added Hseih hash (MEMCACHED_HASH_HSIEH), which is showing about 7% - performance over standard hash. +* Added option to memcache_behavior_set() so that poll() can be timed out. +* Fixed memory leak in case of using memcached_fetch_result() where no +value was returned. +* Bug fixed in memcached_connect() which would cause servers that +did not need to be enabled to be enabled (performance issue). +* Rewrote bounds checking code for get calls. +* "make test" now starts its own memcached servers. +* Added Hseih hash (MEMCACHED_HASH_HSIEH), which is showing about 7% +performance over standard hash. 0.10 Tue Nov 20 23:22:31 PST 2007 - * Added append binary test. - * Added MEMCACHED_BEHAVIOR_CACHE_LOOKUPS behavior so that you can save on - multiple DNS lookups. - * Added CAS support, though this is optional and must be enabled during - runtime. - * Added the utility memerror to create human readable error strings - from memcached errors (aka convert ints to strings) - * Fixed type in MEMCACHED_HOST_LOOKUP_FAILURE - * Fixed bug where hostname might not be null terminated - * Moved to using gethostbyname_r() on Linux to solve thread safety issue - * Added -rpath support for pkg-config - * Documentation fix for hash setting using memcached_behavior_set() +* Added append binary test. +* Added MEMCACHED_BEHAVIOR_CACHE_LOOKUPS behavior so that you can save on +multiple DNS lookups. +* Added CAS support, though this is optional and must be enabled during +runtime. +* Added the utility memerror to create human readable error strings +from memcached errors (aka convert ints to strings) +* Fixed type in MEMCACHED_HOST_LOOKUP_FAILURE +* Fixed bug where hostname might not be null terminated +* Moved to using gethostbyname_r() on Linux to solve thread safety issue +* Added -rpath support for pkg-config +* Documentation fix for hash setting using memcached_behavior_set() 0.9 Thu Nov 15 07:44:00 PST 2007 - * fix for when no servers are definied. - * different buffers are now kept for different connections to - speed up async efforts - * Modified increment/decrement functions to return uint64_t values - * Fixed bug in cases where zero length keys were provided - * Thread cleanup issue in memslap - * No hostname lookup on reconnect - * Fix for flag settings (was doing hex by accident!) - * Support for 1.2.4 server additions "prepend" and "append" added. - * Added memcached_version()... not sure if I will make this public - or not. +* fix for when no servers are definied. +* different buffers are now kept for different connections to +speed up async efforts +* Modified increment/decrement functions to return uint64_t values +* Fixed bug in cases where zero length keys were provided +* Thread cleanup issue in memslap +* No hostname lookup on reconnect +* Fix for flag settings (was doing hex by accident!) +* Support for 1.2.4 server additions "prepend" and "append" added. +* Added memcached_version()... not sure if I will make this public +or not. 0.8 Mon Nov 5 10:40:41 PST 2007 - * Adding support for CRC hash method - * Adding support for UNIX sockets - * Added additional HASHing methods of FNV1_64,FNV1A_64, FNV1_32, FNV1A_32 - * Added pkgconfig support (PKG_CHECK_MODULES) - * Fixed conflict with defined type in MySQL - * Added memcached_result_st structure and functions to manipulate it. +* Adding support for CRC hash method +* Adding support for UNIX sockets +* Added additional HASHing methods of FNV1_64,FNV1A_64, FNV1_32, FNV1A_32 +* Added pkgconfig support (PKG_CHECK_MODULES) +* Fixed conflict with defined type in MySQL +* Added memcached_result_st structure and functions to manipulate it. 0.7 Tue Oct 30 09:24:05 PDT 2007 - * Poved to poll() from select() - * Fixes in internal string class for allocation of large numbers of - strings. - * memcached_mget() function now sends keys as it parses them instead of - building strings as it goes. - * Propper flush now for making sure we get all IO sent even when in - non-block mode. - * Added --enable-debug rule for configure - * All asserts() removed (hey this is going into production!) +* Poved to poll() from select() +* Fixes in internal string class for allocation of large numbers of +strings. +* memcached_mget() function now sends keys as it parses them instead of +building strings as it goes. +* Propper flush now for making sure we get all IO sent even when in +non-block mode. +* Added --enable-debug rule for configure +* All asserts() removed (hey this is going into production!) 0.6 Wed Oct 17 08:41:35 PDT 2007 - * get value returns are now null terminated (request by Cal Heldenbrand) - * Fixed connections for more hosts then two. - * Rewrite of the read/write IO systems to handle different sorts of host - failures. - * Added man pages for all functions and tools - * Raised buffer size for readinng/writing to 16K - * You can now optionally set the socket size for recv/send via - memached_behavior_set/get. +* get value returns are now null terminated (request by Cal Heldenbrand) +* Fixed connections for more hosts then two. +* Rewrite of the read/write IO systems to handle different sorts of host +failures. +* Added man pages for all functions and tools +* Raised buffer size for readinng/writing to 16K +* You can now optionally set the socket size for recv/send via +memached_behavior_set/get. 0.5 Tue Oct 9 00:22:25 PDT 2007 - * Ruby maintainer mentioned TCP_NODELAY patch he had added. Added this to C - library as well. (Eric Hodel drbrain@segment7.net) - * Added support script for set_benchmark - * Updated memslap to allow testing of TCP_NODELAY - * Updated memslap to support --flush (aka dump memcache servers before - testing) - * Fixed bug in multiple hosts not being activated - * Added environmental variable MEMCACHED_SERVERS which can be used to - set the servers list. - * fixed memcached_stat method (and now memstat works) - * server connect now happens on demand. - * Help for all command line applications +* Ruby maintainer mentioned TCP_NODELAY patch he had added. Added this to C +library as well. (Eric Hodel drbrain@segment7.net) +* Added support script for set_benchmark +* Updated memslap to allow testing of TCP_NODELAY +* Updated memslap to support --flush (aka dump memcache servers before testing) +* Fixed bug in multiple hosts not being activated +* Added environmental variable MEMCACHED_SERVERS which can be used to set the servers list. +* fixed memcached_stat method (and now memstat works) +* server connect now happens on demand. +* Help for all command line applications 0.4 Wed Oct 3 10:28:50 PDT 2007 - * Added buffered IO to write calls for keys - * Added buffered IO for reads - * memstat was broken (bad if/else on connect) - * New non-blocking IO (not default yet). Mucho faster - * Refactor of test system. - * memslap crash solved +* Added buffered IO to write calls for keys +* Added buffered IO for reads +* memstat was broken (bad if/else on connect) +* New non-blocking IO (not default yet). Mucho faster +* Refactor of test system. +* memslap crash solved 0.3 Mon Oct 1 06:37:52 PDT 2007 - * Jeff Fisher provided a spec file - * Added "make rpm" around dist file - * Added support for Solaris - * Added support for DTrace - * Fixed read to be recv and write to be send - * Bug fix where memstat would core if no server was found - * Added memslap tool (load generator) - * Numerous bug fixes in library - * Added calls to library for creating host lists (see - text cases to understand how to use this). +* Jeff Fisher provided a spec file +* Added "make rpm" around dist file +* Added support for Solaris +* Added support for DTrace +* Fixed read to be recv and write to be send +* Bug fix where memstat would core if no server was found +* Added memslap tool (load generator) +* Numerous bug fixes in library +* Added calls to library for creating host lists (see text cases to understand how to use this). 0.2 Thu Sep 27 03:46:57 PDT 2007 - * First public version +* First public version diff --git a/libmemcached/io.c b/libmemcached/io.c index 232b58d3..17398aa3 100644 --- a/libmemcached/io.c +++ b/libmemcached/io.c @@ -53,15 +53,30 @@ static memcached_return_t io_wait(memcached_server_instance_st *ptr, if (ptr->root->flags.no_block == false) timeout= -1; - error= poll(&fds, 1, timeout); + while (1) + { + error= poll(&fds, 1, timeout); - if (error == 1) - return MEMCACHED_SUCCESS; - else if (error == 0) - return MEMCACHED_TIMEOUT; + switch (error) + { + case 1: + return MEMCACHED_SUCCESS; + case 0: + return MEMCACHED_TIMEOUT; + case ERESTART: + case EINTR: + continue; + default: + ptr->cached_errno= error; + memcached_quit_server(ptr, 1); + + return MEMCACHED_FAILURE; + } + } /* Imposssible for anything other then -1 */ WATCHPOINT_ASSERT(error == -1); + ptr->cached_errno= error; memcached_quit_server(ptr, 1); return MEMCACHED_FAILURE; @@ -157,6 +172,7 @@ static bool process_input_buffer(memcached_server_instance_st *ptr) static inline void memcached_io_cork_push(memcached_server_st *ptr) { + (void)ptr; #ifdef CORK if (ptr->root->flags.cork == false || ptr->state.is_corked) return; @@ -168,13 +184,12 @@ static inline void memcached_io_cork_push(memcached_server_st *ptr) ptr->state.is_corked= true; WATCHPOINT_ASSERT(ptr->state.is_corked == true); -#else - (void)ptr; #endif } static inline void memcached_io_cork_pop(memcached_server_st *ptr) { + (void)ptr; #ifdef CORK if (ptr->root->flags.cork == false || ptr->state.is_corked == false) return; @@ -186,12 +201,10 @@ static inline void memcached_io_cork_pop(memcached_server_st *ptr) ptr->state.is_corked= false; WATCHPOINT_ASSERT(ptr->state.is_corked == false); -#else - (void)ptr; #endif } -#ifdef UNUSED +#if 0 // Dead code, this should be removed. void memcached_io_preread(memcached_st *ptr) { unsigned int x; @@ -244,6 +257,7 @@ memcached_return_t memcached_io_read(memcached_server_instance_st *ptr, { case EAGAIN: case EINTR: + case ERESTART: if ((rc= io_wait(ptr, MEM_READ)) == MEMCACHED_SUCCESS) continue; /* fall through */ -- 2.30.2