Skip to content

Commit 6194ef7

Browse files
author
zhangt
committed
Cleanup: remove dead m_freeWorkSpaceIds + local InitWorkSpace from ExtraDynamicSearcher (PR 447 follow-up)
1 parent 60a4853 commit 6194ef7

25 files changed

Lines changed: 16395 additions & 13718 deletions

AnnService/inc/Core/SPANN/ExtraDynamicSearcher.h

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,6 @@ namespace SPTAG::SPANN {
258258
};
259259

260260
private:
261-
std::shared_ptr<Helper::Concurrent::ConcurrentQueue<int>> m_freeWorkSpaceIds;
262261
std::atomic<int> m_workspaceCount = 0;
263262

264263
std::mutex m_asyncAppendLock;
@@ -450,7 +449,7 @@ namespace SPTAG::SPANN {
450449
[this](SizeType headID, std::shared_ptr<std::string> headVec,
451450
int appendNum, std::string& appendPosting) -> ErrorCode {
452451
ExtraWorkSpace workSpace;
453-
InitWorkSpace(&workSpace);
452+
m_headIndex->InitWorkSpace(&workSpace);
454453
return Append(&workSpace, headID, appendNum, appendPosting);
455454
});
456455

@@ -1716,30 +1715,6 @@ namespace SPTAG::SPANN {
17161715
return true;
17171716
}
17181717

1719-
void InitWorkSpace(ExtraWorkSpace* p_exWorkSpace, bool clear = false)
1720-
{
1721-
if (clear) {
1722-
p_exWorkSpace->Clear(m_opt->m_searchInternalResultNum, (max(m_opt->m_postingPageLimit, m_opt->m_searchPostingPageLimit) + m_opt->m_bufferLength) << PageSizeEx, true, m_opt->m_enableDataCompression);
1723-
}
1724-
else {
1725-
p_exWorkSpace->Initialize(m_opt->m_maxCheck, m_opt->m_hashExp, max(m_opt->m_searchInternalResultNum, m_opt->m_reassignK), (max(m_opt->m_postingPageLimit, m_opt->m_searchPostingPageLimit) + m_opt->m_bufferLength) << PageSizeEx, true, m_opt->m_enableDataCompression);
1726-
int wid = 0;
1727-
if (m_freeWorkSpaceIds == nullptr || !m_freeWorkSpaceIds->try_pop(wid))
1728-
{
1729-
SPTAGLIB_LOG(Helper::LogLevel::LL_Error, "FreeWorkSpaceIds is not initalized or the workspace number is not enough! Please increase iothread number.\n");
1730-
p_exWorkSpace->m_diskRequests[0].m_status = -1;
1731-
return;
1732-
}
1733-
for (auto & req : p_exWorkSpace->m_diskRequests)
1734-
{
1735-
req.m_status = wid;
1736-
}
1737-
p_exWorkSpace->m_callback = [m_freeWorkSpaceIds = m_freeWorkSpaceIds, wid] () {
1738-
if (m_freeWorkSpaceIds) m_freeWorkSpaceIds->push(wid);
1739-
};
1740-
}
1741-
}
1742-
17431718
ErrorCode AsyncAppend(ExtraWorkSpace* p_exWorkSpace, SizeType headID, int appendNum, std::string& appendPosting, int reassignThreshold = 0)
17441719
{
17451720
if (m_asyncAppendQueue.size() >= m_opt->m_asyncAppendQueueSize) {

ThirdParty/kvproto/generated/kvproto/errorpb.grpc.pb.cc

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ThirdParty/kvproto/generated/kvproto/errorpb.grpc.pb.h

Lines changed: 15 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)