The priority queue index_ in MstState is expected to be sorted in the order of batches expiration, but that does not hold in general case when the queue gets sorted by the first transaction timestamp. This change sorts the queue by the oldest transaction timestamp to fix the issue.
UPDATE
internal_state_ and index_ were both used to store the batches, which complicated the logic and lead to a missing cleanup operation. Now there is only one storage - batches_.
MstState::operator==(const MstState &rhs) previously checked whether this->internal_state_ is a subset of rhs.internal_state_. Implementing it like a honest equality would be ineffective with batches stored in an unordered set. As this operator is used only once in a single test, I decided better to remove it than to keep an ineffective implementation.
The index type was changed to
Benefits
Fixed MstState::eraseByTime and storage cleanup.
Possible Drawbacks
Additional boost includes present in the mst_state.hpp header.
Removed MstState::operator==(const MstState &rhs).
Description of the Change
The priority queue
index_
inMstState
is expected to be sorted in the order of batches expiration, but that does not hold in general case when the queue gets sorted by the first transaction timestamp. This change sorts the queue by the oldest transaction timestamp to fix the issue.UPDATE
internal_state_
andindex_
were both used to store the batches, which complicated the logic and lead to a missing cleanup operation. Now there is only one storage -batches_
.MstState::operator==(const MstState &rhs)
previously checked whetherthis->internal_state_
is a subset ofrhs.internal_state_
. Implementing it like a honest equality would be ineffective with batches stored in an unordered set. As this operator is used only once in a single test, I decided better to remove it than to keep an ineffective implementation.The index type was changed to
Benefits
Fixed
MstState::eraseByTime
and storage cleanup.Possible Drawbacks
Additional boost includes present in the
mst_state.hpp
header. RemovedMstState::operator==(const MstState &rhs)
.Usage Examples or Tests [optional]
Alternate Designs [optional]
Rework
MstState
with pimpl to hide the includes.