mirror of
https://github.com/php/php-src.git
synced 2024-09-29 13:56:09 +00:00
The internal zval cache has been removed and not been reintroduced... remove corresponding test code
This commit is contained in:
parent
a553cc7b55
commit
e1b5476e3e
@ -1,116 +0,0 @@
|
|||||||
--TEST--
|
|
||||||
mysqli_get_cache_stats()
|
|
||||||
--XFAIL--
|
|
||||||
zval caching has been temporarily disabled for the 5.3.0 release
|
|
||||||
--INI--
|
|
||||||
mysqlnd.collect_statistics="1"
|
|
||||||
mysqlnd.collect_memory_statistics="1"
|
|
||||||
--SKIPIF--
|
|
||||||
<?PHP
|
|
||||||
require_once('skipif.inc');
|
|
||||||
require_once('skipifemb.inc');
|
|
||||||
require_once('skipifconnectfailure.inc');
|
|
||||||
if (!function_exists('mysqli_get_cache_stats')) {
|
|
||||||
die("skip only available with mysqlnd");
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
--FILE--
|
|
||||||
<?php
|
|
||||||
$tmp = $link = null;
|
|
||||||
if (!is_null($tmp = @mysqli_get_cache_stats($link)))
|
|
||||||
printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
|
|
||||||
|
|
||||||
require_once("connect.inc");
|
|
||||||
|
|
||||||
if (!is_array($info = mysqli_get_cache_stats()) || empty($info))
|
|
||||||
printf("[002] Expecting array/any_non_empty, got %s/%s\n", gettype($info), $info);
|
|
||||||
|
|
||||||
var_dump($info);
|
|
||||||
|
|
||||||
if ($info["size"] !== $info['free_items'])
|
|
||||||
printf("[003] Unused cache should have size (%d) == free_items (%d)\n",
|
|
||||||
$info["size"], $info['free_items']);
|
|
||||||
|
|
||||||
require_once('table.inc');
|
|
||||||
|
|
||||||
if (!is_array($new_info = mysqli_get_cache_stats()) || empty($new_info))
|
|
||||||
printf("[004] Expecting array/any_non_empty, got %s/%s\n", gettype($new_info), $new_info);
|
|
||||||
|
|
||||||
if ($info['size'] !== $new_info['size'])
|
|
||||||
printf("[005] Cache size should not have changes! Expecting int/%d, got %s/%d\n",
|
|
||||||
$info['size'], gettype($new_info['size']), $new_info['size']);
|
|
||||||
|
|
||||||
if (count($info) != count($new_info)) {
|
|
||||||
printf("[006] Both arrays should have the same number of entries\n");
|
|
||||||
var_dump($info);
|
|
||||||
var_dump($new_info);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id"))
|
|
||||||
printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
|
||||||
|
|
||||||
if (!is_object($res = mysqli_use_result($link)))
|
|
||||||
printf("[008] Expecting object, got %s/%s. [%d] %s\n",
|
|
||||||
gettype($res), $res, mysqli_errno($link), mysqli_error($link));
|
|
||||||
|
|
||||||
if (!$row = mysqli_fetch_assoc($res))
|
|
||||||
printf("[009] There should be at least one row in the test table for this test, [%d] %s\n",
|
|
||||||
mysqli_errno($link), mysqli_error($link));
|
|
||||||
|
|
||||||
if (!is_array($new_info = mysqli_get_cache_stats()) || empty($new_info))
|
|
||||||
printf("[010] Expecting array/any_non_empty, got %s/%s\n", gettype($new_info), $new_info);
|
|
||||||
|
|
||||||
if ($new_info['get_hits'] <= $info['get_hits'])
|
|
||||||
printf("[011] get_hits should have increased, %d (new) <= %d (old)!\n",
|
|
||||||
$new_info['get_hits'], $info['get_hits']);
|
|
||||||
|
|
||||||
if (!$row = mysqli_fetch_assoc($res))
|
|
||||||
printf("[012] There should be two rows in the test table for this test, [%d] %s\n",
|
|
||||||
mysqli_errno($link), mysqli_error($link));
|
|
||||||
|
|
||||||
if (!is_array($new_info = mysqli_get_cache_stats()) || empty($new_info))
|
|
||||||
printf("[013] Expecting array/any_non_empty, got %s/%s\n", gettype($new_info), $new_info);
|
|
||||||
|
|
||||||
if ($new_info['put_misses'] <= $info['put_misses'])
|
|
||||||
printf("[014] put_misses should have increased, %d (new) <= %d (old)!\n",
|
|
||||||
$new_info['put_misses'], $info['put_misses']);
|
|
||||||
|
|
||||||
if ($new_info['references'] < $info['references'] + 2)
|
|
||||||
printf("[015] reference counter should have increased, %d (new) < %d + 2 (old)!\n",
|
|
||||||
$new_info['references'], $info['references']);
|
|
||||||
|
|
||||||
unset($row);
|
|
||||||
mysqli_free_result($res);
|
|
||||||
|
|
||||||
if (!is_array($info = mysqli_get_cache_stats()) || empty($info))
|
|
||||||
printf("[016] Expecting array/any_non_empty, got %s/%s\n", gettype($info), $info);
|
|
||||||
|
|
||||||
if ($info['free_items'] <= $new_info['free_items'])
|
|
||||||
printf("[017] Looks like cached entries never get free'd.\n");
|
|
||||||
|
|
||||||
mysqli_close($link);
|
|
||||||
|
|
||||||
print "done!";
|
|
||||||
?>
|
|
||||||
--CLEAN--
|
|
||||||
<?php
|
|
||||||
require_once("clean_table.inc");
|
|
||||||
?>
|
|
||||||
--EXPECTF--
|
|
||||||
array(7) {
|
|
||||||
[%u|b%"put_hits"]=>
|
|
||||||
int(0)
|
|
||||||
[%u|b%"put_misses"]=>
|
|
||||||
int(0)
|
|
||||||
[%u|b%"get_hits"]=>
|
|
||||||
int(0)
|
|
||||||
[%u|b%"get_misses"]=>
|
|
||||||
int(0)
|
|
||||||
[%u|b%"size"]=>
|
|
||||||
int(%d)
|
|
||||||
[%u|b%"free_items"]=>
|
|
||||||
int(%d)
|
|
||||||
[%u|b%"references"]=>
|
|
||||||
int(%d)
|
|
||||||
}
|
|
||||||
done!
|
|
@ -1,98 +0,0 @@
|
|||||||
--TEST--
|
|
||||||
mysqli_get_cache_stats() - freeing for buffered result sets
|
|
||||||
--XFAIL--
|
|
||||||
zval caching has been temporarily disabled for the 5.3.0 release
|
|
||||||
--INI--
|
|
||||||
mysqlnd.collect_statistics="1"
|
|
||||||
mysqlnd.collect_memory_statistics="1"
|
|
||||||
--SKIPIF--
|
|
||||||
<?PHP
|
|
||||||
require_once('skipif.inc');
|
|
||||||
require_once('skipifemb.inc');
|
|
||||||
require_once('skipifconnectfailure.inc');
|
|
||||||
if (!function_exists('mysqli_get_cache_stats')) {
|
|
||||||
die("skip only available with mysqlnd");
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
--FILE--
|
|
||||||
<?php
|
|
||||||
require_once('table.inc');
|
|
||||||
|
|
||||||
if (!is_array($info = mysqli_get_cache_stats()) || empty($info))
|
|
||||||
printf("[001] Expecting array/any_non_empty, got %s/%s\n", gettype($info), $info);
|
|
||||||
|
|
||||||
if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id"))
|
|
||||||
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
|
||||||
|
|
||||||
$rows = array();
|
|
||||||
while ($rows[] = mysqli_fetch_assoc($res))
|
|
||||||
;
|
|
||||||
mysqli_free_result($res);
|
|
||||||
|
|
||||||
if (!is_array($new_info = mysqli_get_cache_stats()) || empty($new_info))
|
|
||||||
printf("[003] Expecting array/any_non_empty, got %s/%s\n", gettype($new_info), $new_info);
|
|
||||||
|
|
||||||
if ($new_info['free_items'] >= $info['free_items']) {
|
|
||||||
printf("[004] mysqli_free_result() should not yet have free slots again, because \$rows still exists\n");
|
|
||||||
var_dump($info);
|
|
||||||
var_dump($new_info);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* nothing should change because GC will happen some time after free_result */
|
|
||||||
unset($rows);
|
|
||||||
|
|
||||||
if (!is_array($new_info = mysqli_get_cache_stats()) || empty($new_info))
|
|
||||||
printf("[005] Expecting array/any_non_empty, got %s/%s\n", gettype($new_info), $new_info);
|
|
||||||
|
|
||||||
if (defined("WE_HAVE_GARBAGE_COLLECTOR_TO_FREE_AFTER_ON_UNSET_AFTER_FREE_RESULT")) {
|
|
||||||
/*
|
|
||||||
For now we can't reclaim the slots after the free_result is called.
|
|
||||||
unset() should happen before free_result().
|
|
||||||
*/
|
|
||||||
if ($new_info['free_items'] < $info['free_items']) {
|
|
||||||
printf("[006] \$rows has been unset, free item count should be back to the original value\n");
|
|
||||||
var_dump($info);
|
|
||||||
var_dump($new_info);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* We have to reset $info */
|
|
||||||
$info = mysqli_get_cache_stats();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id"))
|
|
||||||
printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
|
||||||
|
|
||||||
$rows = array();
|
|
||||||
while ($rows[] = mysqli_fetch_assoc($res))
|
|
||||||
;
|
|
||||||
unset($rows);
|
|
||||||
mysqli_free_result($res);
|
|
||||||
|
|
||||||
if (!is_array($new_info = mysqli_get_cache_stats()) || empty($new_info))
|
|
||||||
printf("[008] Expecting array/any_non_empty, got %s/%s\n", gettype($new_info), $new_info);
|
|
||||||
|
|
||||||
if ($new_info['free_items'] < $info['free_items']) {
|
|
||||||
printf("[009] \$rows has been unset, mysqli_free_result() has been called, free item count should be back to the original value\n");
|
|
||||||
var_dump($info);
|
|
||||||
var_dump($new_info);
|
|
||||||
}
|
|
||||||
|
|
||||||
mysqli_close($link);
|
|
||||||
|
|
||||||
if (!is_array($new_info = mysqli_get_cache_stats()) || empty($new_info))
|
|
||||||
printf("[010] Expecting array/any_non_empty, got %s/%s\n", gettype($new_info), $new_info);
|
|
||||||
|
|
||||||
if ($new_info['free_items'] < $info['free_items']) {
|
|
||||||
printf("[011] connection has been closed, free item count should be back to the original value\n");
|
|
||||||
var_dump($info);
|
|
||||||
var_dump($new_info);
|
|
||||||
}
|
|
||||||
|
|
||||||
print "done!";
|
|
||||||
?>
|
|
||||||
--CLEAN--
|
|
||||||
<?php
|
|
||||||
require_once("clean_table.inc");
|
|
||||||
?>
|
|
||||||
--EXPECTF--
|
|
||||||
done!
|
|
@ -57,8 +57,7 @@ require_once('skipifconnectfailure.inc');
|
|||||||
'connect_failure', 'connection_reused', 'explicit_close', 'implicit_close',
|
'connect_failure', 'connection_reused', 'explicit_close', 'implicit_close',
|
||||||
'disconnect_close', 'in_middle_of_command_close', 'explicit_free_result',
|
'disconnect_close', 'in_middle_of_command_close', 'explicit_free_result',
|
||||||
'implicit_free_result', 'explicit_stmt_close', 'implicit_stmt_close',
|
'implicit_free_result', 'explicit_stmt_close', 'implicit_stmt_close',
|
||||||
'put_hits', 'put_misses', 'get_hits', 'get_misses',
|
'size',
|
||||||
'size', 'free_items', 'references', 'mysqli.cache_size',
|
|
||||||
'mysqli.allow_local_infile',
|
'mysqli.allow_local_infile',
|
||||||
'mysqli.allow_persistent', 'mysqli.max_persistent'
|
'mysqli.allow_persistent', 'mysqli.max_persistent'
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user