svn: /pecl/mysqlnd_ms/trunk/tests/ mysqlnd_ms_filter_qos_multi_master.phpt

From: Date: Thu, 08 Dec 2011 15:49:44 +0000
Subject: svn: /pecl/mysqlnd_ms/trunk/tests/ mysqlnd_ms_filter_qos_multi_master.phpt
Groups: php.pecl.cvs 
Request: Send a blank email to pecl-cvs+get-17330@lists.php.net to get a copy of this message
uw Thu, 08 Dec 2011 15:49:44 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=320670 Log: Isolated issue. This is what makes mysqlnd_ms_filter_qos_session_consistency_mm_rr.phpt fail. Changed paths: A pecl/mysqlnd_ms/trunk/tests/mysqlnd_ms_filter_qos_multi_master.phpt Added: pecl/mysqlnd_ms/trunk/tests/mysqlnd_ms_filter_qos_multi_master.phpt =================================================================== --- pecl/mysqlnd_ms/trunk/tests/mysqlnd_ms_filter_qos_multi_master.phpt (rev 0) +++ pecl/mysqlnd_ms/trunk/tests/mysqlnd_ms_filter_qos_multi_master.phpt 2011-12-08 15:49:44 UTC (rev 320670) @@ -0,0 +1,101 @@ +--TEST-- +Filter QOS, session consistency, MM + RR +--SKIPIF-- +<?php +require_once('skipif.inc'); +require_once("connect.inc"); + +if (($emulated_master_host == $emulated_slave_host)) { + die("SKIP master and slave seem to the the same, see tests/README"); +} + +_skipif_check_extensions(array("mysqli")); +_skipif_connect($emulated_master_host_only, $user, $passwd, $db, $emulated_master_port, $emulated_master_socket); +_skipif_connect($emulated_slave_host_only, $user, $passwd, $db, $emulated_slave_port, $emulated_slave_socket); + +include_once("util.inc"); +$ret = mst_is_slave_of($emulated_slave_host_only, $emulated_slave_port, $emulated_slave_socket, $emulated_master_host_only, $emulated_master_port, $emulated_master_socket, $user, $passwd, $db); +if (is_string($ret)) + die(sprintf("SKIP Failed to check relation of configured master and slave, %s\n", $ret)); + +if (true == $ret) + die("SKIP Configured emulated master and emulated slave could be part of a replication cluster\n"); + +$settings = array( + "myapp" => array( + 'master' => array( + "master1" => array( + 'host' => $emulated_master_host_only, + 'port' => (int)$emulated_master_port, + 'socket' => $emulated_master_socket, + ), + "master2" => array( + 'host' => $emulated_master_host_only, + 'port' => (int)$emulated_master_port, + 'socket' => $emulated_master_socket, + ), + ), + 'slave' => array( + "slave1" => array( + 'host' => $emulated_slave_host_only, + 'port' => (int)$emulated_slave_port, + 'socket' => $emulated_slave_socket, + ), + ), + + 'lazy_connections' => 0, + + 'filters' => array( + "quality_of_service" => array( + "session_consistency" => 1, + ), + "roundrobin" => array(), + ), + ), + +); +if ($error = mst_create_config("test_mysqlnd_ms_filter_qos_multi_master.ini", $settings)) + die(sprintf("SKIP %s\n", $error)); + +msg_mysqli_init_emulated_id_skip($emulated_slave_host, $user, $passwd, $db, $emulated_slave_port, $emulated_slave_socket, "slave1"); +msg_mysqli_init_emulated_id_skip($emulated_master_host, $user, $passwd, $db, $emulated_master_port, $emulated_master_socket, "master[1,2]"); +?> +--INI-- +mysqlnd_ms.enable=1 +mysqlnd_ms.ini_file=test_mysqlnd_ms_filter_qos_multi_master.ini +mysqlnd_ms.multi_master=1 +--FILE-- +<?php + require_once("connect.inc"); + require_once("util.inc"); + + $link = mst_mysqli_connect("myapp", $user, $passwd, $db, $port, $socket); + if (mysqli_connect_errno()) { + printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + } + + + $link->query("SELECT 1 FROM DUAL"); + + print "done!"; +?> +--CLEAN-- +<?php + if (!unlink("test_mysqlnd_ms_filter_qos_multi_master.ini")) + printf("[clean] Cannot unlink ini file 'test_mysqlnd_ms_filter_qos_multi_master.ini'.\n"); +?> +--EXPECTF-- +At least two issues here. + +Issue 1 - round robin vs. random + + Round robin and random return different types of errors + One gives E_WARNING, the other give E_RECOVERABLE_ERROR. + Filters should use the same error class for the same issue. + +Issue 2 - why is there an error? + + Multi master is turned on. Why does it bail at all. + An empty slave list is not necessarily an error. + With multi master activated, it should be common case + to have no slaves. \ No newline at end of file

« previous php.pecl.cvs (#17330) next »