Skip to content

test: compression edge case verification #256

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

Closed

Conversation

dictcp
Copy link
Contributor

@dictcp dictcp commented Jun 10, 2016

@dictcp dictcp changed the title test: verify #255 test: compression edge case verification Jun 10, 2016
@sodabrew
Copy link
Contributor

The tests fail with this error:

016+ Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 1701998440 bytes) in /tmp/php-memcached-build/memcached-3.0.0a1/tests/compression_conditions.php on line 41

The allowed memory size is a PHP config item. The test file could try adding this code to raise the limit:

    ini_set('memory_limit', '200M');

If you have time to revisit this code, please also rebase to master branch since php7 has merged (just as on #255 as well).

@dictcp dictcp force-pushed the test-compress-conditions branch from 5c70a8a to 666238e Compare January 24, 2017 05:44
@dictcp dictcp changed the base branch from php7 to master January 24, 2017 05:46
@dictcp
Copy link
Contributor Author

dictcp commented Jan 24, 2017

@sodabrew it should work after #255 is merged. and the memory allocation issue is due to the previous (incorrect) logic on compression flag handling

@sodabrew sodabrew modified the milestones: 3.0.1, 3.0.0 Jan 24, 2017
@sodabrew
Copy link
Contributor

Now that #255 is landed could you rebase this so we can confirm that tests pass?

@sodabrew
Copy link
Contributor

========DIFF========
009+ bool(false)
009- bool(true)
022+ bool(false)
022- bool(true)
========DONE========
FAIL Memcached compression test [tests/compression_conditions.phpt] 

@dictcp dictcp force-pushed the test-compress-conditions branch from 666238e to e932eed Compare January 25, 2017 01:34
@sodabrew
Copy link
Contributor

sodabrew commented Jan 25, 2017

I think the failures are this one (bool on line 9)

Expected:
 len=[7] set=[zlib] factor=[1.3] threshold=[4]
 Memcached::set(): could not compress value
 bool(true)
Actual:
 len=[7] set=[zlib] factor=[1.3] threshold=[4]
 Memcached::set(): could not compress value
 bool(false)

And this one (bool on line 22)

Expected:
 len=[7] set=[zlib] factor=[0.3] threshold=[4]
 Memcached::set(): could not compress value
 bool(true)
Actual:
 len=[7] set=[zlib] factor=[0.3] threshold=[4]
 Memcached::set(): could not compress value
 bool(false)

In both cases the false corresponds with an expected error. Wouldn't it make sense to expect false to go along with that error?

@sodabrew
Copy link
Contributor

Oh, oh I see - the false indicates that the value did not round-trip correctly through memcached:

       $m->set($key, $value, 1800);
       $value_back = $m->get($key);
       var_dump($value === $value_back);

@sodabrew
Copy link
Contributor

I don't really see the point for this block of code:

        if (!compress_status) {
                php_error_docref(NULL, E_WARNING, "could not compress value");
                efree (buffer);
                return 0;
        }

If the value was not compressed, then it won't be flagged as compressed, and so it'll go into memcached uncompressed. I see no problem with that.

sodabrew pushed a commit to sodabrew/php-memcached that referenced this pull request Jan 25, 2017
test compressed SET/GET under various settings of
- compression_factor
- compression_threshold
- data length
@sodabrew
Copy link
Contributor

Merged to master as 7283b11

@sodabrew sodabrew closed this Jan 25, 2017
@dictcp
Copy link
Contributor Author

dictcp commented Jan 25, 2017

thanks @sodabrew. my bad on overlooking during rebase.

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

Successfully merging this pull request may close these issues.

2 participants