Bug 1301473 - [Tiering]: Values of watermarks, min free disk etc will be miscalculated with quota set on root directory of gluster volume
[Tiering]: Values of watermarks, min free disk etc will be miscalculated with...
Product: GlusterFS
Classification: Community
Component: tiering (Show other bugs)
Unspecified Unspecified
unspecified Severity urgent
: ---
: ---
Assigned To: Nithya Balachandran
Depends On: 1300246
Blocks: 1302012
  Show dependency treegraph
Reported: 2016-01-25 02:55 EST by Nithya Balachandran
Modified: 2016-06-16 09:55 EDT (History)
6 users (show)

See Also:
Fixed In Version: glusterfs-3.8rc2
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1300246
: 1302012 (view as bug list)
Last Closed: 2016-06-16 09:55:37 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Nithya Balachandran 2016-01-25 02:55:11 EST
+++ 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):

How reproducible:

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 Red Hat Bugzilla Rules Engine on 2016-01-20 05:46:27 EST ---

--- 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]

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.
Comment 1 Vijay Bellur 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@redhat.com)
Comment 2 Vijay Bellur 2016-01-25 11:06:10 EST
COMMIT: http://review.gluster.org/13288 committed in master by Dan Lambright (dlambrig@redhat.com) 
commit 9ce86c63e349eaafbd923b0b541d75e929ecbae7
Author: N Balachandran <nbalacha@redhat.com>
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@redhat.com>
    Reviewed-on: http://review.gluster.org/13288
    Smoke: Gluster Build System <jenkins@build.gluster.com>
    Reviewed-by: mohammed rafi  kc <rkavunga@redhat.com>
    Tested-by: mohammed rafi  kc <rkavunga@redhat.com>
    CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
    Reviewed-by: Dan Lambright <dlambrig@redhat.com>
    NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
    Tested-by: Dan Lambright <dlambrig@redhat.com>
Comment 3 Niels de Vos 2016-06-16 09:55:37 EDT
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.8.0, please open a new bug report.

glusterfs-3.8.0 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] http://blog.gluster.org/2016/06/glusterfs-3-8-released/
[2] http://thread.gmane.org/gmane.comp.file-systems.gluster.user

Note You need to log in before you can comment on or make changes to this bug.