memcached 1.2.6 → 1.2.7
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +2 -0
- data/Manifest +206 -12
- data/Rakefile +32 -1
- data/ext/extconf.rb +10 -35
- data/ext/libmemcached-0.32/AUTHORS +7 -0
- data/ext/libmemcached-0.32/COPYING +32 -0
- data/ext/libmemcached-0.32/ChangeLog +303 -0
- data/ext/libmemcached-0.32/INSTALL +302 -0
- data/ext/libmemcached-0.32/Makefile.am +36 -0
- data/ext/libmemcached-0.32/Makefile.in +828 -0
- data/ext/libmemcached-0.32/NEWS +1 -0
- data/ext/libmemcached-0.32/README +33 -0
- data/ext/libmemcached-0.32/THANKS +14 -0
- data/ext/libmemcached-0.32/TODO +11 -0
- data/ext/libmemcached-0.32/aclocal.m4 +1852 -0
- data/ext/libmemcached-0.32/clients/Makefile.am +73 -0
- data/ext/libmemcached-0.32/clients/Makefile.in +770 -0
- data/ext/libmemcached-0.32/clients/client_options.h +32 -0
- data/ext/libmemcached-0.32/clients/execute.c +64 -0
- data/ext/libmemcached-0.32/clients/execute.h +5 -0
- data/ext/libmemcached-0.32/clients/generator.c +74 -0
- data/ext/libmemcached-0.32/clients/generator.h +20 -0
- data/ext/libmemcached-0.32/clients/memcat.c +178 -0
- data/ext/libmemcached-0.32/clients/memcp.c +251 -0
- data/ext/libmemcached-0.32/clients/memdump.c +170 -0
- data/ext/libmemcached-0.32/clients/memerror.c +80 -0
- data/ext/libmemcached-0.32/clients/memflush.c +143 -0
- data/ext/libmemcached-0.32/clients/memrm.c +160 -0
- data/ext/libmemcached-0.32/clients/memslap.c +441 -0
- data/ext/libmemcached-0.32/clients/memstat.c +326 -0
- data/ext/libmemcached-0.32/clients/utilities.c +207 -0
- data/ext/libmemcached-0.32/clients/utilities.h +41 -0
- data/ext/libmemcached-0.32/config.h.in +252 -0
- data/ext/libmemcached-0.32/config/compile +143 -0
- data/ext/libmemcached-0.32/config/config.guess +1561 -0
- data/ext/libmemcached-0.32/config/config.rpath +666 -0
- data/ext/libmemcached-0.32/config/config.sub +1686 -0
- data/ext/libmemcached-0.32/config/depcomp +630 -0
- data/ext/libmemcached-0.32/config/install-sh +520 -0
- data/ext/libmemcached-0.32/config/ltmain.sh +8406 -0
- data/ext/libmemcached-0.32/config/missing +376 -0
- data/ext/libmemcached-0.32/configure +23048 -0
- data/ext/libmemcached-0.32/configure.ac +122 -0
- data/ext/libmemcached-0.32/docs/Makefile.am +415 -0
- data/ext/libmemcached-0.32/docs/Makefile.in +918 -0
- data/ext/libmemcached-0.32/docs/libmemcached.pod +123 -0
- data/ext/libmemcached-0.32/docs/libmemcached_examples.pod +115 -0
- data/ext/libmemcached-0.32/docs/libmemcachedutil.pod +40 -0
- data/ext/libmemcached-0.32/docs/memcached_analyze.pod +52 -0
- data/ext/libmemcached-0.32/docs/memcached_auto.pod +97 -0
- data/ext/libmemcached-0.32/docs/memcached_behavior.pod +224 -0
- data/ext/libmemcached-0.32/docs/memcached_callback.pod +123 -0
- data/ext/libmemcached-0.32/docs/memcached_create.pod +61 -0
- data/ext/libmemcached-0.32/docs/memcached_delete.pod +54 -0
- data/ext/libmemcached-0.32/docs/memcached_dump.pod +53 -0
- data/ext/libmemcached-0.32/docs/memcached_flush.pod +46 -0
- data/ext/libmemcached-0.32/docs/memcached_flush_buffers.pod +42 -0
- data/ext/libmemcached-0.32/docs/memcached_generate_hash_value.pod +57 -0
- data/ext/libmemcached-0.32/docs/memcached_get.pod +161 -0
- data/ext/libmemcached-0.32/docs/memcached_memory_allocators.pod +73 -0
- data/ext/libmemcached-0.32/docs/memcached_pool.pod +77 -0
- data/ext/libmemcached-0.32/docs/memcached_quit.pod +47 -0
- data/ext/libmemcached-0.32/docs/memcached_sasl.pod +63 -0
- data/ext/libmemcached-0.32/docs/memcached_server_st.pod +75 -0
- data/ext/libmemcached-0.32/docs/memcached_servers.pod +102 -0
- data/ext/libmemcached-0.32/docs/memcached_set.pod +187 -0
- data/ext/libmemcached-0.32/docs/memcached_stats.pod +82 -0
- data/ext/libmemcached-0.32/docs/memcached_strerror.pod +46 -0
- data/ext/libmemcached-0.32/docs/memcached_user_data.pod +49 -0
- data/ext/libmemcached-0.32/docs/memcached_verbosity.pod +41 -0
- data/ext/libmemcached-0.32/docs/memcached_version.pod +56 -0
- data/ext/libmemcached-0.32/docs/memcat.pod +37 -0
- data/ext/libmemcached-0.32/docs/memcp.pod +40 -0
- data/ext/libmemcached-0.32/docs/memdump.pod +31 -0
- data/ext/libmemcached-0.32/docs/memerror.pod +30 -0
- data/ext/libmemcached-0.32/docs/memflush.pod +35 -0
- data/ext/libmemcached-0.32/docs/memrm.pod +34 -0
- data/ext/libmemcached-0.32/docs/memslap.pod +33 -0
- data/ext/libmemcached-0.32/docs/memstat.pod +35 -0
- data/ext/libmemcached-0.32/libmemcached/Makefile.am +107 -0
- data/ext/libmemcached-0.32/libmemcached/Makefile.in +1050 -0
- data/ext/libmemcached-0.32/libmemcached/byteorder.c +31 -0
- data/ext/libmemcached-0.32/libmemcached/common.h +183 -0
- data/ext/libmemcached-0.32/libmemcached/crc.c +86 -0
- data/ext/libmemcached-0.32/libmemcached/hsieh_hash.c +68 -0
- data/ext/libmemcached-0.32/libmemcached/jenkins_hash.c +213 -0
- data/ext/libmemcached-0.32/libmemcached/libmemcached.ver +1 -0
- data/ext/libmemcached-0.32/libmemcached/libmemcached_probes.d +28 -0
- data/ext/libmemcached-0.32/libmemcached/libmemcached_probes.h +78 -0
- data/ext/libmemcached-0.32/libmemcached/md5.c +354 -0
- data/ext/libmemcached-0.32/libmemcached/memcached.c +152 -0
- data/ext/libmemcached-0.32/libmemcached/memcached.h +302 -0
- data/ext/libmemcached-0.32/libmemcached/memcached.hpp +799 -0
- data/ext/libmemcached-0.32/libmemcached/memcached/README.txt +7 -0
- data/ext/libmemcached-0.32/libmemcached/memcached/protocol_binary.h +366 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_allocators.c +72 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_analyze.c +100 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_auto.c +207 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_behavior.c +285 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_callback.c +175 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_configure.h.in +23 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_connect.c +361 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_constants.h +145 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_delete.c +0 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_do.c +34 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_dump.c +79 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_fetch.c +102 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_flush.c +89 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_flush_buffers.c +22 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_get.c +495 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_get.h +87 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_hash.c +252 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_hosts.c +510 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_internal.h +31 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_io.c +547 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_io.h +59 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_key.c +28 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_parse.c +74 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_pool.h +38 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_purge.c +76 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_quit.c +75 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_response.c +528 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_result.c +57 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_result.h +59 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_sasl.c +225 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_sasl.h +44 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_server.c +159 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_server.h +93 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_stats.c +454 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_storage.c +514 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_storage.h +107 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_strerror.c +92 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_string.c +138 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_string.h +53 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_types.h +44 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_util.h +15 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_verbosity.c +36 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_version.c +112 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_watchpoint.h +38 -0
- data/ext/libmemcached-0.32/libmemcached/murmur_hash.c +76 -0
- data/ext/libmemcached-0.32/libmemcached/visibility.h +51 -0
- data/ext/libmemcached-0.32/libmemcachedutil/Makefile.am +11 -0
- data/ext/libmemcached-0.32/libmemcachedutil/Makefile.in +602 -0
- data/ext/libmemcached-0.32/libmemcachedutil/libmemcachedutil.ver +1 -0
- data/ext/libmemcached-0.32/libmemcachedutil/memcached_pool.c +170 -0
- data/ext/libmemcached-0.32/m4/ac_cxx_compile_stdcxx_0x.m4 +103 -0
- data/ext/libmemcached-0.32/m4/ac_cxx_header_stdcxx_98.m4 +67 -0
- data/ext/libmemcached-0.32/m4/acx_pthread.m4 +276 -0
- data/ext/libmemcached-0.32/m4/byteorder.m4 +40 -0
- data/ext/libmemcached-0.32/m4/deprecated.m4 +17 -0
- data/ext/libmemcached-0.32/m4/enable_utillib.m4 +16 -0
- data/ext/libmemcached-0.32/m4/extensions.m4 +94 -0
- data/ext/libmemcached-0.32/m4/hsieh.m4 +18 -0
- data/ext/libmemcached-0.32/m4/lib-prefix.m4 +221 -0
- data/ext/libmemcached-0.32/m4/libtool.m4 +7360 -0
- data/ext/libmemcached-0.32/m4/ltoptions.m4 +368 -0
- data/ext/libmemcached-0.32/m4/ltsugar.m4 +123 -0
- data/ext/libmemcached-0.32/m4/ltversion.m4 +23 -0
- data/ext/libmemcached-0.32/m4/lt~obsolete.m4 +92 -0
- data/ext/libmemcached-0.32/m4/memcached.m4 +30 -0
- data/ext/libmemcached-0.32/m4/pandora_64bit.m4 +55 -0
- data/ext/libmemcached-0.32/m4/pandora_canonical.m4 +151 -0
- data/ext/libmemcached-0.32/m4/pandora_check_compiler_version.m4 +37 -0
- data/ext/libmemcached-0.32/m4/pandora_check_cxx_standard.m4 +16 -0
- data/ext/libmemcached-0.32/m4/pandora_enable_dtrace.m4 +41 -0
- data/ext/libmemcached-0.32/m4/pandora_ensure_gcc_version.m4 +36 -0
- data/ext/libmemcached-0.32/m4/pandora_have_better_malloc.m4 +54 -0
- data/ext/libmemcached-0.32/m4/pandora_have_sasl.m4 +133 -0
- data/ext/libmemcached-0.32/m4/pandora_header_assert.m4 +23 -0
- data/ext/libmemcached-0.32/m4/pandora_libtool.m4 +15 -0
- data/ext/libmemcached-0.32/m4/pandora_optimize.m4 +79 -0
- data/ext/libmemcached-0.32/m4/pandora_shared_ptr.m4 +56 -0
- data/ext/libmemcached-0.32/m4/pandora_vc_build.m4 +32 -0
- data/ext/libmemcached-0.32/m4/pandora_warnings.m4 +262 -0
- data/ext/libmemcached-0.32/m4/pod2man.m4 +7 -0
- data/ext/libmemcached-0.32/m4/protocol_binary.m4 +23 -0
- data/ext/libmemcached-0.32/m4/setsockopt.m4 +57 -0
- data/ext/libmemcached-0.32/m4/visibility.m4 +52 -0
- data/ext/libmemcached-0.32/support/Makefile.am +4 -0
- data/ext/libmemcached-0.32/support/Makefile.in +485 -0
- data/ext/libmemcached-0.32/support/libmemcached-fc.spec.in +105 -0
- data/ext/libmemcached-0.32/support/libmemcached.pc.in +10 -0
- data/ext/libmemcached-0.32/support/libmemcached.spec +105 -0
- data/ext/libmemcached-0.32/support/libmemcached.spec.in +105 -0
- data/ext/libmemcached-0.32/support/set_benchmark.sh +5 -0
- data/ext/libmemcached-0.32/tests/Makefile.am +105 -0
- data/ext/libmemcached-0.32/tests/Makefile.in +748 -0
- data/ext/libmemcached-0.32/tests/atomsmasher.c +245 -0
- data/ext/libmemcached-0.32/tests/function.c +4781 -0
- data/ext/libmemcached-0.32/tests/ketama_test_cases.h +108 -0
- data/ext/libmemcached-0.32/tests/output.cmp +7 -0
- data/ext/libmemcached-0.32/tests/output.res +7 -0
- data/ext/libmemcached-0.32/tests/output2.res +46 -0
- data/ext/libmemcached-0.32/tests/plus.cpp +293 -0
- data/ext/libmemcached-0.32/tests/r/memcat.res +19 -0
- data/ext/libmemcached-0.32/tests/r/memcp.res +27 -0
- data/ext/libmemcached-0.32/tests/r/memrm.res +19 -0
- data/ext/libmemcached-0.32/tests/r/memslap.res +33 -0
- data/ext/libmemcached-0.32/tests/r/memstat.res +33 -0
- data/ext/libmemcached-0.32/tests/server.c +118 -0
- data/ext/libmemcached-0.32/tests/server.h +25 -0
- data/ext/libmemcached-0.32/tests/start.c +16 -0
- data/ext/libmemcached-0.32/tests/t/memcat.test +4 -0
- data/ext/libmemcached-0.32/tests/t/memcp.test +3 -0
- data/ext/libmemcached-0.32/tests/t/memrm.test +3 -0
- data/ext/libmemcached-0.32/tests/t/memslap.test +5 -0
- data/ext/libmemcached-0.32/tests/t/memstat.test +3 -0
- data/ext/libmemcached-0.32/tests/test.c +137 -0
- data/ext/libmemcached-0.32/tests/test.h +46 -0
- data/ext/libmemcached-0.32/tests/udp.c +76 -0
- data/memcached.gemspec +4 -4
- data/test/unit/memcached_test.rb +30 -0
- metadata +213 -16
- data/ext/libmemcached-0.32.tar.gz +0 -0
- data/ext/libmemcached-1.patch +0 -270
- data/ext/libmemcached-10.patch +0 -12
- data/ext/libmemcached-2.patch +0 -116
- data/ext/libmemcached-3.patch +0 -8
- data/ext/libmemcached-4.patch +0 -40
- data/ext/libmemcached-5.patch +0 -832
- data/ext/libmemcached-6.patch +0 -20
- data/ext/libmemcached-7.patch +0 -2989
- data/ext/libmemcached-8.patch +0 -137
- data/ext/libmemcached-9.patch +0 -13
- data/ext/sasl.patch +0 -29283
Binary file
|
data/ext/libmemcached-1.patch
DELETED
@@ -1,270 +0,0 @@
|
|
1
|
-
|
2
|
-
diff --git a/libmemcached-0.32/libmemcached/memcached_response.c b/libmemcached/libmemcached/memcached_response.c
|
3
|
-
--- a/libmemcached-0.32/libmemcached/memcached_response.c
|
4
|
-
+++ b/libmemcached/libmemcached/memcached_response.c
|
5
|
-
@@ -496,6 +496,8 @@
|
6
|
-
case PROTOCOL_BINARY_RESPONSE_E2BIG:
|
7
|
-
case PROTOCOL_BINARY_RESPONSE_EINVAL:
|
8
|
-
case PROTOCOL_BINARY_RESPONSE_NOT_STORED:
|
9
|
-
+ rc= MEMCACHED_NOTSTORED;
|
10
|
-
+ break;
|
11
|
-
case PROTOCOL_BINARY_RESPONSE_UNKNOWN_COMMAND:
|
12
|
-
case PROTOCOL_BINARY_RESPONSE_ENOMEM:
|
13
|
-
default:
|
14
|
-
diff --git a/libmemcached-0.32/libmemcached/memcached.c b/libmemcached/libmemcached/memcached.c
|
15
|
-
--- a/libmemcached-0.32/libmemcached/memcached.c
|
16
|
-
+++ b/libmemcached/libmemcached/memcached.c
|
17
|
-
@@ -50,6 +50,9 @@ void memcached_free(memcached_st *ptr)
|
18
|
-
if (ptr->continuum)
|
19
|
-
ptr->call_free(ptr, ptr->continuum);
|
20
|
-
|
21
|
-
+ if (ptr->live_host_indices)
|
22
|
-
+ ptr->call_free(ptr, ptr->live_host_indices);
|
23
|
-
+
|
24
|
-
if (ptr->is_allocated)
|
25
|
-
ptr->call_free(ptr, ptr);
|
26
|
-
else
|
27
|
-
diff --git a/libmemcached-0.32/libmemcached/memcached.h b/libmemcached/libmemcached/memcached.h
|
28
|
-
--- a/libmemcached-0.32/libmemcached/memcached.h
|
29
|
-
+++ b/libmemcached/libmemcached/memcached.h
|
30
|
-
@@ -112,6 +112,9 @@ struct memcached_st {
|
31
|
-
memcached_trigger_delete_key delete_trigger;
|
32
|
-
char prefix_key[MEMCACHED_PREFIX_KEY_MAX_SIZE];
|
33
|
-
uint32_t number_of_replicas;
|
34
|
-
+ uint32_t number_of_live_hosts;
|
35
|
-
+ uint32_t *live_host_indices;
|
36
|
-
+ uint32_t live_host_indices_size;
|
37
|
-
};
|
38
|
-
|
39
|
-
LIBMEMCACHED_API
|
40
|
-
diff --git a/libmemcached-0.32/libmemcached/memcached_connect.c b/libmemcached/libmemcached/memcached_connect.c
|
41
|
-
--- a/libmemcached-0.32/libmemcached/memcached_connect.c
|
42
|
-
+++ b/libmemcached/libmemcached/memcached_connect.c
|
43
|
-
@@ -273,7 +272,6 @@ static memcached_return network_connect(memcached_server_st *ptr)
|
44
|
-
(void)fcntl(ptr->fd, F_SETFL, flags & ~O_NONBLOCK);
|
45
|
-
|
46
|
-
WATCHPOINT_ASSERT(ptr->cursor_active == 0);
|
47
|
-
- ptr->server_failure_counter= 0;
|
48
|
-
return MEMCACHED_SUCCESS;
|
49
|
-
}
|
50
|
-
use = use->ai_next;
|
51
|
-
@@ -282,21 +280,13 @@ static memcached_return network_connect(memcached_server_st *ptr)
|
52
|
-
|
53
|
-
if (ptr->fd == -1)
|
54
|
-
{
|
55
|
-
- /* Failed to connect. schedule next retry */
|
56
|
-
- if (ptr->root->retry_timeout)
|
57
|
-
- {
|
58
|
-
- struct timeval next_time;
|
59
|
-
-
|
60
|
-
- if (gettimeofday(&next_time, NULL) == 0)
|
61
|
-
- ptr->next_retry= next_time.tv_sec + ptr->root->retry_timeout;
|
62
|
-
- }
|
63
|
-
- ptr->server_failure_counter+= 1;
|
64
|
-
+ ptr->server_failure_counter ++;
|
65
|
-
if (ptr->cached_errno == 0)
|
66
|
-
return MEMCACHED_TIMEOUT;
|
67
|
-
+
|
68
|
-
return MEMCACHED_ERRNO; /* The last error should be from connect() */
|
69
|
-
}
|
70
|
-
|
71
|
-
- ptr->server_failure_counter= 0;
|
72
|
-
return MEMCACHED_SUCCESS; /* The last error should be from connect() */
|
73
|
-
}
|
74
|
-
|
75
|
-
@@ -315,7 +305,7 @@ memcached_return memcached_connect(memcached_server_st *ptr)
|
76
|
-
gettimeofday(&next_time, NULL);
|
77
|
-
|
78
|
-
/* if we've had too many consecutive errors on this server, mark it dead. */
|
79
|
-
- if (ptr->server_failure_counter > ptr->root->server_failure_limit)
|
80
|
-
+ if (ptr->server_failure_counter >= ptr->root->server_failure_limit)
|
81
|
-
{
|
82
|
-
ptr->next_retry= next_time.tv_sec + ptr->root->retry_timeout;
|
83
|
-
ptr->server_failure_counter= 0;
|
84
|
-
diff --git a/libmemcached-0.32/libmemcached/memcached_get.h b/libmemcached/libmemcached/memcached_get.h
|
85
|
-
diff --git a/libmemcached-0.32/libmemcached/memcached_hash.c b/libmemcached/libmemcached/memcached_hash.c
|
86
|
-
index 129d761..3a7fa55 100644
|
87
|
-
--- a/libmemcached-0.32/libmemcached/memcached_hash.c
|
88
|
-
+++ b/libmemcached/libmemcached/memcached_hash.c
|
89
|
-
@@ -11,6 +11,7 @@ static uint32_t FNV_32_PRIME= 16777619;
|
90
|
-
/* Prototypes */
|
91
|
-
static uint32_t internal_generate_hash(const char *key, size_t key_length);
|
92
|
-
static uint32_t internal_generate_md5(const char *key, size_t key_length);
|
93
|
-
+uint32_t memcached_live_host_index(memcached_st *ptr, uint32_t num);
|
94
|
-
|
95
|
-
uint32_t memcached_generate_hash_value(const char *key, size_t key_length, memcached_hash hash_algorithm)
|
96
|
-
{
|
97
|
-
@@ -146,10 +144,10 @@ static uint32_t dispatch_host(memcached_st *ptr, uint32_t hash)
|
98
|
-
right= begin;
|
99
|
-
return right->index;
|
100
|
-
}
|
101
|
-
- case MEMCACHED_DISTRIBUTION_MODULA:
|
102
|
-
- return hash % ptr->number_of_hosts;
|
103
|
-
+ case MEMCACHED_DISTRIBUTION_MODULA:
|
104
|
-
+ return memcached_live_host_index(ptr, hash);
|
105
|
-
case MEMCACHED_DISTRIBUTION_RANDOM:
|
106
|
-
- return (uint32_t) random() % ptr->number_of_hosts;
|
107
|
-
+ return memcached_live_host_index(ptr, (uint32_t) random());
|
108
|
-
default:
|
109
|
-
WATCHPOINT_ASSERT(0); /* We have added a distribution without extending the logic */
|
110
|
-
return hash % ptr->number_of_hosts;
|
111
|
-
@@ -201,6 +199,19 @@ uint32_t memcached_generate_hash(memcached_st *ptr, const char *key, size_t key_
|
112
|
-
return dispatch_host(ptr, hash);
|
113
|
-
}
|
114
|
-
|
115
|
-
+uint32_t memcached_live_host_index(memcached_st *ptr, uint32_t num)
|
116
|
-
+{
|
117
|
-
+ if (memcached_behavior_get(ptr, MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS)) {
|
118
|
-
+ if (ptr->number_of_live_hosts > 0) {
|
119
|
-
+ return ptr->live_host_indices[num % ptr->number_of_live_hosts];
|
120
|
-
+ } else {
|
121
|
-
+ return 0; /* FIXME: we should do something different if every server's dead, but I dunno what. */
|
122
|
-
+ }
|
123
|
-
+ } else {
|
124
|
-
+ return num % ptr->number_of_hosts;
|
125
|
-
+ }
|
126
|
-
+}
|
127
|
-
+
|
128
|
-
static uint32_t internal_generate_hash(const char *key, size_t key_length)
|
129
|
-
{
|
130
|
-
const char *ptr= key;
|
131
|
-
diff --git a/libmemcached-0.32/libmemcached/memcached_hosts.c b/libmemcached/libmemcached/memcached_hosts.c
|
132
|
-
--- a/libmemcached-0.32/libmemcached/memcached_hosts.c
|
133
|
-
+++ b/libmemcached/libmemcached/memcached_hosts.c
|
134
|
-
@@ -7,6 +7,7 @@ static memcached_return server_add(memcached_st *ptr, const char *hostname,
|
135
|
-
uint32_t weight,
|
136
|
-
memcached_connection type);
|
137
|
-
memcached_return update_continuum(memcached_st *ptr);
|
138
|
-
+memcached_return update_live_host_indices(memcached_st *ptr);
|
139
|
-
|
140
|
-
static int compare_servers(const void *p1, const void *p2)
|
141
|
-
{
|
142
|
-
@@ -44,8 +45,12 @@ memcached_return run_distribution(memcached_st *ptr)
|
143
|
-
case MEMCACHED_DISTRIBUTION_MODULA:
|
144
|
-
if (ptr->flags & MEM_USE_SORT_HOSTS)
|
145
|
-
sort_hosts(ptr);
|
146
|
-
+ if (memcached_behavior_get(ptr, MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS))
|
147
|
-
+ update_live_host_indices(ptr);
|
148
|
-
break;
|
149
|
-
case MEMCACHED_DISTRIBUTION_RANDOM:
|
150
|
-
+ if (memcached_behavior_get(ptr, MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS))
|
151
|
-
+ update_live_host_indices(ptr);
|
152
|
-
break;
|
153
|
-
default:
|
154
|
-
WATCHPOINT_ASSERT(0); /* We have added a distribution without extending the logic */
|
155
|
-
@@ -85,6 +90,46 @@ static uint32_t ketama_server_hash(const char *key, unsigned int key_length, int
|
156
|
-
| (results[0 + alignment * 4] & 0xFF);
|
157
|
-
}
|
158
|
-
|
159
|
-
+memcached_return update_live_host_indices(memcached_st *ptr)
|
160
|
-
+{
|
161
|
-
+ uint32_t host_index;
|
162
|
-
+ struct timeval now;
|
163
|
-
+ uint32_t i = 0;
|
164
|
-
+ memcached_server_st *list;
|
165
|
-
+
|
166
|
-
+ if (gettimeofday(&now, NULL) != 0)
|
167
|
-
+ {
|
168
|
-
+ ptr->cached_errno = errno;
|
169
|
-
+ return MEMCACHED_ERRNO;
|
170
|
-
+ }
|
171
|
-
+
|
172
|
-
+ if (ptr->live_host_indices == NULL) {
|
173
|
-
+ ptr->live_host_indices = (uint32_t *)ptr->call_malloc(ptr, sizeof(uint32_t) * ptr->number_of_hosts);
|
174
|
-
+ ptr->live_host_indices_size = ptr->number_of_live_hosts;
|
175
|
-
+ }
|
176
|
-
+
|
177
|
-
+ /* somehow we added some hosts. Shouldn't get here much, if at all. */
|
178
|
-
+ if (ptr->live_host_indices_size < ptr->number_of_hosts ) {
|
179
|
-
+ ptr->live_host_indices = (uint32_t *)ptr->call_realloc(ptr, ptr->live_host_indices, sizeof(uint32_t) * ptr->number_of_hosts);
|
180
|
-
+ ptr->live_host_indices_size = ptr->number_of_live_hosts;
|
181
|
-
+ }
|
182
|
-
+
|
183
|
-
+ if (ptr->live_host_indices == NULL)
|
184
|
-
+ return MEMCACHED_FAILURE;
|
185
|
-
+
|
186
|
-
+ list = ptr->hosts;
|
187
|
-
+ for (host_index= 0; host_index < ptr->number_of_hosts; ++host_index)
|
188
|
-
+ {
|
189
|
-
+ if (list[host_index].next_retry <= now.tv_sec) {
|
190
|
-
+ ptr->live_host_indices[i++] = host_index;
|
191
|
-
+ } else if (ptr->next_distribution_rebuild == 0 || list[host_index].next_retry < ptr->next_distribution_rebuild) {
|
192
|
-
+ ptr->next_distribution_rebuild= list[host_index].next_retry;
|
193
|
-
+ }
|
194
|
-
+ }
|
195
|
-
+ ptr->number_of_live_hosts = i;
|
196
|
-
+ return MEMCACHED_SUCCESS;
|
197
|
-
+}
|
198
|
-
+
|
199
|
-
static int continuum_item_cmp(const void *t1, const void *t2)
|
200
|
-
{
|
201
|
-
memcached_continuum_item_st *ct1= (memcached_continuum_item_st *)t1;
|
202
|
-
@@ -111,8 +156,8 @@ memcached_return update_continuum(memcached_st *ptr)
|
203
|
-
uint32_t pointer_per_server= MEMCACHED_POINTS_PER_SERVER;
|
204
|
-
uint32_t pointer_per_hash= 1;
|
205
|
-
uint64_t total_weight= 0;
|
206
|
-
- uint64_t is_ketama_weighted= 0;
|
207
|
-
- uint64_t is_auto_ejecting= 0;
|
208
|
-
+ uint32_t is_ketama_weighted= 0;
|
209
|
-
+ uint32_t is_auto_ejecting= 0;
|
210
|
-
uint32_t points_per_server= 0;
|
211
|
-
uint32_t live_servers= 0;
|
212
|
-
struct timeval now;
|
213
|
-
diff --git a/libmemcached-0.32/libmemcached/memcached_storage.c b/libmemcached/libmemcached/memcached_storage.c
|
214
|
-
index ecefc56..ee79a7e 100644
|
215
|
-
--- a/libmemcached-0.32/libmemcached/memcached_storage.c
|
216
|
-
+++ b/libmemcached/libmemcached/memcached_storage.c
|
217
|
-
@@ -135,22 +135,16 @@ static inline memcached_return memcached_send(memcached_st *ptr,
|
218
|
-
}
|
219
|
-
|
220
|
-
if (write_length >= MEMCACHED_DEFAULT_COMMAND_SIZE)
|
221
|
-
- {
|
222
|
-
- rc= MEMCACHED_WRITE_FAILURE;
|
223
|
-
- goto error;
|
224
|
-
- }
|
225
|
-
+ return MEMCACHED_WRITE_FAILURE;
|
226
|
-
|
227
|
-
/* Send command header */
|
228
|
-
rc= memcached_do(&ptr->hosts[server_key], buffer, write_length, 0);
|
229
|
-
if (rc != MEMCACHED_SUCCESS)
|
230
|
-
- goto error;
|
231
|
-
+ return rc;
|
232
|
-
|
233
|
-
/* Send command body */
|
234
|
-
if ((sent_length= memcached_io_write(&ptr->hosts[server_key], value, value_length, 0)) == -1)
|
235
|
-
- {
|
236
|
-
- rc= MEMCACHED_WRITE_FAILURE;
|
237
|
-
- goto error;
|
238
|
-
- }
|
239
|
-
+ return MEMCACHED_WRITE_FAILURE;
|
240
|
-
|
241
|
-
if ((ptr->flags & MEM_BUFFER_REQUESTS) && verb == SET_OP)
|
242
|
-
to_write= 0;
|
243
|
-
@@ -158,10 +152,7 @@ static inline memcached_return memcached_send(memcached_st *ptr,
|
244
|
-
to_write= 1;
|
245
|
-
|
246
|
-
if ((sent_length= memcached_io_write(&ptr->hosts[server_key], "\r\n", 2, to_write)) == -1)
|
247
|
-
- {
|
248
|
-
- rc= MEMCACHED_WRITE_FAILURE;
|
249
|
-
- goto error;
|
250
|
-
- }
|
251
|
-
+ return MEMCACHED_WRITE_FAILURE;
|
252
|
-
|
253
|
-
if (ptr->flags & MEM_NOREPLY)
|
254
|
-
return (to_write == 0) ? MEMCACHED_BUFFERED : MEMCACHED_SUCCESS;
|
255
|
-
@@ -170,15 +161,8 @@ static inline memcached_return memcached_send(memcached_st *ptr,
|
256
|
-
return MEMCACHED_BUFFERED;
|
257
|
-
|
258
|
-
rc= memcached_response(&ptr->hosts[server_key], buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, NULL);
|
259
|
-
-
|
260
|
-
if (rc == MEMCACHED_STORED)
|
261
|
-
- return MEMCACHED_SUCCESS;
|
262
|
-
- else
|
263
|
-
- return rc;
|
264
|
-
-
|
265
|
-
-error:
|
266
|
-
- memcached_io_reset(&ptr->hosts[server_key]);
|
267
|
-
-
|
268
|
-
+ return MEMCACHED_SUCCESS;
|
269
|
-
return rc;
|
270
|
-
}
|
data/ext/libmemcached-10.patch
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
diff -uwr a/libmemcached-0.32/libmemcached/memcached_connect.c b/libmemcached-0.32/libmemcached/memcached_connect.c
|
2
|
-
--- a/libmemcached-0.32/libmemcached/memcached_connect.c 2011-04-25 11:14:16.000000000 -0700
|
3
|
-
+++ b/libmemcached-0.32/libmemcached/memcached_connect.c 2011-04-25 11:08:49.000000000 -0700
|
4
|
-
@@ -242,6 +242,8 @@
|
5
|
-
|
6
|
-
if (error != 1 || fds[0].revents & POLLERR)
|
7
|
-
{
|
8
|
-
+ ptr->cached_errno = 0;
|
9
|
-
+
|
10
|
-
if (fds[0].revents & POLLERR)
|
11
|
-
{
|
12
|
-
int err;
|
data/ext/libmemcached-2.patch
DELETED
@@ -1,116 +0,0 @@
|
|
1
|
-
diff --git a/libmemcached-0.32/libmemcached/memcached.h libmemcached/libmemcached/memcached.h
|
2
|
-
--- a/libmemcached-0.32/libmemcached/memcached.h
|
3
|
-
+++ b/libmemcached/libmemcached/memcached.h
|
4
|
-
@@ -119,6 +119,7 @@
|
5
|
-
#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
|
6
|
-
const sasl_callback_t *sasl_callbacks;
|
7
|
-
#endif
|
8
|
-
+ int last_server_key;
|
9
|
-
};
|
10
|
-
|
11
|
-
LIBMEMCACHED_API
|
12
|
-
diff --git a/libmemcached-0.32/libmemcached/memcached_get.c libmemcached/libmemcached/memcached_get.c
|
13
|
-
--- a/libmemcached-0.32/libmemcached/memcached_get.c
|
14
|
-
+++ b/libmemcached/libmemcached/memcached_get.c
|
15
|
-
@@ -235,6 +235,8 @@
|
16
|
-
rc= MEMCACHED_SOME_ERRORS;
|
17
|
-
continue;
|
18
|
-
}
|
19
|
-
+
|
20
|
-
+ ptr->last_server_key = server_key;
|
21
|
-
}
|
22
|
-
|
23
|
-
/*
|
24
|
-
@@ -256,6 +258,74 @@
|
25
|
-
return rc;
|
26
|
-
}
|
27
|
-
|
28
|
-
+
|
29
|
-
+char *memcached_get_from_last(memcached_st *ptr,
|
30
|
-
+ const char *key,
|
31
|
-
+ size_t key_length,
|
32
|
-
+ size_t *value_length,
|
33
|
-
+ uint32_t *flags,
|
34
|
-
+ memcached_return *error)
|
35
|
-
+{
|
36
|
-
+ memcached_return rc = MEMCACHED_NOTFOUND;
|
37
|
-
+ char *value = NULL;
|
38
|
-
+
|
39
|
-
+ if (memcached_server_response_count(&ptr->hosts[ptr->last_server_key]) == 0) {
|
40
|
-
+ *error = memcached_connect(&ptr->hosts[ptr->last_server_key]);
|
41
|
-
+
|
42
|
-
+ if (*error != MEMCACHED_SUCCESS) {
|
43
|
-
+ return value;
|
44
|
-
+ }
|
45
|
-
+
|
46
|
-
+ if ((memcached_io_write(&ptr->hosts[ptr->last_server_key], "get ", 4, 0)) == -1) {
|
47
|
-
+ *error = MEMCACHED_SOME_ERRORS;
|
48
|
-
+ return value;
|
49
|
-
+ }
|
50
|
-
+ WATCHPOINT_ASSERT(ptr->hosts[ptr->last_server_key].cursor_active == 0);
|
51
|
-
+ memcached_server_response_increment(&ptr->hosts[ptr->last_server_key]);
|
52
|
-
+ WATCHPOINT_ASSERT(ptr->hosts[ptr->last_server_key].cursor_active == 1);
|
53
|
-
+ }
|
54
|
-
+
|
55
|
-
+ /* Only called when we have a prefix key */
|
56
|
-
+ if (ptr->prefix_key[0] != 0) {
|
57
|
-
+ if ((memcached_io_write(&ptr->hosts[ptr->last_server_key], ptr->prefix_key, ptr->prefix_key_length, 0)) == -1) {
|
58
|
-
+ memcached_server_response_reset(&ptr->hosts[ptr->last_server_key]);
|
59
|
-
+ *error = MEMCACHED_SOME_ERRORS;
|
60
|
-
+ return value;
|
61
|
-
+ }
|
62
|
-
+ }
|
63
|
-
+
|
64
|
-
+ if ((memcached_io_write(&ptr->hosts[ptr->last_server_key], key, key_length, 0)) == -1) {
|
65
|
-
+ memcached_server_response_reset(&ptr->hosts[ptr->last_server_key]);
|
66
|
-
+ *error = MEMCACHED_SOME_ERRORS;
|
67
|
-
+ return value;
|
68
|
-
+ }
|
69
|
-
+
|
70
|
-
+ if ((memcached_io_write(&ptr->hosts[ptr->last_server_key], "\r\n", 2, 1)) == -1) {
|
71
|
-
+ memcached_server_response_reset(&ptr->hosts[ptr->last_server_key]);
|
72
|
-
+ *error = MEMCACHED_SOME_ERRORS;
|
73
|
-
+ return value;
|
74
|
-
+ }
|
75
|
-
+
|
76
|
-
+ value = memcached_fetch(ptr, NULL, NULL, value_length, flags, error);
|
77
|
-
+
|
78
|
-
+ /* This is for historical reasons */
|
79
|
-
+ if (*error == MEMCACHED_END)
|
80
|
-
+ *error = MEMCACHED_NOTFOUND;
|
81
|
-
+
|
82
|
-
+ if (value != NULL) {
|
83
|
-
+ size_t dummy_length;
|
84
|
-
+ uint32_t dummy_flags;
|
85
|
-
+ memcached_return dummy_error;
|
86
|
-
+
|
87
|
-
+ (void)memcached_fetch(ptr, NULL, NULL,
|
88
|
-
+ &dummy_length, &dummy_flags,
|
89
|
-
+ &dummy_error);
|
90
|
-
+ WATCHPOINT_ASSERT(dummy_length == 0);
|
91
|
-
+ }
|
92
|
-
+
|
93
|
-
+ return value;
|
94
|
-
+}
|
95
|
-
+
|
96
|
-
static memcached_return simple_binary_mget(memcached_st *ptr,
|
97
|
-
unsigned int master_server_key,
|
98
|
-
bool is_master_key_set,
|
99
|
-
diff --git a/libmemcached-0.32/libmemcached/memcached_get.h libmemcached/libmemcached/memcached_get.h
|
100
|
-
--- a/libmemcached-0.32/libmemcached/memcached_get.h
|
101
|
-
+++ b/libmemcached/libmemcached/memcached_get.h
|
102
|
-
@@ -53,7 +53,13 @@
|
103
|
-
memcached_result_st *result,
|
104
|
-
memcached_return *error);
|
105
|
-
|
106
|
-
-
|
107
|
-
+LIBMEMCACHED_API
|
108
|
-
+char *memcached_get_from_last(memcached_st *ptr,
|
109
|
-
+ const char *key,
|
110
|
-
+ size_t key_length,
|
111
|
-
+ size_t *value_length,
|
112
|
-
+ uint32_t *flags,
|
113
|
-
+ memcached_return *error);
|
114
|
-
|
115
|
-
#ifdef __cplusplus
|
116
|
-
}
|
data/ext/libmemcached-3.patch
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
diff --git a/libmemcached-0.32/libmemcached/memcached_storage.c libmemcached/libmemcached/memcached_storage.c
|
2
|
-
--- a/libmemcached-0.32/libmemcached/memcached_storage.c
|
3
|
-
+++ b/libmemcached/libmemcached/memcached_storage.c
|
4
|
-
149c149,150
|
5
|
-
< if ((ptr->flags & MEM_BUFFER_REQUESTS) && verb == SET_OP)
|
6
|
-
---
|
7
|
-
> if ((ptr->flags & MEM_BUFFER_REQUESTS) &&
|
8
|
-
> (verb == SET_OP || verb == PREPEND_OP || verb == APPEND_OP))
|
data/ext/libmemcached-4.patch
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
diff --git a/libmemcached-0.32/clients/utilities.c b/libmemcached-0.32/clients/utilities.c
|
2
|
-
--- a/libmemcached-0.32/clients/utilities.c
|
3
|
-
+++ b/libmemcached-0.32/clients/utilities.c
|
4
|
-
@@ -99,6 +99,8 @@ void process_hash_option(memcached_st *memc, char *opt_hash)
|
5
|
-
set= MEMCACHED_HASH_FNV1_32;
|
6
|
-
else if (!strcasecmp(opt_hash, "FNV1A_32"))
|
7
|
-
set= MEMCACHED_HASH_FNV1A_32;
|
8
|
-
+ else if (!strcasecmp(opt_hash, "NONE"))
|
9
|
-
+ set= MEMCACHED_HASH_NONE;
|
10
|
-
else
|
11
|
-
{
|
12
|
-
fprintf(stderr, "hash: type not recognized %s\n", opt_hash);
|
13
|
-
diff --git a/libmemcached-0.32/libmemcached/memcached_constants.h b/libmemcached-0.32/libmemcached/memcached_constants.h
|
14
|
-
--- a/libmemcached-0.32/libmemcached/memcached_constants.h
|
15
|
-
+++ b/libmemcached-0.32/libmemcached/memcached_constants.h
|
16
|
-
@@ -132,7 +132,8 @@ typedef enum {
|
17
|
-
MEMCACHED_HASH_FNV1A_32,
|
18
|
-
MEMCACHED_HASH_HSIEH,
|
19
|
-
MEMCACHED_HASH_MURMUR,
|
20
|
-
- MEMCACHED_HASH_JENKINS
|
21
|
-
+ MEMCACHED_HASH_JENKINS,
|
22
|
-
+ MEMCACHED_HASH_NONE
|
23
|
-
} memcached_hash;
|
24
|
-
|
25
|
-
typedef enum {
|
26
|
-
diff --git a/libmemcached-0.32/libmemcached/memcached_hash.c b/libmemcached-0.32/libmemcached/memcached_hash.c
|
27
|
-
--- a/libmemcached-0.32/libmemcached/memcached_hash.c
|
28
|
-
+++ b/libmemcached-0.32/libmemcached/memcached_hash.c
|
29
|
-
@@ -96,6 +96,11 @@ uint32_t memcached_generate_hash_value(const char *key, size_t key_length, memca
|
30
|
-
hash=jenkins_hash(key, key_length, 13);
|
31
|
-
break;
|
32
|
-
}
|
33
|
-
+ case MEMCACHED_HASH_NONE:
|
34
|
-
+ {
|
35
|
-
+ hash= 1;
|
36
|
-
+ break;
|
37
|
-
+ }
|
38
|
-
default:
|
39
|
-
{
|
40
|
-
WATCHPOINT_ASSERT(hash_algorithm);
|