ctDeferredIndexControl
Declaration
Function prototype:
NINT ctDeferredIndexControl(pDFKCTL pdfkctl);
Description
The ctDeferredIndexControl() function can be used for monitoring and controlling deferred indexing.
The function accepts one parameter, a pointer to a deferred key control structure:
typedef struct dfkctl {
COUNT version; /* version of this structure */
COUNT opcode; /* operation code */
LONG bufsiz; /* buffer size */
pTEXT bufptr; /* output buffer */
#ifndef ct8P
LONG pad;
#endif
} DFKCTL, *pDFKCTL;
To call this function set version to DFKCTL_VERS_CUR to use the current structure version from your c-tree header files, or specify a specific structure version such as DFKCTL_VERS_V01 (version 1 of this structure, which is currently the only version supported).
Set opcode to one of the following values:
For opcodes DFKCTLgetstats and DFKCTLgetstate, set bufptr to point to a DFKSTT structure (defined below), and set bufsiz to the size of this buffer.
Statistics and thread state variables are returned in a structure of the following format:
/* deferred indexing statistics */
#define DFKSTTvern 1 /* DFKSTT (deferred indexing stats) version # */
typedef struct dfkstt {
ULONG client_ver; /* client version of structure */
ULONG server_ver; /* server version of structure */
LONG8 tstamp; /* Time stamp: seconds since 70 */
LONG8 opnok; /* Successful file opens */
LONG8 addok; /* Successful adds */
LONG8 delok; /* Successful deletes */
LONG8 rwtok; /* Successful updates */
LONG8 opnerr; /* Failed file opens */
LONG8 adderr; /* Failed adds */
LONG8 delerr; /* Failed deletes */
LONG8 rwterr; /* Failed updates */
LONG8 addskp; /* Skipped adds */
LONG8 delskp; /* Skipped deletes */
LONG8 rwtskp; /* Skipped updates */
LONG qcnt; /* Queue entries */
LONG lognum; /* Log number of current scan pos */
LONG logpos; /* Offset of current scan pos */
DFRKOP curopT; /* Current operation for tran thread */
DFRKOP curopN; /* Current operation for non-tran thread*/
} DFKSTT, *pDFKSTT;
Return Values
Value |
Symbolic Constant |
Explanation |
---|---|---|
0 |
NO_ERROR |
Successful operation. |
See c-tree Plus Error Codes for a complete listing of valid c-tree Plus error values.
Example
1) Read deferred indexing statistics:
NINT rc;
DFKCTL dfkctl;
memset(&dfkctl,0,sizeof(dfkctl));
dfkctl.verson = DFKCTL_VERS_V01;
dfkctl.opcode = DFKCTLgetstats;
dfkctl.bufsiz = sizeof(dfkstt);
dfkctl.bufptr = (pTEXT) &dfkstt;
if ((rc = ctDeferredIndexControl(&dfkctl)) != NO_ERROR) {
printf("Error: Failed to get deferred indexing statistics: %d\n", rc);
} else {
/* display dfkstt structure members */
}
2) Read deferred indexing thread state:
NINT rc;
DFKCTL dfkctl;
memset(&dfkctl,0,sizeof(dfkctl));
dfkctl.verson = DFKCTL_VERS_V01;
dfkctl.opcode = DFKCTLgetstate;
dfkctl.bufsiz = sizeof(dfkstt);
dfkctl.bufptr = (pTEXT) &dfkstt;
if ((rc = ctDeferredIndexControl(&dfkctl)) != NO_ERROR) {
printf("Error: Failed to get deferred indexing statistics: %d\n", rc);
} else {
/* display dfkstt structure members */
}
3) Clear deferred indexing statistics:
NINT rc;
DFKCTL dfkctl;
dfkctl.verson = DFKCTL_VERS_V01;
dfkctl.opcode = DFKCTLclearstats;
if ((rc = ctDeferredIndexControl(&dfkctl))) {
printf("Error: Failed to reset deferred indexing statistics: %d\n", rc);
} else {
printf("Successfully reset deferred indexing statistics.\n");
}
4) Pause deferred indexing threads.
NINT rc;
DFKCTL dfkctl;
dfkctl.verson = DFKCTL_VERS_V01;
dfkctl.opcode = DFKCTLpausethrds;
if ((rc = ctDeferredIndexControl(&dfkctl))) {
printf("Error: Failed to pause deferred indexing threads: %d\n", rc);
} else {
printf("Successfully paused deferred indexing threads.\n");
}
5) Resume deferred indexing threads.
NINT rc;
DFKCTL dfkctl;
dfkctl.verson = DFKCTL_VERS_V01;
dfkctl.opcode = DFKCTLresumethrds;
if ((rc = ctDeferredIndexControl(&dfkctl))) {
printf("Error: Failed to resume deferred indexing threads: %d\n", rc);
} else {
printf("Successfully resumed deferred indexing threads.\n");
}