Skip to content

getAllKeys returns an empty array on server 1.5+ #367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
scara opened this issue Sep 9, 2017 · 7 comments
Open

getAllKeys returns an empty array on server 1.5+ #367

scara opened this issue Sep 9, 2017 · 7 comments

Comments

@scara
Copy link

scara commented Sep 9, 2017

Here is a run of the same code against server 1.4 and 1.5:

# docker-compose up
Starting mdl60037_memcached15_1
Starting mdl60037_memcached14_1
Recreating mdl60037_runner_1
Attaching to mdl60037_memcached15_1, mdl60037_memcached14_1, mdl60037_runner_1
runner_1       | Running memcached extension 3.0.2 against memcached server 1.4.39 (memcached14)...
runner_1       | Expecting 'int' key on memcached14 to be: (int)99...
runner_1       | int(99)
runner_1       | Expecting all keys on memcached14 to be: 'int' => (int)99...
runner_1       | array(1) {
runner_1       |   [0]=>
runner_1       |   string(3) "int"
runner_1       | }
runner_1       | Running memcached extension 3.0.2 against memcached server 1.5.1 (memcached15)...
runner_1       | Expecting 'int' key on memcached15 to be: (int)99...
runner_1       | int(99)
runner_1       | Expecting all keys on memcached15 to be: 'int' => (int)99...
runner_1       | array(0) {
runner_1       | }
mdl60037_runner_1 exited with code 0

Find attached the code: MDL-60037.zip.

Matteo

@scara scara changed the title getAllKeys returns an emtpy array on server 1.5+ getAllKeys returns an empty array on server 1.5+ Sep 9, 2017
@scara
Copy link
Author

scara commented Sep 9, 2017

Not sure if related to #315.

@sodabrew
Copy link
Contributor

Yeah, this looks exactly like the circumstances for #315 - the underlying libmemcached library will stop iterating the 2nd..nth servers once it hits the error from trying to fetch keys from the 64th slab.

@scara
Copy link
Author

scara commented Sep 18, 2017

Hi @sodabrew,
the difference here is running the same code using only one server, first on 1.4x then on 1.5.x, to compare the results:

<?php

function run_test_suite($host)
{
    $extVersion = phpversion('memcached');

    $cache = new Memcached($host);
    $cache->addServer($host, 11211);
    $serverVersion = reset($cache->getVersion());
    echo "Running memcached extension $extVersion against memcached server $serverVersion ($host)...\n";

    $cache->set('int', 99);
    $key = $cache->get('int');
    echo "Expecting 'int' key on $host to be: (int)99...\n";
    var_dump($key);

    $keys = $cache->getAllKeys();
    echo "Expecting all keys on $host to be: 'int' => (int)99...\n";
    var_dump($keys);
}

// Wait 3s to be sure that memcached daemons are up&running.
sleep(3);

run_test_suite('memcached14');
run_test_suite('memcached15');

Should 1.5.x be supported the same as 1.4.x?

TIA,
Matteo

@scara
Copy link
Author

scara commented Oct 1, 2017

Bumping...
@sodabrew, any advice?

@scara
Copy link
Author

scara commented Nov 21, 2017

Bumping...
Pinging @sodabrew and @trondn to ask for thoughts about where this issue should be addressed.

TIA,
Matteo

@ZuZuD
Copy link

ZuZuD commented Mar 27, 2018

I was wondering what is the interest of such a method as it returns the keys in an inconsistent manner because based on "stats cachedump" ?

@sodabrew
Copy link
Contributor

#315 implements a workaround for the underlying libmemcached library that made a hard-coded assumption of the number of buckets in the memcached server that changed from 1.4.x to 1.5.x.

There's no active maintainer for libmemcached at this time. I do wonder if it should get adopted by https://github.com/memcached /cc @memcached ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants