Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zpool import progress indicator #8646

Closed
wants to merge 2 commits into from

Commits on Oct 24, 2021

  1. Add kstat_read() for linux and freebsd

    On linux, kstats are fetched with open(),read(),close() or similar.
    On freebsd, they are fetched with sysctl.
    
    Create compat functions that do the right thing for the platform.
    Currently handles only kstats which are directly below "zfs".
    
    Signed-off-by: Olaf Faaland <[email protected]>
    ofaaland committed Oct 24, 2021
    Configuration menu
    Copy the full SHA
    c641f54 View commit details
    Browse the repository at this point in the history
  2. zpool import progress reports for long imports

    When an import requires a long MMP activity check, or when the user
    requests pool recovery, the import make take a long time.  The user may
    not know why, or be able to tell whether the import is progressing or is
    hung.
    
    Add a new option to "zpool import", "-v" (for verbose).
    
    When the -v option is used, create an additional thread which
    periodically checks the contents of kstat/zfs/import_progress.  If the
    import does not finish quickly, it reports the following on stdout:
    * Name and guid of pool being imported
    * User-friendly version of spa_load_state
    * Expected time import will complete
    * the max txg if recovering the pool
    
    If one or more of these values change, the thread prints a new record.
    
    A new record will be printed to stdout with a maximum frequency of one
    per second so as not to spam the user.  As a result the printed output
    may reflect only some of the import states transitioned through.
    
    Use import kstat to check for Multihost activity check in relevant
    tests, instead of using import duration, which works poorly when testing
    on a slow machine.
    
    Sample output:
    
    	Pool tank1 (guid 4591991398949870326):
    	Checking for a remote import.
    	Check will complete by Tue Apr 16 08:43:58 2019
    
    	Pool tank1 (guid 4591991398949870326):
    	Checking for a remote import.
    	Check will complete by Tue Apr 16 08:44:43 2019
    	Recovering Pool max txg 745
    
    Signed-off-by: Olaf Faaland <[email protected]>
    ofaaland committed Oct 24, 2021
    Configuration menu
    Copy the full SHA
    c7b9aa8 View commit details
    Browse the repository at this point in the history