Hello Norbert Luksa, Tim Armstrong, Csaba Ringhofer, Impala Public Jenkins,

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/15050

to look at the new patch set (#5).

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
---
M be/src/runtime/mem-tracker-test.cc
M be/src/runtime/mem-tracker.h
2 files changed, 41 insertions(+), 25 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/50/15050/5
--
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: newpatchset
Gerrit-Change-Id: I22e613c49e4a6bd218e7f7f7c0d6bec95b75cff5
Gerrit-Change-Number: 15050
Gerrit-PatchSet: 5
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]>

Reply via email to