Skip to content
Permalink
Browse files

fixed #717 crash of daemon on RT optimize with MVA updated; prohibit …

…optimize for such index and prohibit merge of indexes with MVA updated; added regressions to test 258
  • Loading branch information...
tomatolog committed Mar 19, 2019
1 parent 7c90a99 commit 57932aec734583fa93359faaf5034b2e2c9d352b
Showing with 54 additions and 3 deletions.
  1. +9 −0 src/indexer.cpp
  2. +17 −2 src/sphinxrt.cpp
  3. +1 −0 src/sphinxutils.h
  4. +1 −1 test/test_258/model.bin
  5. +26 −0 test/test_258/test.xml
@@ -1291,6 +1291,15 @@ bool DoMerge ( const CSphConfigSection & hDst, const char * sDst,
return false;
}

bool bDstMvaUpdated = HasMvaUpdated ( hDst["path"].strval() );
bool bSrcMvaUpdated = HasMvaUpdated ( hSrc["path"].strval() );

if ( bDstMvaUpdated || bSrcMvaUpdated )
{
fprintf ( stdout, "ERROR: index '%s': merge prohibited due to updated MVA.\n", bDstMvaUpdated ? sDst : sSrc );
return false;
}

// do the merge
CSphIndex * pSrc = sphCreateIndexPhrase ( nullptr, hSrc["path"].cstr() );
CSphIndex * pDst = sphCreateIndexPhrase ( nullptr, hDst["path"].cstr() );
@@ -1195,6 +1195,7 @@ struct RtIndex_t : public ISphRtIndex, public ISphNoncopyable, public ISphWordli
int64_t m_iSavedTID;
int64_t m_tmSaved;
mutable DWORD m_uDiskAttrStatus = 0;
bool m_bMvaUpdated = false; ///< optimize prohibited for disk chunks with MVA updated

bool m_bKeywordDict;
int m_iWordsCheckpoint { RTDICT_CHECKPOINT_V5 };
@@ -4077,6 +4078,13 @@ CSphIndex * RtIndex_t::LoadDiskChunk ( const char * sChunk, CSphString & sError
return pDiskChunk;
}

bool HasMvaUpdated ( const CSphString & sIndexPath )
{
CSphString sChunkMVP;
sChunkMVP.SetSprintf ( "%s.mvp", sIndexPath.cstr() );
return sphIsReadable ( sChunkMVP.cstr() );
}


bool RtIndex_t::Prealloc ( bool bStripPath )
{
@@ -4263,6 +4271,7 @@ bool RtIndex_t::Prealloc ( bool bStripPath )
sphDie ( "%s", m_sLastError.cstr() );

m_dDiskChunks.Add ( pIndex );
m_bMvaUpdated |= HasMvaUpdated ( sChunk );

// tricky bit
// outgoing match schema on disk chunk should be identical to our internal (!) schema
@@ -7677,7 +7686,6 @@ int RtIndex_t::UpdateAttributes ( const CSphAttrUpdate & tUpd, int iIndex, CSphS
assert ( tUpd.m_dDocids.GetLength()==tUpd.m_dRows.GetLength() );
assert ( tUpd.m_dDocids.GetLength()==tUpd.m_dRowOffset.GetLength() );
int iRows = tUpd.m_dDocids.GetLength();
bool bHasMva = false;

if ( !iRows )
return 0;
@@ -7754,7 +7762,7 @@ int RtIndex_t::UpdateAttributes ( const CSphAttrUpdate & tUpd, int iIndex, CSphS
}

dLocators[i] = tCol.m_tLocator;
bHasMva |= ( tCol.m_eAttrType==SPH_ATTR_UINT32SET || tCol.m_eAttrType==SPH_ATTR_INT64SET );
m_bMvaUpdated |= ( tCol.m_eAttrType==SPH_ATTR_UINT32SET || tCol.m_eAttrType==SPH_ATTR_INT64SET );
} else if ( tUpd.m_bIgnoreNonexistent )
{
continue;
@@ -8308,6 +8316,7 @@ bool RtIndex_t::AttachDiskIndex ( CSphIndex * pIndex, CSphString & sError )
sName.SetSprintf ( "%s_%d", m_sIndexName.cstr(), m_dDiskChunks.GetLength() );
pIndex->SetName ( sName.cstr() );
pIndex->SetBinlog ( false );
m_bMvaUpdated |= HasMvaUpdated ( sChunk );

// FIXME? what about copying m_TID etc?

@@ -8383,6 +8392,12 @@ bool RtIndex_t::Truncate ( CSphString & )

void RtIndex_t::Optimize ( )
{
if ( m_bMvaUpdated )
{
sphWarning ( "rt: index %s: optimization prohibited due to updated MVA", m_sIndexName.cstr() );
return;
}

if ( g_bProgressiveMerge )
{
ProgressiveMerge ( );
@@ -359,5 +359,6 @@ class Warner_c : public ISphNoncopyable

// extract basename from path
const char * GetBaseName ( const CSphString & sFullPath );
bool HasMvaUpdated ( const CSphString & sIndexPath );

#endif // _sphinxutils_
@@ -1 +1 @@
a:2:{i:0;a:29:{i:0;a:2:{s:8:"sphinxql";s:51:"insert into rt ( id, title ) values ( 123, 'ver1' )";s:14:"total_affected";i:1;}i:1;a:2:{s:8:"sphinxql";s:17:"flush ramchunk rt";s:14:"total_affected";i:0;}i:2;a:2:{s:8:"sphinxql";s:27:"delete from rt where id=123";s:14:"total_affected";i:1;}i:3;a:2:{s:8:"sphinxql";s:51:"insert into rt ( id, title ) values ( 123, 'ver2' )";s:14:"total_affected";i:1;}i:4;a:2:{s:8:"sphinxql";s:17:"flush ramchunk rt";s:14:"total_affected";i:0;}i:5;a:2:{s:8:"sphinxql";s:27:"delete from rt where id=123";s:14:"total_affected";i:1;}i:6;a:2:{s:8:"sphinxql";s:51:"insert into rt ( id, title ) values ( 123, 'ver3' )";s:14:"total_affected";i:1;}i:7;a:2:{s:8:"sphinxql";s:17:"flush ramchunk rt";s:14:"total_affected";i:0;}i:8;a:2:{s:8:"sphinxql";s:31:"optimize index rt option sync=1";s:14:"total_affected";i:0;}i:9;a:3:{s:8:"sphinxql";s:16:"select * from rt";s:10:"total_rows";i:1;s:4:"rows";a:1:{i:0;a:2:{s:2:"id";s:3:"123";s:5:"title";s:4:"ver3";}}}i:10;a:2:{s:8:"sphinxql";s:51:"insert into rt ( id, title ) values ( 124, 'ver1' )";s:14:"total_affected";i:1;}i:11;a:2:{s:8:"sphinxql";s:17:"flush ramchunk rt";s:14:"total_affected";i:0;}i:12;a:2:{s:8:"sphinxql";s:27:"delete from rt where id=124";s:14:"total_affected";i:1;}i:13;a:2:{s:8:"sphinxql";s:51:"insert into rt ( id, title ) values ( 124, 'ver2' )";s:14:"total_affected";i:1;}i:14;a:2:{s:8:"sphinxql";s:17:"flush ramchunk rt";s:14:"total_affected";i:0;}i:15;a:2:{s:8:"sphinxql";s:51:"insert into rt ( id, title ) values ( 125, 'ver1' )";s:14:"total_affected";i:1;}i:16;a:2:{s:8:"sphinxql";s:17:"flush ramchunk rt";s:14:"total_affected";i:0;}i:17;a:2:{s:8:"sphinxql";s:31:"optimize index rt option sync=1";s:14:"total_affected";i:0;}i:18;a:3:{s:8:"sphinxql";s:16:"select * from rt";s:10:"total_rows";i:3;s:4:"rows";a:3:{i:0;a:2:{s:2:"id";s:3:"123";s:5:"title";s:4:"ver3";}i:1;a:2:{s:2:"id";s:3:"124";s:5:"title";s:4:"ver2";}i:2;a:2:{s:2:"id";s:3:"125";s:5:"title";s:4:"ver1";}}}i:19;a:2:{s:8:"sphinxql";s:51:"insert into rt ( id, title ) values ( 126, 'ver1' )";s:14:"total_affected";i:1;}i:20;a:2:{s:8:"sphinxql";s:17:"flush ramchunk rt";s:14:"total_affected";i:0;}i:21;a:2:{s:8:"sphinxql";s:27:"delete from rt where id=126";s:14:"total_affected";i:1;}i:22;a:2:{s:8:"sphinxql";s:51:"insert into rt ( id, title ) values ( 126, 'ver2' )";s:14:"total_affected";i:1;}i:23;a:2:{s:8:"sphinxql";s:17:"flush ramchunk rt";s:14:"total_affected";i:0;}i:24;a:2:{s:8:"sphinxql";s:27:"delete from rt where id=126";s:14:"total_affected";i:1;}i:25;a:2:{s:8:"sphinxql";s:51:"insert into rt ( id, title ) values ( 127, 'ver1' )";s:14:"total_affected";i:1;}i:26;a:2:{s:8:"sphinxql";s:17:"flush ramchunk rt";s:14:"total_affected";i:0;}i:27;a:2:{s:8:"sphinxql";s:31:"optimize index rt option sync=1";s:14:"total_affected";i:0;}i:28;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:3:"123";s:5:"title";s:4:"ver3";}i:1;a:2:{s:2:"id";s:3:"124";s:5:"title";s:4:"ver2";}i:2;a:2:{s:2:"id";s:3:"125";s:5:"title";s:4:"ver1";}i:3;a:2:{s:2:"id";s:3:"127";s:5:"title";s:4:"ver1";}}}}i:1;a:29:{i:0;a:2:{s:8:"sphinxql";s:51:"insert into rt ( id, title ) values ( 123, 'ver1' )";s:14:"total_affected";i:1;}i:1;a:2:{s:8:"sphinxql";s:17:"flush ramchunk rt";s:14:"total_affected";i:0;}i:2;a:2:{s:8:"sphinxql";s:27:"delete from rt where id=123";s:14:"total_affected";i:1;}i:3;a:2:{s:8:"sphinxql";s:51:"insert into rt ( id, title ) values ( 123, 'ver2' )";s:14:"total_affected";i:1;}i:4;a:2:{s:8:"sphinxql";s:17:"flush ramchunk rt";s:14:"total_affected";i:0;}i:5;a:2:{s:8:"sphinxql";s:27:"delete from rt where id=123";s:14:"total_affected";i:1;}i:6;a:2:{s:8:"sphinxql";s:51:"insert into rt ( id, title ) values ( 123, 'ver3' )";s:14:"total_affected";i:1;}i:7;a:2:{s:8:"sphinxql";s:17:"flush ramchunk rt";s:14:"total_affected";i:0;}i:8;a:2:{s:8:"sphinxql";s:31:"optimize index rt option sync=1";s:14:"total_affected";i:0;}i:9;a:3:{s:8:"sphinxql";s:16:"select * from rt";s:10:"total_rows";i:1;s:4:"rows";a:1:{i:0;a:2:{s:2:"id";s:3:"123";s:5:"title";s:4:"ver3";}}}i:10;a:2:{s:8:"sphinxql";s:51:"insert into rt ( id, title ) values ( 124, 'ver1' )";s:14:"total_affected";i:1;}i:11;a:2:{s:8:"sphinxql";s:17:"flush ramchunk rt";s:14:"total_affected";i:0;}i:12;a:2:{s:8:"sphinxql";s:27:"delete from rt where id=124";s:14:"total_affected";i:1;}i:13;a:2:{s:8:"sphinxql";s:51:"insert into rt ( id, title ) values ( 124, 'ver2' )";s:14:"total_affected";i:1;}i:14;a:2:{s:8:"sphinxql";s:17:"flush ramchunk rt";s:14:"total_affected";i:0;}i:15;a:2:{s:8:"sphinxql";s:51:"insert into rt ( id, title ) values ( 125, 'ver1' )";s:14:"total_affected";i:1;}i:16;a:2:{s:8:"sphinxql";s:17:"flush ramchunk rt";s:14:"total_affected";i:0;}i:17;a:2:{s:8:"sphinxql";s:31:"optimize index rt option sync=1";s:14:"total_affected";i:0;}i:18;a:3:{s:8:"sphinxql";s:16:"select * from rt";s:10:"total_rows";i:3;s:4:"rows";a:3:{i:0;a:2:{s:2:"id";s:3:"123";s:5:"title";s:4:"ver3";}i:1;a:2:{s:2:"id";s:3:"124";s:5:"title";s:4:"ver2";}i:2;a:2:{s:2:"id";s:3:"125";s:5:"title";s:4:"ver1";}}}i:19;a:2:{s:8:"sphinxql";s:51:"insert into rt ( id, title ) values ( 126, 'ver1' )";s:14:"total_affected";i:1;}i:20;a:2:{s:8:"sphinxql";s:17:"flush ramchunk rt";s:14:"total_affected";i:0;}i:21;a:2:{s:8:"sphinxql";s:27:"delete from rt where id=126";s:14:"total_affected";i:1;}i:22;a:2:{s:8:"sphinxql";s:51:"insert into rt ( id, title ) values ( 126, 'ver2' )";s:14:"total_affected";i:1;}i:23;a:2:{s:8:"sphinxql";s:17:"flush ramchunk rt";s:14:"total_affected";i:0;}i:24;a:2:{s:8:"sphinxql";s:27:"delete from rt where id=126";s:14:"total_affected";i:1;}i:25;a:2:{s:8:"sphinxql";s:51:"insert into rt ( id, title ) values ( 127, 'ver1' )";s:14:"total_affected";i:1;}i:26;a:2:{s:8:"sphinxql";s:17:"flush ramchunk rt";s:14:"total_affected";i:0;}i:27;a:2:{s:8:"sphinxql";s:31:"optimize index rt option sync=1";s:14:"total_affected";i:0;}i:28;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:3:"123";s:5:"title";s:4:"ver3";}i:1;a:2:{s:2:"id";s:3:"124";s:5:"title";s:4:"ver2";}i:2;a:2:{s:2:"id";s:3:"125";s:5:"title";s:4:"ver1";}i:3;a:2:{s:2:"id";s:3:"127";s:5:"title";s:4:"ver1";}}}}}
a:2:{i:0;a:40:{i:0;a:2:{s:8:"sphinxql";s:51:"insert into rt ( id, title ) values ( 123, 'ver1' )";s:14:"total_affected";i:1;}i:1;a:2:{s:8:"sphinxql";s:17:"flush ramchunk rt";s:14:"total_affected";i:0;}i:2;a:2:{s:8:"sphinxql";s:27:"delete from rt where id=123";s:14:"total_affected";i:1;}i:3;a:2:{s:8:"sphinxql";s:51:"insert into rt ( id, title ) values ( 123, 'ver2' )";s:14:"total_affected";i:1;}i:4;a:2:{s:8:"sphinxql";s:17:"flush ramchunk rt";s:14:"total_affected";i:0;}i:5;a:2:{s:8:"sphinxql";s:27:"delete from rt where id=123";s:14:"total_affected";i:1;}i:6;a:2:{s:8:"sphinxql";s:51:"insert into rt ( id, title ) values ( 123, 'ver3' )";s:14:"total_affected";i:1;}i:7;a:2:{s:8:"sphinxql";s:17:"flush ramchunk rt";s:14:"total_affected";i:0;}i:8;a:2:{s:8:"sphinxql";s:31:"optimize index rt option sync=1";s:14:"total_affected";i:0;}i:9;a:3:{s:8:"sphinxql";s:16:"select * from rt";s:10:"total_rows";i:1;s:4:"rows";a:1:{i:0;a:2:{s:2:"id";s:3:"123";s:5:"title";s:4:"ver3";}}}i:10;a:2:{s:8:"sphinxql";s:51:"insert into rt ( id, title ) values ( 124, 'ver1' )";s:14:"total_affected";i:1;}i:11;a:2:{s:8:"sphinxql";s:17:"flush ramchunk rt";s:14:"total_affected";i:0;}i:12;a:2:{s:8:"sphinxql";s:27:"delete from rt where id=124";s:14:"total_affected";i:1;}i:13;a:2:{s:8:"sphinxql";s:51:"insert into rt ( id, title ) values ( 124, 'ver2' )";s:14:"total_affected";i:1;}i:14;a:2:{s:8:"sphinxql";s:17:"flush ramchunk rt";s:14:"total_affected";i:0;}i:15;a:2:{s:8:"sphinxql";s:51:"insert into rt ( id, title ) values ( 125, 'ver1' )";s:14:"total_affected";i:1;}i:16;a:2:{s:8:"sphinxql";s:17:"flush ramchunk rt";s:14:"total_affected";i:0;}i:17;a:2:{s:8:"sphinxql";s:31:"optimize index rt option sync=1";s:14:"total_affected";i:0;}i:18;a:3:{s:8:"sphinxql";s:16:"select * from rt";s:10:"total_rows";i:3;s:4:"rows";a:3:{i:0;a:2:{s:2:"id";s:3:"123";s:5:"title";s:4:"ver3";}i:1;a:2:{s:2:"id";s:3:"124";s:5:"title";s:4:"ver2";}i:2;a:2:{s:2:"id";s:3:"125";s:5:"title";s:4:"ver1";}}}i:19;a:2:{s:8:"sphinxql";s:51:"insert into rt ( id, title ) values ( 126, 'ver1' )";s:14:"total_affected";i:1;}i:20;a:2:{s:8:"sphinxql";s:17:"flush ramchunk rt";s:14:"total_affected";i:0;}i:21;a:2:{s:8:"sphinxql";s:27:"delete from rt where id=126";s:14:"total_affected";i:1;}i:22;a:2:{s:8:"sphinxql";s:51:"insert into rt ( id, title ) values ( 126, 'ver2' )";s:14:"total_affected";i:1;}i:23;a:2:{s:8:"sphinxql";s:17:"flush ramchunk rt";s:14:"total_affected";i:0;}i:24;a:2:{s:8:"sphinxql";s:27:"delete from rt where id=126";s:14:"total_affected";i:1;}i:25;a:2:{s:8:"sphinxql";s:51:"insert into rt ( id, title ) values ( 127, 'ver1' )";s:14:"total_affected";i:1;}i:26;a:2:{s:8:"sphinxql";s:17:"flush ramchunk rt";s:14:"total_affected";i:0;}i:27;a:2:{s:8:"sphinxql";s:31:"optimize index rt option sync=1";s:14:"total_affected";i:0;}i:28;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:3:"123";s:5:"title";s:4:"ver3";}i:1;a:2:{s:2:"id";s:3:"124";s:5:"title";s:4:"ver2";}i:2;a:2:{s:2:"id";s:3:"125";s:5:"title";s:4:"ver1";}i:3;a:2:{s:2:"id";s:3:"127";s:5:"title";s:4:"ver1";}}}i:29;a:2:{s:8:"sphinxql";s:79:"insert into rt_mva ( id, title, gid, mva1 ) values ( 1, 'ver1', 11, (11, 101) )";s:14:"total_affected";i:1;}i:30;a:2:{s:8:"sphinxql";s:79:"insert into rt_mva ( id, title, gid, mva1 ) values ( 2, 'ver2', 12, (12, 102) )";s:14:"total_affected";i:1;}i:31;a:2:{s:8:"sphinxql";s:79:"insert into rt_mva ( id, title, gid, mva1 ) values ( 3, 'ver3', 13, (13, 103) )";s:14:"total_affected";i:1;}i:32;a:2:{s:8:"sphinxql";s:21:"flush ramchunk rt_mva";s:14:"total_affected";i:0;}i:33;a:2:{s:8:"sphinxql";s:79:"insert into rt_mva ( id, title, gid, mva1 ) values ( 5, 'ver5', 15, (15, 105) )";s:14:"total_affected";i:1;}i:34;a:2:{s:8:"sphinxql";s:79:"insert into rt_mva ( id, title, gid, mva1 ) values ( 6, 'ver6', 16, (16, 106) )";s:14:"total_affected";i:1;}i:35;a:2:{s:8:"sphinxql";s:21:"flush ramchunk rt_mva";s:14:"total_affected";i:0;}i:36;a:2:{s:8:"sphinxql";s:47:"UPDATE rt_mva SET mva1 = (1012,1002) WHERE id=2";s:14:"total_affected";i:1;}i:37;a:2:{s:8:"sphinxql";s:47:"UPDATE rt_mva SET mva1 = (1015,1005) WHERE id=5";s:14:"total_affected";i:1;}i:38;a:2:{s:8:"sphinxql";s:35:"optimize index rt_mva option sync=1";s:14:"total_affected";i:0;}i:39;a:3:{s:8:"sphinxql";s:20:"SELECT * FROM rt_mva";s:10:"total_rows";i:5;s:4:"rows";a:5:{i:0;a:3:{s:2:"id";s:1:"1";s:3:"gid";s:2:"11";s:4:"mva1";s:6:"11,101";}i:1;a:3:{s:2:"id";s:1:"2";s:3:"gid";s:2:"12";s:4:"mva1";s:9:"1002,1012";}i:2;a:3:{s:2:"id";s:1:"3";s:3:"gid";s:2:"13";s:4:"mva1";s:6:"13,103";}i:3;a:3:{s:2:"id";s:1:"5";s:3:"gid";s:2:"15";s:4:"mva1";s:9:"1005,1015";}i:4;a:3:{s:2:"id";s:1:"6";s:3:"gid";s:2:"16";s:4:"mva1";s:6:"16,106";}}}}i:1;a:40:{i:0;a:2:{s:8:"sphinxql";s:51:"insert into rt ( id, title ) values ( 123, 'ver1' )";s:14:"total_affected";i:1;}i:1;a:2:{s:8:"sphinxql";s:17:"flush ramchunk rt";s:14:"total_affected";i:0;}i:2;a:2:{s:8:"sphinxql";s:27:"delete from rt where id=123";s:14:"total_affected";i:1;}i:3;a:2:{s:8:"sphinxql";s:51:"insert into rt ( id, title ) values ( 123, 'ver2' )";s:14:"total_affected";i:1;}i:4;a:2:{s:8:"sphinxql";s:17:"flush ramchunk rt";s:14:"total_affected";i:0;}i:5;a:2:{s:8:"sphinxql";s:27:"delete from rt where id=123";s:14:"total_affected";i:1;}i:6;a:2:{s:8:"sphinxql";s:51:"insert into rt ( id, title ) values ( 123, 'ver3' )";s:14:"total_affected";i:1;}i:7;a:2:{s:8:"sphinxql";s:17:"flush ramchunk rt";s:14:"total_affected";i:0;}i:8;a:2:{s:8:"sphinxql";s:31:"optimize index rt option sync=1";s:14:"total_affected";i:0;}i:9;a:3:{s:8:"sphinxql";s:16:"select * from rt";s:10:"total_rows";i:1;s:4:"rows";a:1:{i:0;a:2:{s:2:"id";s:3:"123";s:5:"title";s:4:"ver3";}}}i:10;a:2:{s:8:"sphinxql";s:51:"insert into rt ( id, title ) values ( 124, 'ver1' )";s:14:"total_affected";i:1;}i:11;a:2:{s:8:"sphinxql";s:17:"flush ramchunk rt";s:14:"total_affected";i:0;}i:12;a:2:{s:8:"sphinxql";s:27:"delete from rt where id=124";s:14:"total_affected";i:1;}i:13;a:2:{s:8:"sphinxql";s:51:"insert into rt ( id, title ) values ( 124, 'ver2' )";s:14:"total_affected";i:1;}i:14;a:2:{s:8:"sphinxql";s:17:"flush ramchunk rt";s:14:"total_affected";i:0;}i:15;a:2:{s:8:"sphinxql";s:51:"insert into rt ( id, title ) values ( 125, 'ver1' )";s:14:"total_affected";i:1;}i:16;a:2:{s:8:"sphinxql";s:17:"flush ramchunk rt";s:14:"total_affected";i:0;}i:17;a:2:{s:8:"sphinxql";s:31:"optimize index rt option sync=1";s:14:"total_affected";i:0;}i:18;a:3:{s:8:"sphinxql";s:16:"select * from rt";s:10:"total_rows";i:3;s:4:"rows";a:3:{i:0;a:2:{s:2:"id";s:3:"123";s:5:"title";s:4:"ver3";}i:1;a:2:{s:2:"id";s:3:"124";s:5:"title";s:4:"ver2";}i:2;a:2:{s:2:"id";s:3:"125";s:5:"title";s:4:"ver1";}}}i:19;a:2:{s:8:"sphinxql";s:51:"insert into rt ( id, title ) values ( 126, 'ver1' )";s:14:"total_affected";i:1;}i:20;a:2:{s:8:"sphinxql";s:17:"flush ramchunk rt";s:14:"total_affected";i:0;}i:21;a:2:{s:8:"sphinxql";s:27:"delete from rt where id=126";s:14:"total_affected";i:1;}i:22;a:2:{s:8:"sphinxql";s:51:"insert into rt ( id, title ) values ( 126, 'ver2' )";s:14:"total_affected";i:1;}i:23;a:2:{s:8:"sphinxql";s:17:"flush ramchunk rt";s:14:"total_affected";i:0;}i:24;a:2:{s:8:"sphinxql";s:27:"delete from rt where id=126";s:14:"total_affected";i:1;}i:25;a:2:{s:8:"sphinxql";s:51:"insert into rt ( id, title ) values ( 127, 'ver1' )";s:14:"total_affected";i:1;}i:26;a:2:{s:8:"sphinxql";s:17:"flush ramchunk rt";s:14:"total_affected";i:0;}i:27;a:2:{s:8:"sphinxql";s:31:"optimize index rt option sync=1";s:14:"total_affected";i:0;}i:28;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:3:"123";s:5:"title";s:4:"ver3";}i:1;a:2:{s:2:"id";s:3:"124";s:5:"title";s:4:"ver2";}i:2;a:2:{s:2:"id";s:3:"125";s:5:"title";s:4:"ver1";}i:3;a:2:{s:2:"id";s:3:"127";s:5:"title";s:4:"ver1";}}}i:29;a:2:{s:8:"sphinxql";s:79:"insert into rt_mva ( id, title, gid, mva1 ) values ( 1, 'ver1', 11, (11, 101) )";s:14:"total_affected";i:1;}i:30;a:2:{s:8:"sphinxql";s:79:"insert into rt_mva ( id, title, gid, mva1 ) values ( 2, 'ver2', 12, (12, 102) )";s:14:"total_affected";i:1;}i:31;a:2:{s:8:"sphinxql";s:79:"insert into rt_mva ( id, title, gid, mva1 ) values ( 3, 'ver3', 13, (13, 103) )";s:14:"total_affected";i:1;}i:32;a:2:{s:8:"sphinxql";s:21:"flush ramchunk rt_mva";s:14:"total_affected";i:0;}i:33;a:2:{s:8:"sphinxql";s:79:"insert into rt_mva ( id, title, gid, mva1 ) values ( 5, 'ver5', 15, (15, 105) )";s:14:"total_affected";i:1;}i:34;a:2:{s:8:"sphinxql";s:79:"insert into rt_mva ( id, title, gid, mva1 ) values ( 6, 'ver6', 16, (16, 106) )";s:14:"total_affected";i:1;}i:35;a:2:{s:8:"sphinxql";s:21:"flush ramchunk rt_mva";s:14:"total_affected";i:0;}i:36;a:2:{s:8:"sphinxql";s:47:"UPDATE rt_mva SET mva1 = (1012,1002) WHERE id=2";s:14:"total_affected";i:1;}i:37;a:2:{s:8:"sphinxql";s:47:"UPDATE rt_mva SET mva1 = (1015,1005) WHERE id=5";s:14:"total_affected";i:1;}i:38;a:2:{s:8:"sphinxql";s:35:"optimize index rt_mva option sync=1";s:14:"total_affected";i:0;}i:39;a:3:{s:8:"sphinxql";s:20:"SELECT * FROM rt_mva";s:10:"total_rows";i:5;s:4:"rows";a:5:{i:0;a:3:{s:2:"id";s:1:"1";s:3:"gid";s:2:"11";s:4:"mva1";s:6:"11,101";}i:1;a:3:{s:2:"id";s:1:"2";s:3:"gid";s:2:"12";s:4:"mva1";s:9:"1002,1012";}i:2;a:3:{s:2:"id";s:1:"3";s:3:"gid";s:2:"13";s:4:"mva1";s:6:"13,103";}i:3;a:3:{s:2:"id";s:1:"5";s:3:"gid";s:2:"15";s:4:"mva1";s:9:"1005,1015";}i:4;a:3:{s:2:"id";s:1:"6";s:3:"gid";s:2:"16";s:4:"mva1";s:6:"16,106";}}}}}
@@ -34,6 +34,18 @@ index rt
rt_attr_string = title
rt_field = text
}

index rt_mva
{
type = rt
path = <data_path/>/rt_mva
docinfo = extern

rt_field = title
rt_attr_multi = mva1
rt_attr_uint = gid
}

</config>

<sphqueries>
@@ -84,6 +96,20 @@ index rt
<sphinxql>optimize index rt option sync=1</sphinxql>
<sphinxql>select * from rt</sphinxql>

<!-- updated MVA should not crash daemon on optimize -->
<sphinxql>insert into rt_mva ( id, title, gid, mva1 ) values ( 1, 'ver1', 11, (11, 101) )</sphinxql>
<sphinxql>insert into rt_mva ( id, title, gid, mva1 ) values ( 2, 'ver2', 12, (12, 102) )</sphinxql>
<sphinxql>insert into rt_mva ( id, title, gid, mva1 ) values ( 3, 'ver3', 13, (13, 103) )</sphinxql>
<sphinxql>flush ramchunk rt_mva</sphinxql>
<sphinxql>insert into rt_mva ( id, title, gid, mva1 ) values ( 5, 'ver5', 15, (15, 105) )</sphinxql>
<sphinxql>insert into rt_mva ( id, title, gid, mva1 ) values ( 6, 'ver6', 16, (16, 106) )</sphinxql>
<sphinxql>flush ramchunk rt_mva</sphinxql>
<sphinxql>UPDATE rt_mva SET mva1 = (1012,1002) WHERE id=2</sphinxql>
<sphinxql>UPDATE rt_mva SET mva1 = (1015,1005) WHERE id=5</sphinxql>

<sphinxql>optimize index rt_mva option sync=1</sphinxql>
<sphinxql>SELECT * FROM rt_mva</sphinxql>

</sphqueries>

</test>

0 comments on commit 57932ae

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