diff --git a/utils/rowgroup/rowstorage.cpp b/utils/rowgroup/rowstorage.cpp index 7e42fcee6..a801569d8 100644 --- a/utils/rowgroup/rowstorage.cpp +++ b/utils/rowgroup/rowstorage.cpp @@ -1814,7 +1814,10 @@ void RowAggStorage::increaseSize() if (fCurData->fSize < maxSize && tryIncreaseInfo()) return; - if (fCurData->fSize * 2 < calcMaxSize(fCurData->fMask + 1)) + constexpr size_t maxMaskMultiplierWoRehashing = 1U << (INIT_INFO_INC - 1); + // We don't check for the overflow here b/c it is impractical to has fSize so that multiplication + // overflows. + if (fCurData->fSize * maxMaskMultiplierWoRehashing < calcMaxSize(fCurData->fMask + 1)) { // something strange happens... throw logging::IDBExcept(logging::IDBErrorInfo::instance()->errorMsg(logging::ERR_DISKAGG_ERROR), diff --git a/utils/rowgroup/rowstorage.h b/utils/rowgroup/rowstorage.h index df3ed8de7..bea46f806 100644 --- a/utils/rowgroup/rowstorage.h +++ b/utils/rowgroup/rowstorage.h @@ -321,6 +321,8 @@ class RowAggStorage { RowPosHashStoragePtr fHashes; std::unique_ptr fInfo; + // This is a power of 2 that controls a potential number of hash buckets + // w/o rehashing. size_t fSize{0}; size_t fMask{0}; size_t fMaxSize{0};