Fix failure to find expire during rehash

Former-commit-id: b66269865cb71a5e1dd33588b012206da2765824
This commit is contained in:
John Sully 2020-06-10 12:48:16 -04:00
parent ddde8abfc7
commit 4e609863b6

View File

@ -92,15 +92,16 @@ public:
for (int hashset = 0; hashset < 2; ++hashset) // rehashing may only be 1 resize behind, so we check up to two slots for (int hashset = 0; hashset < 2; ++hashset) // rehashing may only be 1 resize behind, so we check up to two slots
{ {
if (m_data[itr.idxPrimary] == nullptr) if (m_data[itr.idxPrimary] != nullptr)
continue;
const auto &vecBucket = *m_data[itr.idxPrimary];
auto itrFind = std::find(vecBucket.begin(), vecBucket.end(), key);
if (itrFind != vecBucket.end())
{ {
itr.idxSecondary = itrFind - vecBucket.begin(); const auto &vecBucket = *m_data[itr.idxPrimary];
return itr;
auto itrFind = std::find(vecBucket.begin(), vecBucket.end(), key);
if (itrFind != vecBucket.end())
{
itr.idxSecondary = itrFind - vecBucket.begin();
return itr;
}
} }
// See if we have to check the older slot // See if we have to check the older slot
@ -333,7 +334,8 @@ private:
{ {
if (m_data[idxRehash] == nullptr) if (m_data[idxRehash] == nullptr)
continue; continue;
CowPtr<vector_type> spvecT = std::make_shared<vector_type>();
CowPtr<vector_type> spvecT;
std::swap(m_data[idxRehash], spvecT); std::swap(m_data[idxRehash], spvecT);
for (const auto &v : *spvecT) for (const auto &v : *spvecT)