File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
src/VecSim/algorithms/svs Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -227,7 +227,7 @@ class TieredSVSIndex : public VecSimTieredIndex<DataType, float> {
227227 std::atomic_flag indexUpdateScheduled = ATOMIC_FLAG_INIT;
228228 // Used to prevent running multiple index update jobs in parallel.
229229 // Even if update jobs scheduled sequentially, they can be started in parallel.
230- std::mutex updateJobMutex;
230+ mutable std::mutex updateJobMutex;
231231
232232 // The reason of following container just to properly destroy jobs which not executed yet
233233 SVSMultiThreadJob::JobsRegistry uncompletedJobs;
@@ -880,6 +880,8 @@ class TieredSVSIndex : public VecSimTieredIndex<DataType, float> {
880880 .indexUpdateScheduled =
881881 static_cast <bool >(this ->indexUpdateScheduled .test ())};
882882 info.tieredInfo .specificTieredBackendInfo .svsTieredInfo = svsTieredInfo;
883+ // prevent parallel updates
884+ std::lock_guard<std::mutex> lock (this ->updateJobMutex );
883885 info.tieredInfo .backgroundIndexing =
884886 svsTieredInfo.indexUpdateScheduled && info.tieredInfo .frontendCommonInfo .indexSize > 0
885887 ? VecSimBool_TRUE
You can’t perform that action at this time.
0 commit comments