Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic

ctdbGetRebuildProgress

Retrieves the table’s rebuild progress counter.

DECLARATION

NINT ctdbGetRebuildProgress(CTHANDLE Handle);

DESCRIPTION

When a full alter table rebuild is in progress, the table handle keeps a counter of the progress. The progress is kept in terms of percent completed with values from 0% to 100%.

You can use this function with a CTDB_ON_TABLE_REBUILD callback to retrieve the progress indicator. CTDB_ON_TABLE_REBUILD is called for each percentage point. Before any records are processed, CTDB_ON_TABLE_REBUILD callback is called with a percentage value of zero to indicate that the operation is about to start. After all records are processed, CTDB_ON_TABLE_REBUILD is called again, this time with a percentage value of 100 to indicate the end of rebuild.

RETURN

A progress counter value from 0 to 100.

EXAMPLE

CTDBRET ctdbDECL OnTableRebuild(CTHANDLE Handle)

{

/* display a dot for every 5% rebuild completed */

NINT perc = ctdbGetREbuildProgress(Handle);


if (perc > 0 && (perc % 5) == 0)

printf(".");

return CTDBRET_OK;

}

SEE ALSO

ctdbClearAllCallback(), ctdbClearCallback(), ctdbGetCallback(), ctdbSetCallback()

TOCIndex