# mco_translog_terminate

This function terminates transaction logging when logging `MCO_TRANSLOG_PIPE` was enabled and the pipe has become full.

### For an overview see page TL Applications

### Prototype

        MCO_RET	mco_translog_terminate(	mco_db_h db )

### Arguments

db | Database connection handle

### Description

> This function should be called to terminate transaction logging when `logging MCO_TRANSLOG_PIPE` was enabled and the pipe has become full, causing `MCO_READ_WRITE` transactions to block because there’s no room in the pipe. This can happen if something has gone wrong with the pipe reader (e.g. it crashed). In this case, `mco_translog_stop()` cannot be used because it writes an end-of-log marker in the pipe.

> If `MCO_TRANSLOG_PIPE` was not enabled, this function is identical to `mco_translog_stop()`.

### Return Codes

MCO_S_OK | The TL runtime was initialized successfully.
MCO_E_TL_NOT_STARTED | Transaction logging was not started.
MCO_E_TL_IO_ERROR | Disk IO error.
MCO_E_TL_PIPE_LOST | All connections to a pipe were closed and its data was lost.
MCO_E_TL_PIPE_TERM | Reader returned from function `mco_translog_iterate()` before the log was finished. It terminated logging by returning a value other than `MCO_S_OK` to the callback function.

Note: The logging process will always be stopped after calling function`mco_translog_terminate()` - even if an error occurs.

`mco_translog_terminate()` closes the pipe(s) and causes the readers to drop out at the moment it is called. The function `mco_translog_stop()` also stops logging gracefully, but the pipe will continue to be used by the reader until it has read the rest of the pipe content. With `mco_translog_stop()`, this activity can not be controlled by the writer.

In other words, `mco_translog_terminate()` terminates logging, the same as`mco_translog_stop()` for writer side, but the reader side instantly returns from the function `mco_translog_iterate()` with error `MCO_E_TL_PIPE_TERM`.

### Files

Header file:
mcolog.h
Source file:
mcolog.c
Library:
libmcolog.a