QuietCtree Temporarily suspends operation of the c-tree Server for specific files/actions. Declaration NINT QuietCtree( pTEXT filespec, LONG timeoutMS, LONG action ) Short Name ctQUIET() Description QuietCtree() supports various types actions related to pausing system activity. This allows, for example, a clean filesystem level copy of data and index files. External hardware snapshots are also possible when available. By having the files in a "closed" and "clean" (that is, flushed) state allows quick recovery from these backups. Unflushed files can also be copied, and if the transaction logs are included, a server can bring the files to a current consistent state during automatic recovery. QuietCtree() returns NSUP_ERR (454) on those servers where this feature is not enabled.
Block Action Codes
Unblock Action codes
Other options can be passed into ctQUIET() for additional control. These values are OR-ed into the action parameter. ctQUIET() Options
The following actions and options are combinations of the above actions for convenience.
The action codes for ctQUIET() are defined in ctport.h. Note: Except for ctQTblockLogFiles, all references to files imply c-tree data and/or index files. When the blocks are set, callers that hit the blocks sleep until the block is released and then continue with their API request, except when the caller’s transaction was aborted by QuietCtree(). If the transaction was aborted, then when the caller's block is released, the current API request returns with a QTAB_ERR (817). If the transaction was aborted but the caller has not made an API call since the transaction was aborted, then the next API call will return immediately with the QTAB_ERR. QTAB_ERR is returned to alert the caller that its current transaction has been aborted. Transactions are aborted by QuietCtree() only if ctQTnoActiveTran is part of the QuietCtree() request. QuietCtree() is designed to permit multiple calls to achieve the desired results. When the final blocking attribute is removed by a call to QuietCtree(), QuietCtree() is completed which gives ups its interlocks on other QuietCtree()/ctFILBLK() calls and dynamic dumps. A call to ctQUIET() with mode ctQTblockALL | ctQTflushAllFiles can be used to suspend all activity within c-treeACE and flush all files so that they have all updates written to disk and the update flag in the header of the files is reset, so that they can then be copied by an external process. However, this option forces a "no active transaction" state. This means that any transactions that are active when ctQUIET() is called are aborted. A call to ctQUIET() with mode ctQTblockAPI can be used to suspend all activity on the c-tree Server while files remain open, potentially having updated data and index cache pages that have not been written to disk. In this mode, active transactions are simply suspended and they are resumed when ctQUIET() is called with mode ctQTunblockAPI. If you use this ctQUIET() mode and then copy the data and index files and the active transaction log files, you can then run automatic recovery on the files and you will have a point in time consistent copy of the file (where the point of time is the time the ctQUIET() successfully blocked all API calls: transactions that are pending as of that time are not included in the files). Note: QuietCtree() cannot be called with a mix of ctQTblock and ctQTunblock action codes. Quiet vs. Blocking There is a subtle distinction between QuietCtree() and ctFILBLK(). QuietCtree() does not "physically" close files. This has particular implications on the Windows filesystem, as files are not allowed to be removed in this case as there is an open OS file handle still maintained. Compare to ctFILBLK() where files can be deleted or otherwise replaced while in the blocked state as the OS file handle may be released. Unix systems do not impose this restriction on files, thus, care should be taken in these environments to not replace or otherwise delete a file while in a Quiet state. Always use the file block API to physically replace a file. Return Values
Possible sysiocod Returns
See c-tree Plus Error Codes for a complete listing of valid c-tree Plus error values. Example
{
if (!QuietCtree( NULL, 1000, ctQTblockALL | ctQTflushAllFiles )) {
printf("Successful Quiesce.\n\n");
printf("It is now safe to perform sytem administrator duties.\n");
printf("Press RETURN once the backup is completed to resume the c-tree Server\n");
if (rc = ctQUIET( NULL, 1000, ctQTunblockALL )) {
printf("Could not resume. Error: %d\n", rc);
}
printf("Could not quiesce\n");
} return(0); } See Also ctFILBLK() |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||