[prev in list] [next in list] [prev in thread] [next in thread]
List: pecl-cvs
Subject: [PECL-CVS] =?utf-8?q?svn:_/pecl/mysqlnd=5Fmux/_CHANGES_mysqlnd=5Fmux.c_tests/mysqlnd=5Fmux=5Fasync.p
From: Ulf_Wendel <uw () php ! net>
Date: 2012-08-28 18:28:04
Message-ID: svn-uw-1346178484-327341-790290570 () svn ! php ! net
[Download RAW message or body]
uw Tue, 28 Aug 2012 18:28:04 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=327341
Log:
CHANGES, more tests, minor tweaking
Changed paths:
A pecl/mysqlnd_mux/CHANGES
U pecl/mysqlnd_mux/mysqlnd_mux.c
U pecl/mysqlnd_mux/tests/mysqlnd_mux_async.phpt
A pecl/mysqlnd_mux/tests/mysqlnd_mux_constants.phpt
A pecl/mysqlnd_mux/tests/mysqlnd_mux_phpinfo.phpt
U pecl/mysqlnd_mux/tests/mysqlnd_mux_playground.phpt
A pecl/mysqlnd_mux/tests/mysqlnd_mux_reflection_extension.phpt
U pecl/mysqlnd_mux/tests/mysqlnd_mux_scheme.phpt
U pecl/mysqlnd_mux/tests/mysqlnd_mux_unbuffered.phpt
["svn-diffs-327341.txt" (text/x-diff)]
Added: pecl/mysqlnd_mux/CHANGES
===================================================================
--- pecl/mysqlnd_mux/CHANGES (rev 0)
+++ pecl/mysqlnd_mux/CHANGES 2012-08-28 18:28:04 UTC (rev 327341)
@@ -0,0 +1,7 @@
+1.0 pre-alpha
+
+ Release date: 09/2012
+ Motto/theme : Proof-of-concept
+
+ * Initial check-in
+ * Hardly more than a demo of the mysqlnd
Modified: pecl/mysqlnd_mux/mysqlnd_mux.c
===================================================================
--- pecl/mysqlnd_mux/mysqlnd_mux.c 2012-08-28 16:53:46 UTC (rev 327340)
+++ pecl/mysqlnd_mux/mysqlnd_mux.c 2012-08-28 18:28:04 UTC (rev 327341)
@@ -20,7 +20,7 @@
/*
Notes:
-
+
1. Scheme is used for hashing, because MUX works mostly on the NET level,
where credentials are unknown - they are part of the procotol, not of
the connection management - this is more like OSI L1, not L2 or above.
@@ -385,7 +385,7 @@
(*net_data_pp)->original_send = net->data->m.send_ex;
net->data->m.receive_ex = mysqlnd_mux_receive_record;
net->data->m.send_ex = mysqlnd_mux_send_record;
-
+
if ((*net_data_pp)->recorded_data) {
FREE_SMART_STR_AND_CONTAINER_AND_NULL((*net_data_pp)->recorded_data, \
PERSISTENT_STR); }
@@ -612,7 +612,7 @@
/* don't sleep in the same thread, return failure */
pthread_mutex_unlock(&(*net_data_pp)->share->LOCK_use);
SET_CLIENT_ERROR(*conn->error_info, CR_CONNECTION_ERROR, UNKNOWN_SQLSTATE, \
"Cannot run second query on the same connection in the same thread");
- DBG_RETURN(FAIL);
+ DBG_RETURN(FAIL);
}
while (TRUE == (*net_data_pp)->share->in_use) {
DBG_INF("GOTTA WAIT!");
@@ -625,7 +625,7 @@
} while (0);
pthread_mutex_unlock(&(*net_data_pp)->share->LOCK_use);
#endif
-
+
ret = mux_orig_mysqlnd_conn_methods->send_query(conn, query, query_len TSRMLS_CC);
DBG_RETURN(ret);
@@ -703,7 +703,7 @@
enum_func_status ret;
MYSQLND_MUX_NET_DATA ** net_data_pp = (MYSQLND_MUX_NET_DATA **) \
mysqlnd_plugin_get_plugin_net_data(result->conn->net, mysqlnd_mux_plugin_id); \
DBG_ENTER("mysqlnd_mux_fetch_row_unbuffered");
-
+
ret = (*net_data_pp)->original_fetch_row_unbuffered(result, param, flags, \
fetched_anything TSRMLS_CC);
if (FALSE == *fetched_anything && result->unbuf->eof_reached) {
@@ -711,8 +711,8 @@
(*net_data_pp)->share->in_use = FALSE;
(*net_data_pp)->share->in_use_by = NULL;
pthread_cond_signal(&(*net_data_pp)->share->COND_use);
- pthread_mutex_unlock(&(*net_data_pp)->share->LOCK_use);
-
+ pthread_mutex_unlock(&(*net_data_pp)->share->LOCK_use);
+
result->m.fetch_row = result->m.fetch_row_normal_unbuffered = \
(*net_data_pp)->original_fetch_row_unbuffered; }
DBG_RETURN(ret);
@@ -886,7 +886,7 @@
NULL,
PHP_MINFO(mysqlnd_mux),
#if ZEND_MODULE_API_NO >= 20010901
- "0.1", /* Replace with version number for your extension */
+ MYSQLND_MUX_VERSION,
#endif
STANDARD_MODULE_PROPERTIES
};
Modified: pecl/mysqlnd_mux/tests/mysqlnd_mux_async.phpt
===================================================================
--- pecl/mysqlnd_mux/tests/mysqlnd_mux_async.phpt 2012-08-28 16:53:46 UTC (rev \
327340)
+++ pecl/mysqlnd_mux/tests/mysqlnd_mux_async.phpt 2012-08-28 18:28:04 UTC (rev \
327341) @@ -5,7 +5,7 @@
require_once("skipif.inc");
_skipif_check_extensions("mysqli");
_skipif_connect($host, $user, $passwd, $db, $port, $socket);
-die("skip Async is unsupported");
+die("SKIP Know PoC limitation - XFAIL takes too long");
?>
--INI--
mysqlnd_mux.enable=1
@@ -59,6 +59,8 @@
print "done!";
?>
--CLEAN--
+--XFAIL--
+Known PoC limitation: ansynchronous queries are not supported by the PoC
--EXPECTF--
Reply from link%d
Reply from link%d
Added: pecl/mysqlnd_mux/tests/mysqlnd_mux_constants.phpt
===================================================================
--- pecl/mysqlnd_mux/tests/mysqlnd_mux_constants.phpt (rev 0)
+++ pecl/mysqlnd_mux/tests/mysqlnd_mux_constants.phpt 2012-08-28 18:28:04 UTC (rev \
327341) @@ -0,0 +1,40 @@
+--TEST--
+Exported constants
+--SKIPIF--
+<?php
+require_once("skipif.inc");
+?>
+--INI--
+mysqlnd_mux.enable=1
+--FILE--
+<?php
+ $expected = array(
+ "MYSQLND_MUX_VERSION" => true,
+ "MYSQLND_MUX_VERSION_ID" => true,
+ );
+
+
+ $constants = get_defined_constants(true);
+ $constants = (isset($constants['mysqlnd_mux'])) ? $constants['mysqlnd_mux'] : \
array(); + ksort($constants);
+ foreach ($constants as $name => $value) {
+ if (isset($expected[$name])) {
+ printf("%s = '%s'\n", $name, $value);
+ unset($expected[$name]);
+ } else {
+ printf("[001] UNKNOWN %s = '%s'\n", $name, $value);
+ }
+ }
+
+ if (!empty($expected)) {
+ printf("[002] Dumping list of missing constants\n");
+ var_dump($expected);
+ }
+
+ print "done!";
+?>
+--CLEAN--
+--EXPECTF--
+MYSQLND_MUX_VERSION = '1.0.0-alpha'
+MYSQLND_MUX_VERSION_ID = '10000'
+done!
\ No newline at end of file
Added: pecl/mysqlnd_mux/tests/mysqlnd_mux_phpinfo.phpt
===================================================================
--- pecl/mysqlnd_mux/tests/mysqlnd_mux_phpinfo.phpt (rev 0)
+++ pecl/mysqlnd_mux/tests/mysqlnd_mux_phpinfo.phpt 2012-08-28 18:28:04 UTC (rev \
327341) @@ -0,0 +1,26 @@
+--TEST--
+phpinfo()
+--SKIPIF--
+<?php
+require_once("skipif.inc");
+?>
+--INI--
+mysqlnd_mux.enable=1
+--FILE--
+<?php
+ ob_start();
+ phpinfo(INFO_MODULES);
+ $tmp = ob_get_contents();
+ ob_end_clean();
+
+ if (!stristr($tmp, 'mysqlnd_mux support'))
+ printf("[001] mysqlnd_mux section seems to be missing. Check manually\n");
+
+ if (!stristr($tmp, 'Mysqlnd multiplexing plugin version'))
+ printf("[002] mysqlnd_mux version seems to be missing. Check manually\n");
+
+ print "done!";
+?>
+--CLEAN--
+--EXPECTF--
+done!
\ No newline at end of file
Modified: pecl/mysqlnd_mux/tests/mysqlnd_mux_playground.phpt
===================================================================
--- pecl/mysqlnd_mux/tests/mysqlnd_mux_playground.phpt 2012-08-28 16:53:46 UTC (rev \
327340)
+++ pecl/mysqlnd_mux/tests/mysqlnd_mux_playground.phpt 2012-08-28 18:28:04 UTC (rev \
327341) @@ -8,7 +8,6 @@
?>
--INI--
mysqlnd_mux.enable=1
-mysqlnd.debug=d:t:O,/tmp/mysqlnd.trace
--FILE--
<?php
require_once("connect.inc");
@@ -33,25 +32,16 @@
$res = $link2->query("SELECT @myvar");
var_dump($res->fetch_assoc());
- $start = microtime(true);
- $link2->query("SELECT SLEEP(1)");
- printf("Slept on link2 for %2.2fs\n", microtime(true) - $start);
- $start = microtime(true);
- $link1->query("SELECT SLEEP(1)");
- printf("Slept on link1 for %2.2fs\n", microtime(true) - $start);
- $link1->query("KILL CONNECTION_ID()");
- var_dump($link1->error);
- $link2->query("SELECT 1");
- var_dump($link2->error);
-
-
print "done!";
?>
---XFAIL--
-Playground
--CLEAN--
--EXPECTF--
int(%d)
-int(%d)
\ No newline at end of file
+int(%d)
+array(1) {
+ ["@myvar"]=>
+ string(1) "2"
+}
+done!
\ No newline at end of file
Added: pecl/mysqlnd_mux/tests/mysqlnd_mux_reflection_extension.phpt
===================================================================
--- pecl/mysqlnd_mux/tests/mysqlnd_mux_reflection_extension.phpt \
(rev 0)
+++ pecl/mysqlnd_mux/tests/mysqlnd_mux_reflection_extension.phpt 2012-08-28 18:28:04 \
UTC (rev 327341) @@ -0,0 +1,72 @@
+--TEST--
+ReflectionExtension basics to check API
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+?>
+--FILE--
+<?php
+ $r = new ReflectionExtension("mysqlnd_mux");
+
+ printf("Name: %s\n", $r->name);
+
+ printf("Version: %s\n", $r->getVersion());
+ if ($r->getVersion() != MYSQLND_MUX_VERSION) {
+ printf("[001] Expecting version '%s' got '%s'\n", MYSQLND_MUX_VERSION, \
$r->getVersion()); + }
+
+ $classes = $r->getClasses();
+ if (!empty($classes)) {
+ printf("[002] Expecting no class\n");
+ asort($classes);
+ var_dump($classes);
+ }
+
+ $expected = array(
+ 'mysqlnd' => true,
+ );
+
+ $dependencies = $r->getDependencies();
+ asort($dependencies);
+ printf("Dependencies:\n");
+ foreach ($dependencies as $what => $how) {
+ printf(" %s - %s, ", $what, $how);
+ if (isset($expected[$what])) {
+ unset($expected[$what]);
+ } else {
+ printf("Unexpected extension dependency with %s - %s\n", $what, $how);
+ }
+ }
+ if (!empty($expected)) {
+ printf("Dumping list of missing extension dependencies\n");
+ var_dump($expected);
+ }
+ printf("\n");
+
+ $ignore = array();
+
+ $functions = $r->getFunctions();
+ asort($functions);
+ printf("Functions:\n");
+ foreach ($functions as $func) {
+ if (isset($ignore[$func->name])) {
+ unset($ignore[$func->name]);
+ } else {
+ printf(" %s\n", $func->name);
+ }
+ }
+ if (!empty($ignore)) {
+ printf("Dumping version dependent and missing functions\n");
+ var_dump($ignore);
+ }
+
+
+ print "done!";
+?>
+--EXPECTF--
+Name: mysqlnd_mux
+Version: 1.0.0-alpha
+Dependencies:
+ mysqlnd - Required%s
+Functions:
+done!
\ No newline at end of file
Modified: pecl/mysqlnd_mux/tests/mysqlnd_mux_scheme.phpt
===================================================================
--- pecl/mysqlnd_mux/tests/mysqlnd_mux_scheme.phpt 2012-08-28 16:53:46 UTC (rev \
327340)
+++ pecl/mysqlnd_mux/tests/mysqlnd_mux_scheme.phpt 2012-08-28 18:28:04 UTC (rev \
327341) @@ -16,17 +16,24 @@
$link1 = mux_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
if (mysqli_connect_errno()) {
printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ } else {
+ printf("First connection %d\n", $link1->thread_id);
}
- $link2 = mux_mysqli_connect($host, "bla", "blubb", $db, $port, $socket);
+ $link2 = @mux_mysqli_connect($host, "bla", "blubb", $db, $port, $socket);
if (mysqli_connect_errno()) {
printf("[002] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ } else {
+ printf("Second connection %d\n", $link2->thread_id);
}
+
print "done!";
?>
--CLEAN--
--XFAIL--
Know PoC limitation: MUX will not distinguish between the two connections
--EXPECTF--
-Huhu, I have stolen your connection!
\ No newline at end of file
+First connection %d
+[002] [%d] %s
+done!
Modified: pecl/mysqlnd_mux/tests/mysqlnd_mux_unbuffered.phpt
===================================================================
--- pecl/mysqlnd_mux/tests/mysqlnd_mux_unbuffered.phpt 2012-08-28 16:53:46 UTC (rev \
327340)
+++ pecl/mysqlnd_mux/tests/mysqlnd_mux_unbuffered.phpt 2012-08-28 18:28:04 UTC (rev \
327341) @@ -45,10 +45,32 @@
$res->close();
}
+ if (!($res = $link2->use_result())) {
+ printf("[007] [%d] %s\n", $link2->errno, $link2->error);
+ } else {
+ while ($row = $res->fetch_assoc()) {
+ var_dump($row);
+ }
+ $res->close();
+ }
+
+ if (!($res = $link1->query("SELECT 3 AS _three"))) {
+ printf("[008] [%d] %s\n", $link1->errno, $link1->error);
+ } else {
+ var_dump($res->fetch_assoc());
+ }
+
+ if (!($res = $link2->query("SELECT 4 AS _four"))) {
+ printf("[009] [%d] %s\n", $link2->errno, $link2->error);
+ } else {
+ var_dump($res->fetch_assoc());
+ }
+
print "done!";
?>
--CLEAN--
--XFAIL--
-Known PoC limitation: unbuffered connections are not supported
+Known PoC limitation: unbuffered is not fully supported
--EXPECTF--
-Something useful
\ No newline at end of file
+All results
+done!
\ No newline at end of file
--
PECL CVS Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic