Skip to content

Commit 08b39ed

Browse files
authored
Ignore specific errors from memcached_dump for getAllKeys() with newer memcached servers (#315)
1 parent a86de05 commit 08b39ed

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Diff for: php_memcached.c

+9-1
Original file line numberDiff line numberDiff line change
@@ -2725,7 +2725,15 @@ PHP_METHOD(Memcached, getAllKeys)
27252725
array_init(return_value);
27262726

27272727
rc = memcached_dump(intern->memc, callback, return_value, 1);
2728-
if (s_memc_status_handle_result_code(intern, rc) == FAILURE) {
2728+
2729+
/* Ignore two errors. libmemcached has a hardcoded loop of 200 slab
2730+
* classes that matches memcached < 1.4.24, at which version the server
2731+
* has only 63 slabs and throws an error when requesting the 64th slab.
2732+
*
2733+
* In multi-server some non-deterministic number of elements will be dropped.
2734+
*/
2735+
if (rc != MEMCACHED_CLIENT_ERROR && rc != MEMCACHED_SERVER_ERROR
2736+
&& s_memc_status_handle_result_code(intern, rc) == FAILURE) {
27292737
zval_dtor(return_value);
27302738
RETURN_FALSE;
27312739
}

0 commit comments

Comments
 (0)