<?xml version="1.0" encoding="utf-8"?>

<test>
<name>index rotation vs pconns</name>

<requires>
<non-windows/>
<non-rt/>
</requires>

<config>
indexer
{
	mem_limit = 16M
}

searchd
{
	<searchd_settings/>
	<dynamic>
	<variant>workers = none</variant>
	<variant>
		workers = threads
		binlog_path =
	</variant>
	<variant>workers = fork</variant>
	<variant>workers = prefork</variant>
	</dynamic>
}

source test1
{
	type = mysql
	<sql_settings/>
	sql_query = SELECT * FROM test_table
	sql_query_post_index = UPDATE test_table SET id=id+100
}

index test1
{
	source = test1
	path = <data_path/>/test1
}
</config>

<db_create>
CREATE TABLE test_table
(
	id INTEGER PRIMARY KEY NOT NULL AUTO_INCREMENT,
	title varchar(255) NOT NULL
);
</db_create>

<db_drop>
DROP TABLE IF EXISTS test_table;
</db_drop>

<db_insert>
INSERT INTO test_table VALUES
( 1, 'hier kommt die sonne' ),
( 2, 'hier kommt die sonne' ),
( 3, 'sie est der hellste stern von allen' ),
( 4, 'hier kommt die sonne' );
</db_insert>

<custom_test><![CDATA[
global $g_locals;

$client->Open ();
$res1 = $client->Query ( "sonne", "test1" );
unset ( $res1["time"] );

$rv = 0;
$err = "";
exec ( $g_locals["indexer"]." --config config.conf --rotate --all", $err, $rv );

usleep ( 1500000 );
$res2 = $client->Query ( "sonne", "test1" );
unset ( $res2["time"] );
$client->Close();

$results = array ( $res1, $res2 );
if ( !$res1 || !$res2 || $rv!=0 )
	$results = false;
]]></custom_test>

</test>

