Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Blocker
-
Resolution: Fixed
-
Affects Version/s: 1.0.5, 1.1.0-dp1, 1.1.0-dp2
-
Fix Version/s: None
-
Component/s: library
-
Security Level: Public
-
Labels:None
Description
Zlib compression is broken. This means large payloads are never compressed on the network.
class Compression extends CouchbaseTestCommon {
function testCompression() {
if (!extension_loaded('zlib')) {
$this->markTestSkipped("Need Zlib extension");
}
$h = make_handle();
$hnc = make_handle();
$curcomp = couchbase_get_option($h, COUCHBASE_OPT_COMPRESSION);
$this->assertEquals(COUCHBASE::COMPRESSION_NONE, $curcomp);
couchbase_set_option($h, COUCHBASE_OPT_COMPRESSION,
COUCHBASE::COMPRESSION_ZLIB);
$curcomp = couchbase_get_option($h, COUCHBASE_OPT_COMPRESSION);
$this->assertEquals(COUCHBASE_COMPRESSION_ZLIB, $curcomp);
couchbase_set_option($hnc, COUCHBASE_OPT_COMPRESSION,
COUCHBASE::COMPRESSION_NONE);
$inikey = "couchbase.compression_threshold";
$this->assertGreaterThan(0, ini_get($inikey));
$this->assertTrue((bool)ini_alter($inikey,"10"));
$this->assertEquals(10, ini_get($inikey));
# Set a compressed value
$v = str_repeat("long_value", 500);
$ol = strlen($v);
//$key = $this->mk_key();
$key = "compressed_data";
$rv = couchbase_set($h, $key, $v);
$this->assertNotEmpty($rv);
$comp = couchbase_get_option($h, COUCHBASE_OPT_COMPRESSION);
print $comp . "\n";
# Hack, append resets the flags, clearing the compression state.
$rv = couchbase_append($hnc, $key, '_');
$this->assertNotEmpty($rv);
$ret = couchbase_get($hnc, $key);
$this->assertNotNull($ret);
$this->assertLessThan($ol, strlen($ret));
}
}
class Compression extends CouchbaseTestCommon {
function testCompression() {
if (!extension_loaded('zlib')) {
$this->markTestSkipped("Need Zlib extension");
}
$h = make_handle();
$hnc = make_handle();
$curcomp = couchbase_get_option($h, COUCHBASE_OPT_COMPRESSION);
$this->assertEquals(COUCHBASE::COMPRESSION_NONE, $curcomp);
couchbase_set_option($h, COUCHBASE_OPT_COMPRESSION,
COUCHBASE::COMPRESSION_ZLIB);
$curcomp = couchbase_get_option($h, COUCHBASE_OPT_COMPRESSION);
$this->assertEquals(COUCHBASE_COMPRESSION_ZLIB, $curcomp);
couchbase_set_option($hnc, COUCHBASE_OPT_COMPRESSION,
COUCHBASE::COMPRESSION_NONE);
$inikey = "couchbase.compression_threshold";
$this->assertGreaterThan(0, ini_get($inikey));
$this->assertTrue((bool)ini_alter($inikey,"10"));
$this->assertEquals(10, ini_get($inikey));
# Set a compressed value
$v = str_repeat("long_value", 500);
$ol = strlen($v);
//$key = $this->mk_key();
$key = "compressed_data";
$rv = couchbase_set($h, $key, $v);
$this->assertNotEmpty($rv);
$comp = couchbase_get_option($h, COUCHBASE_OPT_COMPRESSION);
print $comp . "\n";
# Hack, append resets the flags, clearing the compression state.
$rv = couchbase_append($hnc, $key, '_');
$this->assertNotEmpty($rv);
$ret = couchbase_get($hnc, $key);
$this->assertNotNull($ret);
$this->assertLessThan($ol, strlen($ret));
}
}
PHP Warning: PHP Startup: Unable to load dynamic library '/home/mnunberg/src/php-ext-couchbase-1.0.x/modules/pdo.so' - /home/mnunberg/src/php-ext-couchbase-1.0.x/modules/pdo.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHPUnit 3.6.12 by Sebastian Bergmann.
PHP Fatal error: Out of memory (allocated 3145728) (tried to allocate 4992063506150606153 bytes) in /home/mnunberg/src/php-couchbase-tests/unit/Compression.php on line 54
PHP Stack trace:
PHP 1. {main}() /usr/bin/phpunit:0
PHP 2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:46
PHP 3. PHPUnit_TextUI_Command->run() /usr/share/php/PHPUnit/TextUI/Command.php:130
PHP 4. PHPUnit_TextUI_TestRunner->doRun() /usr/share/php/PHPUnit/TextUI/Command.php:192
PHP 5. PHPUnit_Framework_TestSuite->run() /usr/share/php/PHPUnit/TextUI/TestRunner.php:325
PHP 6. PHPUnit_Framework_TestSuite->runTest() /usr/share/php/PHPUnit/Framework/TestSuite.php:745
PHP 7. PHPUnit_Framework_TestCase->run() /usr/share/php/PHPUnit/Framework/TestSuite.php:772
PHP 8. PHPUnit_Framework_TestResult->run() /usr/share/php/PHPUnit/Framework/TestCase.php:751
PHP 9. PHPUnit_Framework_TestCase->runBare() /usr/share/php/PHPUnit/Framework/TestResult.php:649
PHP 10. PHPUnit_Framework_TestCase->runTest() /usr/share/php/PHPUnit/Framework/TestCase.php:804
PHP 11. ReflectionMethod->invokeArgs() /usr/share/php/PHPUnit/Framework/TestCase.php:942
PHP 12. Compression->testCompression() /usr/share/php/PHPUnit/Framework/TestCase.php:942
PHP 13. couchbase_get() /home/mnunberg/src/php-couchbase-tests/unit/Compression.php:54
couchbase_50493659660c9