Bug 1302012

Summary: [Tiering]: Values of watermarks, min free disk etc will be miscalculated with quota set on root directory of gluster volume
Product: [Community] GlusterFS Reporter: Nithya Balachandran <nbalacha>
Component: tieringAssignee: Nithya Balachandran <nbalacha>
Status: CLOSED CURRENTRELEASE QA Contact: bugs <bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.7.7CC: annair, bugs, dlambrig, hgowtham, kramdoss, nchilaka, vmallika
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: glusterfs-3.7.7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1301473 Environment:
Last Closed: 2016-04-19 07:53:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1300246, 1301473    
Bug Blocks:    

Description Nithya Balachandran 2016-01-26 14:20:36 UTC
+++ This bug was initially created as a clone of Bug #1301473 +++

+++ This bug was initially created as a clone of Bug #1300246 +++

Description of problem:
Hot tier's disk space is calculated using statfs and when quota is enabled,  limit usage is set on / directory, always the aggregate value of hot tier's capacity is returned. i.e., the quota value set for / directory is returned as hot tier's value. This will break the watermark levels, min free disk value etc causing promotion/demotion to break.

In the following scenario,

cold tier - 2 TB
hot tier - 200 GB
limit usage on / - 1.5 TB

when disk capacity of hot tier is calculated to set watermark limits, hot tier's capacity would be set to 1.5 TB. All watermark levels, min free disk  etc would then be based on 1.5 TB. i.e., low watermark would be 1.1 TB, high watermark at 1.3 TB, min free disk would be 1.3 TB. All these values are way above the total hot tier capacity which means promotions/demotions would be broken. 

Version-Release number of selected component (if applicable):
glusterfs-3.7.5-16.el7rhgs.x86_64

How reproducible:
Always

Steps to Reproduce:
1. create a tiered gluster volume and have legacy files on cold tier
2. Enable quota and set limit usage of / directory to a high value
3. Set low and high watermark to 20 and 30%
4. Promote all legacy files, all files would be promoted crossing watermark levels
Actual results: No demotion would be seen

The reverse case would be,
1. create a tiered gluster volume and have legacy files on cold tier
cold tier - 2 TB, hot tier - 200GB
2. Enable quota and set limit usage of / directory to a low value
quota on / set to 50 GB
3. Set low and high watermark to 20 and 30%
4. Try to promote files from cold tier. 
Actual results: No promotion would be seen

Expected results:
Hot tier's capacity should be calculated appropriately

Additional info:

--- Additional comment from Vijaikumar Mallikarjuna on 2016-01-20 06:05:06 EST ---

This is because 'features.quota-deem-statfs' is enabled by default and quota enforcer returns the 'limit value' on the directory and not the actual disk space.

Could you please try with below workaround and see if it works?

gluster volume set volname features.quota-deem-statfs off

--- Additional comment from krishnaram Karthick on 2016-01-21 01:08:33 EST ---

On a newly created volume with features.quota-deem-statfs set to 'off', quota limit set on root directory and attaching hot tier sets correct values of hot tier and watermarks work as expected. [see test-1]

However, Turning 'features.quota-deem-statfs' 'on' and 'off' on the fly doesn't seem to fetch appropriate values of hot tier. Hot tier's value seems to be set to the initial value while tier is attached and doesn't change dynamically . This means we should turn off features.quota-deem-statfs even before hot tier is attached. Attaching hot tier and then turning off 'features.quota-deem-statfs' would again have incorrect value of hot tier. [see test-2]

Test-1:
1) create a volume of size 2 TB
2) set quota on root directory to 1.5 TB
3) turn off 'features.quota-deem-statfs'
4) Write files on this volume - 40 x 2 GB files, 50 x 1GB files, 1000 x 100 MB files
5) Attach a hot tier of size 50 GB
6) set watermarks at 10% and 20%, i.e., 5GB and 10GB 
7) Heat 20 files of size 2GB
8) Only 6 files (12 GB) were promoted and demotions started immediately, demoting 3 files. This leaves hot tier with 6 GB of data which is perfect.

With features.quota-deem-statfs set to 'off' we seen the expected behavior.
i.e., quota was set to 1.5 TB, hot tier's actual capacity was taken into account and watermarks were set accordingly. Files were promoted and demoted as expected.

Test 2:
Following test-1, test-2 was done.

1) Turn on 'features.quota-deem-statfs' [Now, hot tier's capacity should be incorrect value of 1.5 TB and watermarks should be at a very high value and only promotions would be seen]
2) Heat 10 x 2 GB files
3) No files were promoted even after continuous heating of files
4) stopped and started the volume under test
5) Heated 10 x 2 files, all 10 files were heated. i.e., new values of hot tier is in effect only after volume was restarted.

Hence, the converse case would also be true. ie., having quota set to 1.5 TB and with hot tier attached, turning off 'features.quota-deem-statfs' would still fetch hot tier's value as 1.5 TB which is not expected.

I'll update the bug if there are any more findings.

--- Additional comment from Vijay Bellur on 2016-01-25 03:00:27 EST ---

REVIEW: http://review.gluster.org/13288 (cluster/tier: Ignore quota-deem-statfs for watermark calculation) posted (#1) for review on master by N Balachandran (nbalacha)

--- Additional comment from Vijay Bellur on 2016-01-25 11:06:10 EST ---

COMMIT: http://review.gluster.org/13288 committed in master by Dan Lambright (dlambrig) 
------
commit 9ce86c63e349eaafbd923b0b541d75e929ecbae7
Author: N Balachandran <nbalacha>
Date:   Mon Jan 25 13:27:42 2016 +0530

    cluster/tier: Ignore quota-deem-statfs for watermark calculation
    
    The tier process watermark calculations were incorrect when the
    quota-deem-statfs option was enabled. We now ignore this while
    calculating hot tier usage to determine watermark levels.
    
    Change-Id: I308bc24432e2fa5ad1d5703e80fc391433538bbb
    BUG: 1301473
    Signed-off-by: N Balachandran <nbalacha>
    Reviewed-on: http://review.gluster.org/13288
    Smoke: Gluster Build System <jenkins.com>
    Reviewed-by: mohammed rafi  kc <rkavunga>
    Tested-by: mohammed rafi  kc <rkavunga>
    CentOS-regression: Gluster Build System <jenkins.com>
    Reviewed-by: Dan Lambright <dlambrig>
    NetBSD-regression: NetBSD Build System <jenkins.org>
    Tested-by: Dan Lambright <dlambrig>

Comment 1 Vijay Bellur 2016-01-26 14:22:42 UTC
REVIEW: http://review.gluster.org/13292 (cluster/tier: Ignore quota-deem-statfs for watermark calculation) posted (#1) for review on release-3.7 by N Balachandran (nbalacha)

Comment 2 Vijay Bellur 2016-01-29 05:19:31 UTC
REVIEW: http://review.gluster.org/13292 (cluster/tier: Ignore quota-deem-statfs for watermark calculation) posted (#2) for review on release-3.7 by Pranith Kumar Karampuri (pkarampu)

Comment 3 Vijay Bellur 2016-02-01 05:07:05 UTC
COMMIT: http://review.gluster.org/13292 committed in release-3.7 by Pranith Kumar Karampuri (pkarampu) 
------
commit 204115c58622b5a15e1de8b6a909d77fdb49a226
Author: N Balachandran <nbalacha>
Date:   Mon Jan 25 13:27:42 2016 +0530

    cluster/tier: Ignore quota-deem-statfs for watermark calculation
    
    The tier process watermark calculations were incorrect when the
    quota-deem-statfs option was enabled. We now ignore this while
    calculating hot tier usage to determine watermark levels.
    
    Change-Id: I308bc24432e2fa5ad1d5703e80fc391433538bbb
    BUG: 1302012
    > Signed-off-by: N Balachandran <nbalacha>
    > Reviewed-on: http://review.gluster.org/13288
    > Smoke: Gluster Build System <jenkins.com>
    > Reviewed-by: mohammed rafi  kc <rkavunga>
    > Tested-by: mohammed rafi  kc <rkavunga>
    > CentOS-regression: Gluster Build System <jenkins.com>
    > Reviewed-by: Dan Lambright <dlambrig>
    > NetBSD-regression: NetBSD Build System <jenkins.org>
    > Tested-by: Dan Lambright <dlambrig>
    (cherry picked from commit 9ce86c63e349eaafbd923b0b541d75e929ecbae7)
    Signed-off-by: Nithya Balachandran <nbalacha>
    Reviewed-on: http://review.gluster.org/13292
    Reviewed-by: Pranith Kumar Karampuri <pkarampu>
    Tested-by: Pranith Kumar Karampuri <pkarampu>
    Smoke: Gluster Build System <jenkins.com>
    CentOS-regression: Gluster Build System <jenkins.com>
    NetBSD-regression: NetBSD Build System <jenkins.org>

Comment 4 Mike McCune 2016-03-28 23:11:51 UTC
This bug was accidentally moved from POST to MODIFIED via an error in automation, please see mmccune with any questions

Comment 5 Kaushal 2016-04-19 07:53:11 UTC
This bug is getting closed because a release has been made available that should address the reported issue. In case the problem is still not fixed with glusterfs-3.7.7, please open a new bug report.

glusterfs-3.7.7 has been announced on the Gluster mailinglists [1], packages for several distributions should become available in the near future. Keep an eye on the Gluster Users mailinglist [2] and the update infrastructure for your distribution.

[1] https://www.gluster.org/pipermail/gluster-users/2016-February/025292.html
[2] http://thread.gmane.org/gmane.comp.file-systems.gluster.user