Skip to content
Permalink
Browse files

fixed #715 deadlock at ATTACH index to itself; added regression to te…

…st 187
  • Loading branch information...
tomatolog committed Mar 6, 2019
1 parent 250b3f0 commit 3562f652753e4091fd7b5b0f65b58341c8cbcb31
Showing with 45 additions and 18 deletions.
  1. +22 −17 src/searchd.cpp
  2. +1 −1 test/test_187/model.bin
  3. +22 −0 test/test_187/test.xml
@@ -16328,25 +16328,30 @@ void HandleMysqlAttach ( SqlRowBuffer_c & tOut, const SqlStmt_t & tStmt )
auto pServedFrom = GetServed ( sFrom );
auto pServedTo = GetServed ( sTo );

ServedDescWPtr_c pFrom ( pServedFrom ); // write-lock
ServedDescWPtr_c pTo ( pServedTo ) ; // write-lock

if ( !pFrom
|| !pTo
|| pFrom->m_eType!=IndexType_e::PLAIN
|| pTo->m_eType!=IndexType_e::RT )
{
if ( !pFrom )
tOut.ErrorEx ( MYSQL_ERR_PARSE_ERROR, "no such index '%s'", sFrom.cstr() );
else if ( !pTo )
tOut.ErrorEx ( MYSQL_ERR_PARSE_ERROR, "no such index '%s'", sTo.cstr() );
else if ( pFrom->m_eType!=IndexType_e::PLAIN )
tOut.Error ( tStmt.m_sStmt, "1st argument to ATTACH must be a plain index" );
else if ( pTo->m_eType!=IndexType_e::RT )
tOut.Error ( tStmt.m_sStmt, "2nd argument to ATTACH must be a RT index" );
return;
// need just read lock for initial checks and prevent deadlock of attaching index to itself
{
ServedDescRPtr_c pFrom ( pServedFrom );
ServedDescRPtr_c pTo ( pServedTo ) ;

if ( !pFrom
|| !pTo
|| pFrom->m_eType!=IndexType_e::PLAIN
|| pTo->m_eType!=IndexType_e::RT )
{
if ( !pFrom )
tOut.ErrorEx ( MYSQL_ERR_PARSE_ERROR, "no such index '%s'", sFrom.cstr() );
else if ( !pTo )
tOut.ErrorEx ( MYSQL_ERR_PARSE_ERROR, "no such index '%s'", sTo.cstr() );
else if ( pFrom->m_eType!=IndexType_e::PLAIN )
tOut.Error ( tStmt.m_sStmt, "1st argument to ATTACH must be a plain index" );
else if ( pTo->m_eType!=IndexType_e::RT )
tOut.Error ( tStmt.m_sStmt, "2nd argument to ATTACH must be a RT index" );
return;
}
}

ServedDescWPtr_c pFrom ( pServedFrom ); // write-lock
ServedDescWPtr_c pTo ( pServedTo ) ; // write-lock

auto * pRtTo = ( ISphRtIndex * ) pTo->m_pIndex;

@@ -1 +1 @@
a:1:{i:0;a:33:{i:0;a:2:{s:8:"sphinxql";s:16:"SELECT * FROM rt";s:10:"total_rows";i:0;}i:1;a:3:{s:8:"sphinxql";s:18:"SELECT * FROM disk";s:10:"total_rows";i:4;s:4:"rows";a:4:{i:0;a:2:{s:2:"id";s:1:"1";s:3:"gid";s:2:"11";}i:1;a:2:{s:2:"id";s:1:"2";s:3:"gid";s:2:"11";}i:2;a:2:{s:2:"id";s:1:"3";s:3:"gid";s:2:"11";}i:3;a:2:{s:2:"id";s:1:"4";s:3:"gid";s:2:"11";}}}i:2;a:3:{s:8:"sphinxql";s:38:"SELECT * FROM disk WHERE MATCH('thee')";s:10:"total_rows";i:2;s:4:"rows";a:2:{i:0;a:2:{s:2:"id";s:1:"1";s:3:"gid";s:2:"11";}i:1;a:2:{s:2:"id";s:1:"3";s:3:"gid";s:2:"11";}}}i:3;a:3:{s:8:"sphinxql";s:56:"SELECT * FROM disk WHERE MATCH('under') order by id desc";s:10:"total_rows";i:1;s:4:"rows";a:1:{i:0;a:2:{s:2:"id";s:1:"4";s:3:"gid";s:2:"11";}}}i:4;a:2:{s:8:"sphinxql";s:31:"ATTACH INDEX disk TO RTINDEX rt";s:14:"total_affected";i:0;}i:5;a:3:{s:8:"sphinxql";s:16:"SELECT * FROM rt";s:10:"total_rows";i:4;s:4:"rows";a:4:{i:0;a:2:{s:2:"id";s:1:"1";s:3:"gid";s:2:"11";}i:1;a:2:{s:2:"id";s:1:"2";s:3:"gid";s:2:"11";}i:2;a:2:{s:2:"id";s:1:"3";s:3:"gid";s:2:"11";}i:3;a:2:{s:2:"id";s:1:"4";s:3:"gid";s:2:"11";}}}i:6;a:3:{s:8:"sphinxql";s:18:"SELECT * FROM disk";s:5:"error";s:48:"unknown local index(es) 'disk' in search request";s:5:"errno";i:1064;}i:7;a:3:{s:8:"sphinxql";s:36:"SELECT * FROM rt WHERE MATCH('thee')";s:10:"total_rows";i:2;s:4:"rows";a:2:{i:0;a:2:{s:2:"id";s:1:"1";s:3:"gid";s:2:"11";}i:1;a:2:{s:2:"id";s:1:"3";s:3:"gid";s:2:"11";}}}i:8;a:3:{s:8:"sphinxql";s:18:"DESC rt like '_i%'";s:10:"total_rows";i:2;s:4:"rows";a:2:{i:0;a:2:{s:5:"Field";s:5:"title";s:4:"Type";s:5:"field";}i:1;a:2:{s:5:"Field";s:3:"gid";s:4:"Type";s:4:"uint";}}}i:9;a:2:{s:8:"sphinxql";s:76:"INSERT INTO rt ( id, gid, title ) VALUES ( 10, 22, 'I dub thee unforgiven' )";s:14:"total_affected";i:1;}i:10;a:3:{s:8:"sphinxql";s:36:"SELECT * FROM rt WHERE MATCH('thee')";s:10:"total_rows";i:3;s:4:"rows";a:3:{i:0;a:2:{s:2:"id";s:2:"10";s:3:"gid";s:2:"22";}i:1;a:2:{s:2:"id";s:1:"1";s:3:"gid";s:2:"11";}i:2;a:2:{s:2:"id";s:1:"3";s:3:"gid";s:2:"11";}}}i:11;a:2:{s:8:"sphinxql";s:100:"INSERT INTO rt ( id, gid, title ) VALUES ( 11, 22, 'under_score_again <stuff>but got here</stuff>' )";s:14:"total_affected";i:1;}i:12;a:3:{s:8:"sphinxql";s:54:"SELECT * FROM rt WHERE MATCH('under') order by id desc";s:10:"total_rows";i:2;s:4:"rows";a:2:{i:0;a:2:{s:2:"id";s:2:"11";s:3:"gid";s:2:"22";}i:1;a:2:{s:2:"id";s:1:"4";s:3:"gid";s:2:"11";}}}i:13;a:2:{s:8:"sphinxql";s:22:"SELECT * FROM rt_arena";s:10:"total_rows";i:0;}i:14;a:2:{s:8:"sphinxql";s:38:"ATTACH INDEX plain TO RTINDEX rt_arena";s:14:"total_affected";i:0;}i:15;a:3:{s:8:"sphinxql";s:52:"SELECT * FROM rt_arena where mva1=15 order by id asc";s:10:"total_rows";i:4;s:4:"rows";a:4:{i:0;a:5:{s:2:"id";s:1:"1";s:4:"str1";s:9:"dummy for";s:4:"mva1";s:8:"15,20,55";s:4:"mva2";s:0:"";s:3:"gid";s:2:"11";}i:1;a:5:{s:2:"id";s:1:"2";s:4:"str1";s:9:"dummy for";s:4:"mva1";s:8:"15,20,55";s:4:"mva2";s:0:"";s:3:"gid";s:2:"11";}i:2;a:5:{s:2:"id";s:1:"3";s:4:"str1";s:9:"dummy for";s:4:"mva1";s:8:"15,20,55";s:4:"mva2";s:0:"";s:3:"gid";s:2:"11";}i:3;a:5:{s:2:"id";s:1:"4";s:4:"str1";s:9:"dummy for";s:4:"mva1";s:8:"15,20,55";s:4:"mva2";s:0:"";s:3:"gid";s:2:"11";}}}i:16;a:3:{s:8:"sphinxql";s:53:"SELECT * FROM rt_arena where mva1=55 order by id desc";s:10:"total_rows";i:4;s:4:"rows";a:4:{i:0;a:5:{s:2:"id";s:1:"4";s:4:"str1";s:9:"dummy for";s:4:"mva1";s:8:"15,20,55";s:4:"mva2";s:0:"";s:3:"gid";s:2:"11";}i:1;a:5:{s:2:"id";s:1:"3";s:4:"str1";s:9:"dummy for";s:4:"mva1";s:8:"15,20,55";s:4:"mva2";s:0:"";s:3:"gid";s:2:"11";}i:2;a:5:{s:2:"id";s:1:"2";s:4:"str1";s:9:"dummy for";s:4:"mva1";s:8:"15,20,55";s:4:"mva2";s:0:"";s:3:"gid";s:2:"11";}i:3;a:5:{s:2:"id";s:1:"1";s:4:"str1";s:9:"dummy for";s:4:"mva1";s:8:"15,20,55";s:4:"mva2";s:0:"";s:3:"gid";s:2:"11";}}}i:17;a:3:{s:8:"sphinxql";s:22:"SELECT * FROM rt_arena";s:10:"total_rows";i:4;s:4:"rows";a:4:{i:0;a:5:{s:2:"id";s:1:"1";s:4:"str1";s:9:"dummy for";s:4:"mva1";s:8:"15,20,55";s:4:"mva2";s:0:"";s:3:"gid";s:2:"11";}i:1;a:5:{s:2:"id";s:1:"2";s:4:"str1";s:9:"dummy for";s:4:"mva1";s:8:"15,20,55";s:4:"mva2";s:0:"";s:3:"gid";s:2:"11";}i:2;a:5:{s:2:"id";s:1:"3";s:4:"str1";s:9:"dummy for";s:4:"mva1";s:8:"15,20,55";s:4:"mva2";s:0:"";s:3:"gid";s:2:"11";}i:3;a:5:{s:2:"id";s:1:"4";s:4:"str1";s:9:"dummy for";s:4:"mva1";s:8:"15,20,55";s:4:"mva2";s:0:"";s:3:"gid";s:2:"11";}}}i:18;a:3:{s:8:"sphinxql";s:35:"SELECT * FROM rt WHERE MATCH('got')";s:10:"total_rows";i:1;s:4:"rows";a:1:{i:0;a:2:{s:2:"id";s:1:"2";s:3:"gid";s:2:"11";}}}i:19;a:2:{s:8:"sphinxql";s:144:"INSERT INTO rt1 ( id, gid, title, body ) VALUES ( 1, 22, 'dust me', 'well' ), ( 5, 22, 'dure me', 'thee off' ), ( 6, 22, 'dub me', 'thee well' )";s:14:"total_affected";i:3;}i:20;a:2:{s:8:"sphinxql";s:30:"ATTACH INDEX a1 TO RTINDEX rt1";s:14:"total_affected";i:0;}i:21;a:3:{s:8:"sphinxql";s:17:"SELECT * FROM rt1";s:10:"total_rows";i:6;s:4:"rows";a:6:{i:0;a:2:{s:2:"id";s:1:"1";s:3:"gid";s:2:"11";}i:1;a:2:{s:2:"id";s:1:"2";s:3:"gid";s:2:"11";}i:2;a:2:{s:2:"id";s:1:"3";s:3:"gid";s:2:"11";}i:3;a:2:{s:2:"id";s:1:"4";s:3:"gid";s:2:"11";}i:4;a:2:{s:2:"id";s:1:"5";s:3:"gid";s:2:"22";}i:5;a:2:{s:2:"id";s:1:"6";s:3:"gid";s:2:"22";}}}i:22;a:3:{s:8:"sphinxql";s:37:"SELECT * FROM rt1 WHERE MATCH('well')";s:10:"total_rows";i:3;s:4:"rows";a:3:{i:0;a:2:{s:2:"id";s:1:"1";s:3:"gid";s:2:"11";}i:1;a:2:{s:2:"id";s:1:"3";s:3:"gid";s:2:"11";}i:2;a:2:{s:2:"id";s:1:"6";s:3:"gid";s:2:"22";}}}i:23;a:3:{s:8:"sphinxql";s:42:"SELECT * FROM rt1 WHERE MATCH('me | thee')";s:10:"total_rows";i:4;s:4:"rows";a:4:{i:0;a:2:{s:2:"id";s:1:"5";s:3:"gid";s:2:"22";}i:1;a:2:{s:2:"id";s:1:"6";s:3:"gid";s:2:"22";}i:2;a:2:{s:2:"id";s:1:"1";s:3:"gid";s:2:"11";}i:3;a:2:{s:2:"id";s:1:"3";s:3:"gid";s:2:"11";}}}i:24;a:2:{s:8:"sphinxql";s:35:"ATTACH INDEX disk1 TO RTINDEX rt_d1";s:14:"total_affected";i:0;}i:25;a:2:{s:8:"sphinxql";s:35:"ATTACH INDEX disk2 TO RTINDEX rt_d1";s:14:"total_affected";i:0;}i:26;a:2:{s:8:"sphinxql";s:35:"ATTACH INDEX disk3 TO RTINDEX rt_d1";s:14:"total_affected";i:0;}i:27;a:3:{s:8:"sphinxql";s:19:"SELECT * FROM rt_d1";s:10:"total_rows";i:4;s:4:"rows";a:4:{i:0;a:2:{s:2:"id";s:1:"1";s:3:"gid";s:2:"11";}i:1;a:2:{s:2:"id";s:1:"2";s:3:"gid";s:2:"11";}i:2;a:2:{s:2:"id";s:1:"3";s:3:"gid";s:2:"11";}i:3;a:2:{s:2:"id";s:1:"4";s:3:"gid";s:2:"11";}}}i:28;a:2:{s:8:"sphinxql";s:93:"INSERT INTO rt_trunc ( id, gid1, gid2, title ) VALUES ( 10, 22, 33, 'I dub thee unforgiven' )";s:14:"total_affected";i:1;}i:29;a:3:{s:8:"sphinxql";s:43:"ATTACH INDEX disk_trunc TO RTINDEX rt_trunc";s:5:"error";s:87:"ATTACH currently requires same tokenizer settings (RT-side support not implemented yet)";s:5:"errno";i:1064;}i:30;a:3:{s:8:"sphinxql";s:22:"SELECT * FROM rt_trunc";s:10:"total_rows";i:1;s:4:"rows";a:1:{i:0;a:3:{s:2:"id";s:2:"10";s:4:"gid1";s:2:"22";s:4:"gid2";s:2:"33";}}}i:31;a:2:{s:8:"sphinxql";s:57:"ATTACH INDEX disk_trunc TO RTINDEX rt_trunc WITH TRUNCATE";s:14:"total_affected";i:0;}i:32;a:3:{s:8:"sphinxql";s:22:"SELECT * FROM rt_trunc";s:10:"total_rows";i:4;s:4:"rows";a:4:{i:0;a:2:{s:2:"id";s:1:"1";s:3:"gid";s:2:"11";}i:1;a:2:{s:2:"id";s:1:"2";s:3:"gid";s:2:"11";}i:2;a:2:{s:2:"id";s:1:"3";s:3:"gid";s:2:"11";}i:3;a:2:{s:2:"id";s:1:"4";s:3:"gid";s:2:"11";}}}}}
a:1:{i:0;a:37:{i:0;a:2:{s:8:"sphinxql";s:16:"SELECT * FROM rt";s:10:"total_rows";i:0;}i:1;a:3:{s:8:"sphinxql";s:18:"SELECT * FROM disk";s:10:"total_rows";i:4;s:4:"rows";a:4:{i:0;a:2:{s:2:"id";s:1:"1";s:3:"gid";s:2:"11";}i:1;a:2:{s:2:"id";s:1:"2";s:3:"gid";s:2:"11";}i:2;a:2:{s:2:"id";s:1:"3";s:3:"gid";s:2:"11";}i:3;a:2:{s:2:"id";s:1:"4";s:3:"gid";s:2:"11";}}}i:2;a:3:{s:8:"sphinxql";s:38:"SELECT * FROM disk WHERE MATCH('thee')";s:10:"total_rows";i:2;s:4:"rows";a:2:{i:0;a:2:{s:2:"id";s:1:"1";s:3:"gid";s:2:"11";}i:1;a:2:{s:2:"id";s:1:"3";s:3:"gid";s:2:"11";}}}i:3;a:3:{s:8:"sphinxql";s:56:"SELECT * FROM disk WHERE MATCH('under') order by id desc";s:10:"total_rows";i:1;s:4:"rows";a:1:{i:0;a:2:{s:2:"id";s:1:"4";s:3:"gid";s:2:"11";}}}i:4;a:2:{s:8:"sphinxql";s:31:"ATTACH INDEX disk TO RTINDEX rt";s:14:"total_affected";i:0;}i:5;a:3:{s:8:"sphinxql";s:16:"SELECT * FROM rt";s:10:"total_rows";i:4;s:4:"rows";a:4:{i:0;a:2:{s:2:"id";s:1:"1";s:3:"gid";s:2:"11";}i:1;a:2:{s:2:"id";s:1:"2";s:3:"gid";s:2:"11";}i:2;a:2:{s:2:"id";s:1:"3";s:3:"gid";s:2:"11";}i:3;a:2:{s:2:"id";s:1:"4";s:3:"gid";s:2:"11";}}}i:6;a:3:{s:8:"sphinxql";s:18:"SELECT * FROM disk";s:5:"error";s:48:"unknown local index(es) 'disk' in search request";s:5:"errno";i:1064;}i:7;a:3:{s:8:"sphinxql";s:36:"SELECT * FROM rt WHERE MATCH('thee')";s:10:"total_rows";i:2;s:4:"rows";a:2:{i:0;a:2:{s:2:"id";s:1:"1";s:3:"gid";s:2:"11";}i:1;a:2:{s:2:"id";s:1:"3";s:3:"gid";s:2:"11";}}}i:8;a:3:{s:8:"sphinxql";s:18:"DESC rt like '_i%'";s:10:"total_rows";i:2;s:4:"rows";a:2:{i:0;a:2:{s:5:"Field";s:5:"title";s:4:"Type";s:5:"field";}i:1;a:2:{s:5:"Field";s:3:"gid";s:4:"Type";s:4:"uint";}}}i:9;a:2:{s:8:"sphinxql";s:76:"INSERT INTO rt ( id, gid, title ) VALUES ( 10, 22, 'I dub thee unforgiven' )";s:14:"total_affected";i:1;}i:10;a:3:{s:8:"sphinxql";s:36:"SELECT * FROM rt WHERE MATCH('thee')";s:10:"total_rows";i:3;s:4:"rows";a:3:{i:0;a:2:{s:2:"id";s:2:"10";s:3:"gid";s:2:"22";}i:1;a:2:{s:2:"id";s:1:"1";s:3:"gid";s:2:"11";}i:2;a:2:{s:2:"id";s:1:"3";s:3:"gid";s:2:"11";}}}i:11;a:2:{s:8:"sphinxql";s:100:"INSERT INTO rt ( id, gid, title ) VALUES ( 11, 22, 'under_score_again <stuff>but got here</stuff>' )";s:14:"total_affected";i:1;}i:12;a:3:{s:8:"sphinxql";s:54:"SELECT * FROM rt WHERE MATCH('under') order by id desc";s:10:"total_rows";i:2;s:4:"rows";a:2:{i:0;a:2:{s:2:"id";s:2:"11";s:3:"gid";s:2:"22";}i:1;a:2:{s:2:"id";s:1:"4";s:3:"gid";s:2:"11";}}}i:13;a:2:{s:8:"sphinxql";s:22:"SELECT * FROM rt_arena";s:10:"total_rows";i:0;}i:14;a:2:{s:8:"sphinxql";s:38:"ATTACH INDEX plain TO RTINDEX rt_arena";s:14:"total_affected";i:0;}i:15;a:3:{s:8:"sphinxql";s:52:"SELECT * FROM rt_arena where mva1=15 order by id asc";s:10:"total_rows";i:4;s:4:"rows";a:4:{i:0;a:5:{s:2:"id";s:1:"1";s:4:"str1";s:9:"dummy for";s:4:"mva1";s:8:"15,20,55";s:4:"mva2";s:0:"";s:3:"gid";s:2:"11";}i:1;a:5:{s:2:"id";s:1:"2";s:4:"str1";s:9:"dummy for";s:4:"mva1";s:8:"15,20,55";s:4:"mva2";s:0:"";s:3:"gid";s:2:"11";}i:2;a:5:{s:2:"id";s:1:"3";s:4:"str1";s:9:"dummy for";s:4:"mva1";s:8:"15,20,55";s:4:"mva2";s:0:"";s:3:"gid";s:2:"11";}i:3;a:5:{s:2:"id";s:1:"4";s:4:"str1";s:9:"dummy for";s:4:"mva1";s:8:"15,20,55";s:4:"mva2";s:0:"";s:3:"gid";s:2:"11";}}}i:16;a:3:{s:8:"sphinxql";s:53:"SELECT * FROM rt_arena where mva1=55 order by id desc";s:10:"total_rows";i:4;s:4:"rows";a:4:{i:0;a:5:{s:2:"id";s:1:"4";s:4:"str1";s:9:"dummy for";s:4:"mva1";s:8:"15,20,55";s:4:"mva2";s:0:"";s:3:"gid";s:2:"11";}i:1;a:5:{s:2:"id";s:1:"3";s:4:"str1";s:9:"dummy for";s:4:"mva1";s:8:"15,20,55";s:4:"mva2";s:0:"";s:3:"gid";s:2:"11";}i:2;a:5:{s:2:"id";s:1:"2";s:4:"str1";s:9:"dummy for";s:4:"mva1";s:8:"15,20,55";s:4:"mva2";s:0:"";s:3:"gid";s:2:"11";}i:3;a:5:{s:2:"id";s:1:"1";s:4:"str1";s:9:"dummy for";s:4:"mva1";s:8:"15,20,55";s:4:"mva2";s:0:"";s:3:"gid";s:2:"11";}}}i:17;a:3:{s:8:"sphinxql";s:22:"SELECT * FROM rt_arena";s:10:"total_rows";i:4;s:4:"rows";a:4:{i:0;a:5:{s:2:"id";s:1:"1";s:4:"str1";s:9:"dummy for";s:4:"mva1";s:8:"15,20,55";s:4:"mva2";s:0:"";s:3:"gid";s:2:"11";}i:1;a:5:{s:2:"id";s:1:"2";s:4:"str1";s:9:"dummy for";s:4:"mva1";s:8:"15,20,55";s:4:"mva2";s:0:"";s:3:"gid";s:2:"11";}i:2;a:5:{s:2:"id";s:1:"3";s:4:"str1";s:9:"dummy for";s:4:"mva1";s:8:"15,20,55";s:4:"mva2";s:0:"";s:3:"gid";s:2:"11";}i:3;a:5:{s:2:"id";s:1:"4";s:4:"str1";s:9:"dummy for";s:4:"mva1";s:8:"15,20,55";s:4:"mva2";s:0:"";s:3:"gid";s:2:"11";}}}i:18;a:3:{s:8:"sphinxql";s:35:"SELECT * FROM rt WHERE MATCH('got')";s:10:"total_rows";i:1;s:4:"rows";a:1:{i:0;a:2:{s:2:"id";s:1:"2";s:3:"gid";s:2:"11";}}}i:19;a:2:{s:8:"sphinxql";s:144:"INSERT INTO rt1 ( id, gid, title, body ) VALUES ( 1, 22, 'dust me', 'well' ), ( 5, 22, 'dure me', 'thee off' ), ( 6, 22, 'dub me', 'thee well' )";s:14:"total_affected";i:3;}i:20;a:2:{s:8:"sphinxql";s:30:"ATTACH INDEX a1 TO RTINDEX rt1";s:14:"total_affected";i:0;}i:21;a:3:{s:8:"sphinxql";s:17:"SELECT * FROM rt1";s:10:"total_rows";i:6;s:4:"rows";a:6:{i:0;a:2:{s:2:"id";s:1:"1";s:3:"gid";s:2:"11";}i:1;a:2:{s:2:"id";s:1:"2";s:3:"gid";s:2:"11";}i:2;a:2:{s:2:"id";s:1:"3";s:3:"gid";s:2:"11";}i:3;a:2:{s:2:"id";s:1:"4";s:3:"gid";s:2:"11";}i:4;a:2:{s:2:"id";s:1:"5";s:3:"gid";s:2:"22";}i:5;a:2:{s:2:"id";s:1:"6";s:3:"gid";s:2:"22";}}}i:22;a:3:{s:8:"sphinxql";s:37:"SELECT * FROM rt1 WHERE MATCH('well')";s:10:"total_rows";i:3;s:4:"rows";a:3:{i:0;a:2:{s:2:"id";s:1:"1";s:3:"gid";s:2:"11";}i:1;a:2:{s:2:"id";s:1:"3";s:3:"gid";s:2:"11";}i:2;a:2:{s:2:"id";s:1:"6";s:3:"gid";s:2:"22";}}}i:23;a:3:{s:8:"sphinxql";s:42:"SELECT * FROM rt1 WHERE MATCH('me | thee')";s:10:"total_rows";i:4;s:4:"rows";a:4:{i:0;a:2:{s:2:"id";s:1:"5";s:3:"gid";s:2:"22";}i:1;a:2:{s:2:"id";s:1:"6";s:3:"gid";s:2:"22";}i:2;a:2:{s:2:"id";s:1:"1";s:3:"gid";s:2:"11";}i:3;a:2:{s:2:"id";s:1:"3";s:3:"gid";s:2:"11";}}}i:24;a:2:{s:8:"sphinxql";s:35:"ATTACH INDEX disk1 TO RTINDEX rt_d1";s:14:"total_affected";i:0;}i:25;a:2:{s:8:"sphinxql";s:35:"ATTACH INDEX disk2 TO RTINDEX rt_d1";s:14:"total_affected";i:0;}i:26;a:2:{s:8:"sphinxql";s:35:"ATTACH INDEX disk3 TO RTINDEX rt_d1";s:14:"total_affected";i:0;}i:27;a:3:{s:8:"sphinxql";s:19:"SELECT * FROM rt_d1";s:10:"total_rows";i:4;s:4:"rows";a:4:{i:0;a:2:{s:2:"id";s:1:"1";s:3:"gid";s:2:"11";}i:1;a:2:{s:2:"id";s:1:"2";s:3:"gid";s:2:"11";}i:2;a:2:{s:2:"id";s:1:"3";s:3:"gid";s:2:"11";}i:3;a:2:{s:2:"id";s:1:"4";s:3:"gid";s:2:"11";}}}i:28;a:2:{s:8:"sphinxql";s:93:"INSERT INTO rt_trunc ( id, gid1, gid2, title ) VALUES ( 10, 22, 33, 'I dub thee unforgiven' )";s:14:"total_affected";i:1;}i:29;a:3:{s:8:"sphinxql";s:43:"ATTACH INDEX disk_trunc TO RTINDEX rt_trunc";s:5:"error";s:87:"ATTACH currently requires same tokenizer settings (RT-side support not implemented yet)";s:5:"errno";i:1064;}i:30;a:3:{s:8:"sphinxql";s:22:"SELECT * FROM rt_trunc";s:10:"total_rows";i:1;s:4:"rows";a:1:{i:0;a:3:{s:2:"id";s:2:"10";s:4:"gid1";s:2:"22";s:4:"gid2";s:2:"33";}}}i:31;a:2:{s:8:"sphinxql";s:57:"ATTACH INDEX disk_trunc TO RTINDEX rt_trunc WITH TRUNCATE";s:14:"total_affected";i:0;}i:32;a:3:{s:8:"sphinxql";s:22:"SELECT * FROM rt_trunc";s:10:"total_rows";i:4;s:4:"rows";a:4:{i:0;a:2:{s:2:"id";s:1:"1";s:3:"gid";s:2:"11";}i:1;a:2:{s:2:"id";s:1:"2";s:3:"gid";s:2:"11";}i:2;a:2:{s:2:"id";s:1:"3";s:3:"gid";s:2:"11";}i:3;a:2:{s:2:"id";s:1:"4";s:3:"gid";s:2:"11";}}}i:33;a:3:{s:8:"sphinxql";s:51:"ATTACH INDEX disk10 TO RTINDEX disk10 WITH TRUNCATE";s:5:"error";s:41:"2nd argument to ATTACH must be a RT index";s:5:"errno";i:1064;}i:34;a:3:{s:8:"sphinxql";s:47:"ATTACH INDEX rt10 TO RTINDEX rt10 WITH TRUNCATE";s:5:"error";s:44:"1st argument to ATTACH must be a plain index";s:5:"errno";i:1064;}i:35;a:2:{s:8:"sphinxql";s:49:"ATTACH INDEX disk10 TO RTINDEX rt10 WITH TRUNCATE";s:14:"total_affected";i:0;}i:36;a:3:{s:8:"sphinxql";s:18:"SELECT * FROM rt10";s:10:"total_rows";i:4;s:4:"rows";a:4:{i:0;a:2:{s:2:"id";s:1:"1";s:3:"gid";s:2:"11";}i:1;a:2:{s:2:"id";s:1:"2";s:3:"gid";s:2:"11";}i:2;a:2:{s:2:"id";s:1:"3";s:3:"gid";s:2:"11";}i:3;a:2:{s:2:"id";s:1:"4";s:3:"gid";s:2:"11";}}}}}
@@ -146,6 +146,21 @@ index disk_trunc
charset_table = english, russian
}

index disk10
{
source = disk
path = <data_path/>/disk10
charset_table = english
}

index rt10
{
type = rt
path = data/rt10
rt_field = title
rt_attr_uint = gid
}

</config>

<db_create>
@@ -205,6 +220,13 @@ INSERT INTO test_table VALUES
<sphinxql>SELECT * FROM rt_trunc</sphinxql>
<sphinxql>ATTACH INDEX disk_trunc TO RTINDEX rt_trunc WITH TRUNCATE</sphinxql>
<sphinxql>SELECT * FROM rt_trunc</sphinxql>

<!-- regression hung of daemon on attach index to itself -->
<sphinxql>ATTACH INDEX disk10 TO RTINDEX disk10 WITH TRUNCATE</sphinxql>
<sphinxql>ATTACH INDEX rt10 TO RTINDEX rt10 WITH TRUNCATE</sphinxql>
<sphinxql>ATTACH INDEX disk10 TO RTINDEX rt10 WITH TRUNCATE</sphinxql>
<sphinxql>SELECT * FROM rt10</sphinxql>

</sphqueries>

</test>

0 comments on commit 3562f65

Please sign in to comment.
You can’t perform that action at this time.