Skip to content

Commit

Permalink
Fixes #980 refactor 'retired' segments management;
Browse files Browse the repository at this point in the history
Instead of collecting retired segments and deleting them at fixed points
let's make them refcount-managed and just release when they're no more
in game instead of explicit deletion.
  • Loading branch information
klirichek authored and adriannuta committed Aug 22, 2019
1 parent 6901f9b commit 174d312
Show file tree
Hide file tree
Showing 3 changed files with 191 additions and 200 deletions.
5 changes: 3 additions & 2 deletions src/sphinxpq.cpp
Expand Up @@ -845,6 +845,7 @@ struct PercolateQword_t : public ISphQword
m_iDoc = 0; m_iDoc = 0;
m_tDocReader = RtDocReader_t(); m_tDocReader = RtDocReader_t();
m_pSeg = pSeg; m_pSeg = pSeg;
SafeAddRef ( pSeg );
m_tHitReader.m_pBase = pSeg->m_dHits.Begin(); m_tHitReader.m_pBase = pSeg->m_dHits.Begin();


m_dDoclist.Set ( dDoclist.Begin(), dDoclist.GetLength() ); m_dDoclist.Set ( dDoclist.Begin(), dDoclist.GetLength() );
Expand All @@ -867,7 +868,7 @@ struct PercolateQword_t : public ISphQword
m_iDoc++; m_iDoc++;
} }


const RtSegment_t * m_pSeg = nullptr; constRtSegmentRefPtf_t m_pSeg;
CSphFixedVector<Slice_t> m_dDoclist { 0 }; CSphFixedVector<Slice_t> m_dDoclist { 0 };
CSphMatch m_tMatch; CSphMatch m_tMatch;
RtDocReader_t m_tDocReader; RtDocReader_t m_tDocReader;
Expand Down Expand Up @@ -1419,7 +1420,7 @@ bool PercolateIndex_c::MatchDocuments ( RtAccum_t * pAccExt, PercolateMatchResul
PERCOLATE_WORDS_PER_CP, ( m_iMaxCodepointLength>1 ) ); PERCOLATE_WORDS_PER_CP, ( m_iMaxCodepointLength>1 ) );


DoMatchDocuments ( pSeg, tRes ); DoMatchDocuments ( pSeg, tRes );
SafeDelete ( pSeg ); SafeRelease ( pSeg );


// done; cleanup accum // done; cleanup accum
pAcc->Cleanup (); pAcc->Cleanup ();
Expand Down

0 comments on commit 174d312

Please sign in to comment.