You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2020/01/27 18:53:00 UTC

[jira] [Commented] (IMPALA-9291) MemTracker's TryConsume() should behave consistent with Consume()/Release()

    [ https://issues.apache.org/jira/browse/IMPALA-9291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17024572#comment-17024572 ] 

ASF subversion and git services commented on IMPALA-9291:
---------------------------------------------------------

Commit 6ac51522d8505416e8ef7ae2d911741fd1c4a3e5 in impala's branch refs/heads/master from Zoltan Borok-Nagy
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=6ac5152 ]

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 <im...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>


> MemTracker's TryConsume() should behave consistent with Consume()/Release()
> ---------------------------------------------------------------------------
>
>                 Key: IMPALA-9291
>                 URL: https://issues.apache.org/jira/browse/IMPALA-9291
>             Project: IMPALA
>          Issue Type: Bug
>            Reporter: Zoltán Borók-Nagy
>            Assignee: Zoltán Borók-Nagy
>            Priority: Major
>
> Impala's MemTracker tracks allocated memory. MemTracker::Consume() is meant to be used in tandem with memory allocations and MemTracker::Release() is for de-allocations.
> However, both supports negative values, in this case MemTracker::Consume(negative_val) will invoke MemTracker::Release(*-*negative_val), and vica versa.
> On the other hand, TryConsume() is a no-op for values less than zero. This causes problems in the following scenario:
>  
> {noformat}
> TryConsume(-42); // no-op, returns true which means SUCCESS
> Release(-42); // => Consume(42)
> {noformat}
> Later when the mem tracker gets closed it will think there is 42 bytes of unallocated memory.
> Either we shouldn't allow negative values in Consume()/TryConsume()/Release(), or TryConsume() should invoke Release() in this case instead of doing nothing.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org