Skip to content

Commit 43b2ed7

Browse files
[8.2] Ensure accurate backgroundIndexing status in debugInfo (#812)
Ensure accurate `backgroundIndexing` status in debugInfo (#811) convert updateJobMutex to mutable check backgroundIndexing under the lock (cherry picked from commit 46e69b4) Co-authored-by: meiravgri <[email protected]>
1 parent 15d4f16 commit 43b2ed7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/VecSim/algorithms/svs/svs_tiered.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ class TieredSVSIndex : public VecSimTieredIndex<DataType, float> {
215215
std::atomic_flag indexUpdateScheduled = ATOMIC_FLAG_INIT;
216216
// Used to prevent running multiple index update jobs in parallel.
217217
// Even if update jobs scheduled sequentially, they can be started in parallel.
218-
std::mutex updateJobMutex;
218+
mutable std::mutex updateJobMutex;
219219

220220
// The reason of following container just to properly destroy jobs which not executed yet
221221
SVSMultiThreadJob::JobsRegistry uncompletedJobs;
@@ -780,6 +780,8 @@ class TieredSVSIndex : public VecSimTieredIndex<DataType, float> {
780780
.indexUpdateScheduled =
781781
static_cast<bool>(this->indexUpdateScheduled.test())};
782782
info.tieredInfo.specificTieredBackendInfo.svsTieredInfo = svsTieredInfo;
783+
// prevent parallel updates
784+
std::lock_guard<std::mutex> lock(this->updateJobMutex);
783785
info.tieredInfo.backgroundIndexing =
784786
svsTieredInfo.indexUpdateScheduled && info.tieredInfo.frontendCommonInfo.indexSize > 0
785787
? VecSimBool_TRUE

0 commit comments

Comments
 (0)