Skip to content
Permalink
Browse files

fixed #763 daemon crash on binlog removed due to RT index remove afte…

…r config reload on SIGHUP; added regression to test 373
  • Loading branch information...
tomatolog committed Mar 11, 2019
1 parent ca80ac2 commit edb24b870423add86eba471d361e0e5aff098b18
Showing with 66 additions and 4 deletions.
  1. +1 −1 src/sphinxrt.cpp
  2. +12 −3 test/test_373/model.bin
  3. +53 −0 test/test_373/test.xml
@@ -1406,7 +1406,7 @@ RtIndex_t::~RtIndex_t ()

// might be NULL during startup
if ( g_pBinlog )
g_pBinlog->NotifyIndexFlush ( m_sIndexName.cstr(), m_iTID, true );
g_pBinlog->NotifyIndexFlush ( m_sIndexName.cstr(), m_iTID, g_bShutdown );

tmSave = sphMicroTimer() - tmSave;
if ( tmSave>=1000 && bValid )
@@ -1,5 +1,14 @@
a:1:{i:0;a:1:{i:0;a:5:{i:0;s:33:"dummy | local
a:1:{i:0;a:1:{i:0;a:15:{i:0;s:51:"dummy | local
idx1 | local
2 rows";i:1;s:51:"ERROR: SHOW INDEX STATUS requires an existing index";i:2;s:16:"Indexes reloaded";i:3;s:33:"dummy | local
rt1 | rt
rt2 | rt
4 rows";i:1;s:51:"ERROR: SHOW INDEX STATUS requires an existing index";i:2;s:16:"Indexes reloaded";i:3;s:51:"dummy | local
idx2 | local
2 rows";i:4;s:51:"ERROR: SHOW INDEX STATUS requires an existing index";}}}
rt1 | rt
rt2 | rt
4 rows";i:4;s:51:"ERROR: SHOW INDEX STATUS requires an existing index";i:5;s:14:"binlog removal";i:6;s:2:"OK";i:7;s:2:"OK";i:8;s:9:"flush rt1";i:9;s:2:"OK";i:10;s:18:"inserting into rt1";i:11;s:2:"OK";i:12;s:17:"check of rt index";i:13;s:20:"1 | 11
2 | 12
2 rows";i:14;s:42:"dummy | local
idx2 | local
rt1 | rt
3 rows";}}}
@@ -15,6 +15,8 @@ indexer
searchd
{
<searchd_settings/>
seamless_rotate = 1
binlog_path = <data_path/>
}

source src1
@@ -42,6 +44,29 @@ index dummy
docinfo = extern
dict = keywords
}

index rt1
{
type = rt
path = <data_path/>/rt1
docinfo = extern
dict = keywords

rt_field = title
rt_attr_uint = idd
}

index rt2
{
type = rt #delete2
path = <data_path/>/rt2 #delete2
docinfo = extern
dict = keywords

rt_field = title
rt_attr_uint = idd
}

</config>

<db_create>CREATE TABLE `test_table` ( `id` int(11) NOT NULL, `text` varchar(16384) CHARACTER SET utf8 NOT NULL )</db_create>
@@ -71,6 +96,34 @@ $results[] = 'Indexes reloaded';
$results[] = $ql->Query ( 'SHOW TABLES' );
$results[] = $ql->Query ( 'SHOW INDEX idx1 STATUS' );
// regression whole binlog remove on RT index delete
$results[] = "binlog removal";
$results[] = $ql->Query ( "INSERT INTO rt1 VALUES ( 1, 'test', 11)" );
$results[] = $ql->Query ( "INSERT INTO rt2 VALUES ( 1, 'test', 11)" );
// save rt1 to free binlog from it
$results[] = "flush rt1";
$results[] = $ql->Query ( "FLUSH RTINDEX rt1" );
$config = file(testdir('config.conf'));
$updatedConfig = '';
foreach ( $config as $line ) {
if ( strpos ( $line, '#delete2') !== false) {
continue;
}
$updatedConfig .= $line;
}
file_put_contents(testdir('config.conf'), $updatedConfig);
RunIndexer ( $errors, '--rotate dummy' );
sleep(1);
$results[] = "inserting into rt1";
$results[] = $ql->Query ( "INSERT INTO rt1 VALUES ( 2, 'test', 12)" );
$results[] = "check of rt index";
$results[] = $ql->Query ( "SELECT * FROM rt1" );
$results[] = $ql->Query ( "SHOW TABLES" );
]]></custom_test>

</test>

0 comments on commit edb24b8

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