Skip to content
Permalink
Browse files

fixed #224 crash of daemon on DELETE to RT index with index_field_len…

…gths enabled; added regression to test 204
  • Loading branch information
tomatolog committed Feb 28, 2018
1 parent ce528f3 commit e386d842b36195719e459b2db1fb20e402f9a51f
Showing with 21 additions and 3 deletions.
  1. +1 −1 src/sphinxrt.cpp
  2. +1 −1 test/test_204/model.bin
  3. +19 −1 test/test_204/test.xml
@@ -3257,7 +3257,7 @@ void RtIndex_t::CommitReplayable ( RtSegment_t * pNewSeg, CSphVector<SphDocID_t>
// update stats
m_tStats.m_iTotalDocuments += iNewDocs - iTotalKilled;

if ( m_tSchema.GetAttrId_FirstFieldLen()>=0 )
if ( dLens.GetLength() )
for ( int i = 0; i < m_tSchema.GetFieldsCount(); i++ )
{
m_dFieldLensRam[i] += dLens[i];
@@ -1 +1 @@
a:1:{i:0;a:1:{i:0;a:12:{s:5:"error";s:0:"";s:7:"warning";s:0:"";s:6:"status";i:0;s:6:"fields";a:2:{i:0;s:5:"title";i:1;s:7:"content";}s:5:"attrs";a:3:{s:3:"gid";i:1;s:9:"title_len";i:11;s:11:"content_len";i:11;}s:7:"matches";a:4:{i:1;a:2:{s:6:"weight";s:1:"1";s:5:"attrs";a:3:{s:3:"gid";s:3:"123";s:9:"title_len";s:1:"2";s:11:"content_len";s:1:"3";}}i:2;a:2:{s:6:"weight";s:1:"1";s:5:"attrs";a:3:{s:3:"gid";s:3:"123";s:9:"title_len";s:1:"1";s:11:"content_len";s:1:"5";}}i:3;a:2:{s:6:"weight";s:1:"1";s:5:"attrs";a:3:{s:3:"gid";s:3:"123";s:9:"title_len";s:1:"0";s:11:"content_len";s:1:"0";}}i:4;a:2:{s:6:"weight";s:1:"1";s:5:"attrs";a:3:{s:3:"gid";s:3:"123";s:9:"title_len";s:1:"3";s:11:"content_len";s:1:"1";}}}s:5:"total";s:1:"4";s:11:"total_found";s:1:"4";s:4:"time";s:5:"0.000";s:8:"resarray";i:0;s:8:"roundoff";i:0;s:5:"query";s:0:"";}}}
a:1:{i:0;a:5:{i:0;a:12:{s:5:"error";s:0:"";s:7:"warning";s:0:"";s:6:"status";i:0;s:6:"fields";a:2:{i:0;s:5:"title";i:1;s:7:"content";}s:5:"attrs";a:3:{s:3:"gid";i:1;s:9:"title_len";i:11;s:11:"content_len";i:11;}s:7:"matches";a:4:{i:1;a:2:{s:6:"weight";s:1:"1";s:5:"attrs";a:3:{s:3:"gid";s:3:"123";s:9:"title_len";s:1:"2";s:11:"content_len";s:1:"3";}}i:2;a:2:{s:6:"weight";s:1:"1";s:5:"attrs";a:3:{s:3:"gid";s:3:"123";s:9:"title_len";s:1:"1";s:11:"content_len";s:1:"5";}}i:3;a:2:{s:6:"weight";s:1:"1";s:5:"attrs";a:3:{s:3:"gid";s:3:"123";s:9:"title_len";s:1:"0";s:11:"content_len";s:1:"0";}}i:4;a:2:{s:6:"weight";s:1:"1";s:5:"attrs";a:3:{s:3:"gid";s:3:"123";s:9:"title_len";s:1:"3";s:11:"content_len";s:1:"1";}}}s:5:"total";s:1:"4";s:11:"total_found";s:1:"4";s:4:"time";s:5:"0.000";s:8:"resarray";i:0;s:8:"roundoff";i:0;s:5:"query";s:0:"";}i:1;a:2:{s:8:"sphinxql";s:26:"DELETE FROM rt1 WHERE id=1";s:14:"total_affected";i:0;}i:2;a:2:{s:8:"sphinxql";s:80:"INSERT INTO rt1 (id, title, gid) VALUES (1, 'test me', 11), (2, 'test again',12)";s:14:"total_affected";i:2;}i:3;a:2:{s:8:"sphinxql";s:26:"DELETE FROM rt1 WHERE id=1";s:14:"total_affected";i:1;}i:4;a:3:{s:8:"sphinxql";s:17:"SELECT * FROM rt1";s:10:"total_rows";i:1;s:4:"rows";a:1:{i:0;a:3:{s:2:"id";s:1:"2";s:3:"gid";s:2:"12";s:9:"title_len";s:1:"2";}}}}}
@@ -28,6 +28,16 @@ index test
path = <data_path/>/test
index_field_lengths = 1
}

index rt1
{
type = rt
path = <data_path/>/rt1
rt_field = title
rt_attr_uint = gid
index_field_lengths = 1
}

</config>

<db_create>
@@ -48,7 +58,15 @@ CREATE TABLE test_table
</db_insert>

<queries>
<query mode="extended2"></query>
<query mode="extended2" index="test"></query>
</queries>

<sphqueries>
<!-- regression crash on delete from rt index with index_field_lengths enabled -->
<sphinxql>DELETE FROM rt1 WHERE id=1</sphinxql>
<sphinxql>INSERT INTO rt1 (id, title, gid) VALUES (1, 'test me', 11), (2, 'test again',12)</sphinxql>
<sphinxql>DELETE FROM rt1 WHERE id=1</sphinxql>
<sphinxql>SELECT * FROM rt1</sphinxql>
</sphqueries>

</test>

0 comments on commit e386d84

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