mco_trans_log 函数使用注意事项

当用户定义的迭代回调决定中断mco_translog_iterate()函数时,应返回非成功代码,如MCO_ERR_LAST或其后的代码,以便于识别错误来源。mco_translog_iterate()接受用户上下文参数void* user_ctx,用于传递回调中发生的情况和停止迭代的原因。如果回调返回非MCO_S_OK,函数会立即断开管道并返回该错误代码,但管道仍然可用。动态管道模式允许读者任意连接和断开,而正常模式确保所有交易被传递到迭代过程。
摘要由CSDN通过智能技术生成

When a user-defined iteration callback decides to interrupt function mco_translog_iterate() it should return any non-success code. It is preferable to choose some unique code, for example MCO_ERR_LAST orMCO_ERR_LAST+1 or so on to be able detect the exact source of error. This gives the ability to separate 'native' possible errors of function mco_translog_iterate() form errors passed by the user-defined callback.Function mco_translog_iterate() takes the argument 'void*user_ctx' (which is a user context for user-defined callback). Any other information about what has happened inside the user-defined callback and why it has decided to stop iterating should be passed via this user context.

If  the user-defined iteration callback returns a non-MCO_S_OK code, then function mco_translog_iterate() immediately disconnects from the pipe and stops, returning this error code. The pipe is still alive and can be utilized in future. If logging was started with option MCO_TRANSLOG_DYNAMIC_PIPE then the writer application (the logging source) continues its run and a new call to function mco_translog_iterate() can be invoked to utilize the pipe again.

If logging was not started with option MCO_TRANSLOG_DYNAMIC_PIPE it assumes that any problem on the reader's side brakes logging. Then the writer application (logging source) gets error MCO_E_TL_PIPE_TERM to any attempt to commit next transaction. The logging procedure should be re-started and commits should be done again.


There are generally two scenarios for pipe usage:

 

Normal. The pipe strictly checks that the reader (mco_translog_iterate) is alive and brakes the logging if any error condition happens. This mode guarantees delivery of all logged transactions to the user-defined iteration procedure.

 

Dynamic pipe. Varying numbers of readers (the total count should be less or equal to number of pipes created) can connect to a the logging pipe and disconnect from it at any arbitrary moment. This mode guarantees delivery only of transactions logged while the function mco_translog_iterate() is called. 


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值