Skip to content

Commit

Permalink
split index hash clear from removing
Browse files Browse the repository at this point in the history
On shutdown some workers sometimes still need access to index hash, so
full removing of the hash is not appropriate. However nobody forbids to
clear the hashes, and then delete them when all workers stopped

That is related and should fix #2433
  • Loading branch information
klirichek committed Nov 25, 2021
1 parent 93b5067 commit f8d7d51
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/searchd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -758,12 +758,12 @@ void Shutdown () REQUIRES ( MainThread ) NO_THREAD_SAFETY_ANALYSIS
}

Threads::CallCoroutine ( [] {
SHUTINFO << "Remove local indexes list ...";
SafeDelete ( g_pLocalIndexes );
SHUTINFO << "Abandon local indexes list ...";
g_pLocalIndexes->ReleaseAndClear();

// unlock Distr indexes automatically done by d-tr
SHUTINFO << "Remove distr indexes list ...";
SafeDelete ( g_pDistIndexes );
SHUTINFO << "Abandon distr indexes list ...";
g_pDistIndexes->ReleaseAndClear();
} );

SHUTINFO << "Shutdown alone threads (if any) ...";
Expand All @@ -774,6 +774,12 @@ void Shutdown () REQUIRES ( MainThread ) NO_THREAD_SAFETY_ANALYSIS
if ( pPool )
pPool->StopAll();

SHUTINFO << "Remove local indexes list ...";
SafeDelete ( g_pLocalIndexes );

SHUTINFO << "Remove distr indexes list ...";
SafeDelete ( g_pDistIndexes );

// clear shut down of rt indexes + binlog
SHUTINFO << "Finish IO stats collecting ...";
sphDoneIOStats();
Expand Down

0 comments on commit f8d7d51

Please sign in to comment.