Skip to content

Commit 0ebc8b3

Browse files
committed
move public outside
1 parent 2f87813 commit 0ebc8b3

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

src/VecSim/algorithms/brute_force/brute_force.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,12 @@ class BruteForceIndex : public VecSimIndexAbstract<DataType, DistType> {
144144
idToLabelMapping.capacity());
145145
resizeIndexCommon(indexCapacity() - this->blockSize);
146146
} else if (indexCapacity() == this->blockSize) {
147-
// Make sure the last block is removed.
148-
// To align with the initial capacity behaviour, where we always remove one block, we
149-
// have this special condition. On newer version branches, where the initial capacity is
150-
// deprecated, we immediately shrunk to 0 when the index size is 0.
147+
// Special case to handle last block.
148+
// This special condition resolves the ambiguity: when capacity==blockSize, we can't
149+
// tell if this block came from growth (should shrink to 0) or initial capacity (should
150+
// keep it). We choose to always shrink to 0 to maintain the one-block removal
151+
// guarantee. In contrast, newer branches without initial capacity support use simpler
152+
// logic: immediately shrink to 0 whenever index size becomes 0.
151153
assert(vectorBlocks.empty());
152154
assert(indexSize() == 0);
153155
resizeIndexCommon(0);

src/VecSim/algorithms/hnsw/hnsw.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1356,12 +1356,17 @@ void HNSWIndex<DataType, DistType>::shrinkByBlock() {
13561356
if (idToMetaData.capacity() >= (indexSize() + 2 * this->blockSize)) {
13571357
resizeIndexCommon(idToMetaData.capacity() - this->blockSize);
13581358
} else if (idToMetaData.capacity() == this->blockSize) {
1359+
// Special case to handle last block.
1360+
// This special condition resolves the ambiguity: when capacity==blockSize, we can't
1361+
// tell if this block came from growth (should shrink to 0) or initial capacity (should
1362+
// keep it). We choose to always shrink to 0 to maintain the one-block removal
1363+
// guarantee. In contrast, newer branches without initial capacity support use simpler
1364+
// logic: immediately shrink to 0 whenever index size becomes 0.
13591365
assert(vectorBlocks.empty());
13601366
assert(indexSize() == 0);
13611367
assert(maxElements == this->blockSize);
13621368
resizeIndexCommon(0);
13631369
}
1364-
13651370
// Take the lower bound into account.
13661371
maxElements -= this->blockSize;
13671372
}

src/VecSim/vec_sim_tiered_index.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ class VecSimTieredIndex : public VecSimIndexInterface {
6767
jobs.size());
6868
}
6969

70-
#ifdef BUILD_TESTS
7170
public:
71+
#ifdef BUILD_TESTS
7272
int getMainIndexGuardWriteLockCount() const { return mainIndexGuard_write_lock_count; }
7373
#endif
7474
VecSimTieredIndex(VecSimIndexAbstract<DataType, DistType> *backendIndex_,

0 commit comments

Comments
 (0)