1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
|
<?xml version="1.0" encoding="utf-8"?>
<test>
<name>persistent MVA updates surviving after hard killing part 1 - *nix only</name>
<requires>
<non-windows/>
</requires>
<config>
indexer
{
mem_limit = 16M
}
searchd
{
<searchd_settings/>
binlog_flush = 2
binlog_path = <data_path/>
workers = threads
}
source src
{
type = mysql
<sql_settings/>
sql_query = SELECT id, text, section, mva1 FROM test_table
sql_attr_uint = section
<Dynamic>
<Variant>sql_attr_multi = uint mva1 from field mva1</Variant>
<Variant>sql_attr_multi = bigint mva1 from field mva1</Variant>
</Dynamic>
}
index idx_130
{
source = src
path = <data_path/>/idx_130
docinfo = extern
}
</config>
<custom_test><![CDATA[
$results = array ();
// update that block
for ( $i = 0; $i < 4; $i++)
{
$results[] = sprintf( "iteration=%d", $i );
$up = $client->UpdateAttributes ( "idx_130", array("mva1"), array(1=>array(array(2,3,4)), 3=>array(array(6,7,8))),true);
if ( $up >= 0 )
$results[] = sprintf("up.ok=%d", $up);
else
$results[] = sprintf("up.err=%s", $client->GetLastError());
KillSearchd ( 'config.conf', 'searchd.pid', 'KILL', false );
usleep ( 50000 );
$error = "";
$startSta = StartSearchd ( 'config.conf', 'error.txt', 'searchd.pid', $error );
if ( $startSta == 0 || $startSta == 2 )
{
$results[] = "started=ok";
}
else
$results[] = sprintf("start.err=%d local=%s client=%s", $startSta, $error, $client->GetLastError());
}
// find the updated match
$results[] = $client->Query ( "test3");
// regression:
// rotation reset index name and TID
$results[] = 'rotaiting...';
RunIndexer ( $errors, '--all --rotate' );
usleep ( 50000 );
$up = $client->UpdateAttributes ( "idx_130", array("mva1"), array(2=>array(array(1,2,7))),true);
if ( $up >= 0 )
$results[] = sprintf("up.ok=%d", $up);
else
$results[] = sprintf("up.err=%s", $client->GetLastError());
KillSearchd ( 'config.conf', 'searchd.pid', 'KILL', false );
usleep ( 50000 );
$error = "";
$startSta = StartSearchd ( 'config.conf', 'error.txt', 'searchd.pid', $error );
if ( $startSta == 0 || $startSta == 2 )
{
$results[] = "started=ok";
}
else
{
$results[] = sprintf("start.err=%d local=%s client=%s", $startSta, $error, $client->GetLastError());
}
$results[] = $client->Query ( 'test2' );
// final fixup; we don't want to compare times
for ( $i=0; $i<count($results); $i++ )
CompareResultSetFixup ( $results[$i], 0, true );
]]></custom_test>
<DB_Create>
CREATE TABLE `test_table` (
`id` int(11) DEFAULT NULL,
`text` varchar (255) NOT NULL,
`section` int(11) DEFAULT NULL,
`mva1` varchar(255) NOT NULL
)
</DB_Create>
<DB_Drop>
DROP TABLE IF EXISTS `test_table`
</DB_Drop>
<DB_Insert>
INSERT INTO `test_table` (`id`, `text`, `section`, `mva1`) VALUES
(1, 'test1', 101, '1001'),
(2, 'test2', 102, '1002 1023 4456'),
(3, 'test3', 103, '1003 1008 1010'),
(4, 'test4', 104, '1004 1005 1006');
</DB_Insert>
</test>
|