Test: Regression for non-ordered queue #826
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The question with the proposed bug is: Does deallocating and then allocating
Let's take the following example:
Allocation delay is 15 days. Assume same strategy is allocated to
t=0
Queue magnitude allocation for opset_1 to 50. The effectTimestamp is 15
t=15
Queue deallocation for opset_1 to 25.
The effectTimestamp is 32.5
t=15
Queue allocation for opset_2 to 33
The effectTimestamp is 30
Now the queue looks like
dealloc, opset_1, mag: 25, timestamp: 32.5
alloc, opset_2, mag: 33, timestamp: 30
Let's look at reads to allocated magnitude
getAllocatableMagnitude
: When we allocate for opset_2, we increase the encumbered magnitude. Hence, allocatableMagnitude returns the proper value_getPendingMagnitudeInfo
this basically "pseudo clears" that allocation. pendingDiff is set to 0 from this line of code since the effectTimestamp has been passedslashOperator
: at t=30, this magnitude is still in effect due to_getPendingMagnitudeInfo
Let's look at writes to
completeModificationQueue
It is true, that the deallocation is BLOCKING the allocation. However, given the above, it does not mess up any reads to state since
_getPendingMagnitudeInfo
does a lot of heavy liftingThe edge case we actually need to solve for is if an allocation blocks a deallocation.
The worst case scenario is if we had something like
dealloc, opset_1, mag: 25, timestamp: 32.5
alloc, opset_2, mag: 33, timestamp: 40
dealloc, opset_3, mag: 10, timestamp: 32.5
Options for that are requiring allocation delay to be less than deallocation delay OR potentially only pushing to the modification queue for deallocations