Skip to main content

SYS.Database.BackgroundFileCompact

Class SYS.Database.BackgroundFileCompact Extends %SYS.BackgroundTask

Class to start, monitor and control the Database Compaction utiltity running in the background. The method run in the background is the FileCompact method of SYS.Database.

To start it

set oref=##class(SYS.Database.BackgroundFileCompact).Start(Directory,TargetFree)

Start returns an oref to an object of this class that can be inspected and reloaded to get status and progress updates. See superclass %SYS.BackgroundTask for detailed information on features of this object.

Parameters

CANCELDISPOSITION

Parameter CANCELDISPOSITION = -1;

Disposition for cancel requests.

0 - not allowed
1 - polls for cancel requests
-1 - directly terminate the process

PAUSEDISPOSITION

Parameter PAUSEDISPOSITION = -1;

Properties

Database

Property Database As %SysPath;

Database directory on which to operate

BlocksScanned

Property BlocksScanned As %Integer [ Calculated, SqlComputeCode = { set {*}={ProgressDetails} }, SqlComputed ];

Blocks scanned as part of compaction. This includes blocks that have been relocated, either explicity because they needed to be moved, or incidentally as part of the operation. Also includes blocks searched as required to move a big string storage block. The expected value is highly dependent on the physical structure of the databases and is hard to predict; it serves mostly as an indication of forward progress.

BlockSize

Property BlockSize As %Integer [ Internal, Private ];

Methods

Execute

Method Execute(dir, targfree) As %Status [ Internal, Private ]

OnStarting

Method OnStarting(dir, targfree) As %Status [ Internal, Private ]

GetProgress

Method GetProgress(ByRef current As %Integer, ByRef total As %Integer, ByRef details As %String, ByRef units As %String) As %Status [ Internal, Private ]

GetDisplayInfo

ClassMethod GetDisplayInfo(Output array) As %List [ Internal ]

Optional method to override in subclasses. Sets up output array with information about how to display properties defined in this subclass. The form of the output array is

array(i)=$listbuild(propertyname,label,isprogressdetail)

where the following meanings apply

  • i - A numeric index, starting at 1, and incrementing for each subclass property to display
  • propertyname - The name of the property to display
  • label - A (localized) string label to display for this property
  • qualifiers - A string of letter qualifiers that affect how the property will be displayed (see below)

qualifiers supported

  • "p" - Progress property; place this property with the standard progress information. Such properties typically have values derived from ProgressDetails, which is populated by the subclass in GetProgress.