Bug 1352871

Summary: [Bitrot]: Scrub status- Certain fields continue to show previous run's details, even if the current run is in progress
Product: [Community] GlusterFS Reporter: Kotresh HR <khiremat>
Component: bitrotAssignee: Kotresh HR <khiremat>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: unspecified Docs Contact: bugs <bugs>
Priority: unspecified    
Version: mainlineCC: bugs, mzywusko, rhs-bugs, sanandpa
Target Milestone: ---Keywords: ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: v3.10.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1337444
: 1355635 (view as bug list) Environment:
Last Closed: 2017-03-08 09:31:02 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: 1337444    
Bug Blocks: 1355635, 1355639    

Description Kotresh HR 2016-07-05 10:43:20 UTC
+++ This bug was initially created as a clone of Bug #1337444 +++

Description of problem:
========================

In scenarios where scrubber would take more time to finish scrubbing files, a 'scrub status' output when scrubbing is in progress, displays the previous run's information for 'last completed scrub time' and 'duration of last scrub'. This provides an incorrect view to the user, giving the impression that scrubbing has completed. We should ideally have the field 'State of scrub' set to 'In progress' and the above mentioned fields set to '-' . The other two fields (files scrubbed, files skipped) correctly show the present run's details.


Version-Release number of selected component (if applicable):
=============================================================

How reproducible:
================
Always


Steps to Reproduce:
====================

1. Have a 4node cluster, with a dist-rep volume and sharding enabled. Set the scrub frequency to 'hourly'
2. Create 100 1MB files and wait for the scrubber to finish its run.
3. View the scrub status output for the validity of the fields that it shows.
4. Create 5 4GB files and wait for the next run of scrubbing to start. 
5. When the scrubbing is in progress (as seen from scrub.log), issue a 'gluster volume bitrot <volname> scrub status'

Actual results:
===============
Scrub status shows 4 fields with respect to every node. 2 fields are updated as per the current run, and 2 as per the previous run.


Expected results:
=================
Either all the 4 fields must reflect the current run, OR all 4 fields must reflect the previous run. Preferable would be to let the user know that scrubbing is in progress, and update the fields accordingly.

Comment 1 Kotresh HR 2016-07-05 10:44:37 UTC
The two fields 'last completed scrub time' and 'duration of last scrub' is actually related to last scrub run as the name it self indicates. In order to 
avoid confusion, showing whether the scrub is actually is "In progress" or "Idle"
will help.

Comment 2 Vijay Bellur 2016-07-05 10:45:32 UTC
REVIEW: http://review.gluster.org/14864 (feature/bitrot: Show whether scrub is in progress/idle) posted (#1) for review on master by Kotresh HR (khiremat)

Comment 3 Vijay Bellur 2016-07-11 09:45:33 UTC
REVIEW: http://review.gluster.org/14864 (feature/bitrot: Show whether scrub is in progress/idle) posted (#2) for review on master by Kotresh HR (khiremat)

Comment 4 Vijay Bellur 2016-07-11 13:32:09 UTC
COMMIT: http://review.gluster.org/14864 committed in master by Jeff Darcy (jdarcy) 
------
commit f4757d256e3e00132ef204c01ed61f78f705ad6b
Author: Kotresh HR <khiremat>
Date:   Mon Jul 4 17:25:57 2016 +0530

    feature/bitrot: Show whether scrub is in progress/idle
    
    Bitrot scrub status shows whether the scrub is paused
    or active. It doesn't show whether the scrubber is
    actually scrubbing or waiting in the timer wheel
    for the next schedule. This patch shows this status
    with "In Progress" and "Idle" respectively.
    
    Change-Id: I995d8553d1ff166503ae1e7b46282fc3ba961f0b
    BUG: 1352871
    Signed-off-by: Kotresh HR <khiremat>
    Reviewed-on: http://review.gluster.org/14864
    Smoke: Gluster Build System <jenkins.org>
    NetBSD-regression: NetBSD Build System <jenkins.org>
    CentOS-regression: Gluster Build System <jenkins.org>
    Reviewed-by: Jeff Darcy <jdarcy>