You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by cf...@apache.org on 2021/11/26 19:09:32 UTC

[mesos] branch master updated: Fix fetcher cache reduction

This is an automated email from the ASF dual-hosted git repository.

cfnatali pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git


The following commit(s) were added to refs/heads/master by this push:
     new d1d7152  Fix fetcher cache reduction
d1d7152 is described below

commit d1d71526fc5705f1738f9518d689bb841763a910
Author: Thomas Langé <t....@criteo.com>
AuthorDate: Fri Nov 26 09:15:45 2021 +0100

    Fix fetcher cache reduction
    
    When artifact size is smaller than expected, we want to reduce recorded
    cache usage.
    
    To do it, we actually compute the delta as an off_t (signed). If delta is
    negative, we reclaim the extra space as it's not really used.
    
    This attempt was failing because computed delta is negative,
    and passed as Bytes to releaseSpace, which is uint32_t
    (unsigned). In most cases, casting a negative value into an uint will
    just give an unrelated value due to sign bit disappearing.
    
    By passing the positive value to Bytes(), we have a safer cast.
---
 src/slave/containerizer/fetcher.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/slave/containerizer/fetcher.cpp b/src/slave/containerizer/fetcher.cpp
index 87bba8d..da91c81 100644
--- a/src/slave/containerizer/fetcher.cpp
+++ b/src/slave/containerizer/fetcher.cpp
@@ -1229,7 +1229,7 @@ Try<Nothing> FetcherProcess::Cache::adjust(
     if (d <= 0) {
       entry->size = size.get();
 
-      releaseSpace(Bytes(d));
+      releaseSpace(Bytes(-d));
     } else {
       return Error("More cache size now necessary, not adjusting " +
                    entry->key);