VikingDeng opened a new pull request, #42:
URL: https://github.com/apache/asterixdb/pull/42
## Summary
This patch fixes frame memory accounting in `Joblet`.
There were two related issues in the NC-side frame allocation path:
1. `deallocateFrames(int)` added released bytes to `memoryAllocation`
instead of subtracting them.
2. `allocateFrame(int)` did not roll back the reservation if
`FrameManager.allocateFrame(...)` failed after
`MemoryManager.allocate(...)` had already succeeded.
Together, these issues could leave incorrect outstanding-memory accounting
and cause `close()` to treat balanced allocations as
leaked memory.
## Details
`Joblet.close()` uses `memoryAllocation` as the amount of memory still
held by the joblet.
With the previous logic:
- a normal allocate/deallocate sequence could still leave a positive
`memoryAllocation`
- a failed frame allocation could leave a phantom reservation behind
This patch makes the accounting consistent by:
- subtracting bytes on `deallocateFrames(int)`
- releasing the reservation immediately when frame allocation fails
## Tests
Added `JobletTest` to cover:
- balanced allocate/deallocate does not trigger an extra deallocation on
`close()`
- failed frame allocation releases its reservation immediately
## Verification
Verified with:
- module `test-compile`
- direct `JUnitCore` execution of
`org.apache.hyracks.control.nc.JobletTest`
Both new tests pass.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]