Impala Public Jenkins has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/15050 )
Change subject: IMPALA-9291: MemTracker's TryConsume() should behave consistent with Consume()/Release() ...................................................................... IMPALA-9291: MemTracker's TryConsume() should behave consistent with Consume()/Release() Before this fix MemTracker::Consume() and Release() could take negative numbers as arguments. In that case Consume(-val) would invoke Release(val) and vice versa. On the other hand, TryConsume() was a no-op for negative values and returned success. This could lead to errors in the following case: TryConsume(-42); // no-op ... Release(-42); // -> Consume(42); And in the end the mem tracker would think there is 42 bytes of unallocated memory. This commit changes mem-tracker to forbid negative values. Another inconsistency was found between Consume()/Release() and TryConsume(). When Consume()/Release() was invoked with zero as argument they didn't update 'consumption_' when 'consumption_metric_' was not null. On the other hand, TryConsume() being invoked with zero did update 'consumption_' from the metric. I fixed this inconsistency as well, i.e. now 'consumption_' is not updated when the argument is zero. Testing: * ran exhaustive tests Change-Id: I22e613c49e4a6bd218e7f7f7c0d6bec95b75cff5 Reviewed-on: http://gerrit.cloudera.org:8080/15050 Reviewed-by: Impala Public Jenkins <[email protected]> Tested-by: Impala Public Jenkins <[email protected]> --- M be/src/runtime/mem-tracker-test.cc M be/src/runtime/mem-tracker.h 2 files changed, 41 insertions(+), 25 deletions(-) Approvals: Impala Public Jenkins: Looks good to me, approved; Verified -- To view, visit http://gerrit.cloudera.org:8080/15050 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: I22e613c49e4a6bd218e7f7f7c0d6bec95b75cff5 Gerrit-Change-Number: 15050 Gerrit-PatchSet: 7 Gerrit-Owner: Zoltan Borok-Nagy <[email protected]> Gerrit-Reviewer: Csaba Ringhofer <[email protected]> Gerrit-Reviewer: Impala Public Jenkins <[email protected]> Gerrit-Reviewer: Norbert Luksa <[email protected]> Gerrit-Reviewer: Tim Armstrong <[email protected]> Gerrit-Reviewer: Zoltan Borok-Nagy <[email protected]>
