【问题标题】:Oracle GoldenGate Java Adapter lost data when transactionCommit() failed当 transactionCommit() 失败时 Oracle GoldenGate Java 适配器丢失数据
【发布时间】:2015-11-17 09:50:43
【问题描述】:

我目前正在开发一个自定义处理程序来提供 Oracle 更改日志。

当一些错误发生时,通常我可以抛出 RuntimeException 或返回 Status.ABEND。然后 OGG 将记录错误并停止该过程。

以下代码在 operationAdded() 失败时运行良好(即,Extract 进程将报告异常结束,并且当 Extract 错误后重新启动时,整个失败事务的操作将重新发送到处理程序。

@Override
public Status operationAdded(DsEvent e, DsTransaction tx,
        DsOperation dsOperation) {
    Status status = super.operationAdded(e, tx, dsOperation);
    ...
    //throw new RuntimeException("op add runtime error");
    return status;
}

但是,当 transactionCommit() 函数发生错误时,OGG 无法按预期工作。抛出 RuntimeException 和返回 Status.ABEND 都不能停止提取。 OGG 就像什么都没发生一样继续工作。 (代码如下)

@Override
public Status transactionCommit(DsEvent e, DsTransaction tx) {
    super.transactionCommit(e, tx);
    Status status = sendEvents();
    handlerProperties.totalTxns++;
    //throw new RuntimeException("tx ci runtime error");
    return Status.ABEND;
}

我试图杀死并重新启动 Extract 进程。失败的事务没有重新发送到处理程序。好像所有失败的交易数据都丢失了!

以下是transactionCommit()中返回Status.ABEND的日志:

...
DEBUG [main] (AbstractHandler.java:509) - Event: handler=ggdatahub, transactionCommit ( Commit transaction ) DsTransaction [ops=1, buffered=1, state=BEGIN, start=2015-08-21 20:04:25.842275, end=2015-08-21 20:04:25.842275]
WARN [main] (DsEventManager.java:231) - Error sending event to handler: status=ABEND, event=Commit transaction, handler=ggdatahub
Exception in thread "main" com.goldengate.atg.util.GGException: Unable to commit transaction, STATUS=ABEND
    at com.goldengate.atg.datasource.UserExitDataSource.commitActiveTransaction(UserExitDataSource.java:1392)
    at com.goldengate.atg.datasource.UserExitDataSource.commitTx(UserExitDataSource.java:1326)
Error occured in javawriter.c[752]:
***********************************************************************
Exception received committing transaction: com.goldengate.atg.util.GGException: Unable to commit transaction, STATUS=ABEND

DEBUG [main] (UserExitDataSource.java:504) - (JNI) C-user-exit checkpoint event
DEBUG [main] (UserExitDataSource.java:1364) - UserExitDataSource.CommitActiveTransaction: Same transaction committed more than once (possibly due to commit-on-checkpoint).
DEBUG [main] (UserExitDataSource.java:516) - UserExitDataSource.userExitCheckpoint: incrementing the flush counter
DEBUG [main] (PendingOpGroup.java:315) - now ready to checkpoint? false (was ready? false): {pendingOps=1, groupSize=0, timer=0:00:00.000 [total = 0 ms ]}
DEBUG [main] (UserExitDataSource.java:504) - (JNI) C-user-exit checkpoint event
DEBUG [main] (UserExitDataSource.java:1364) - UserExitDataSource.CommitActiveTransaction: Same transaction committed more than once (possibly due to commit-on-checkpoint).
DEBUG [main] (UserExitDataSource.java:516) - UserExitDataSource.userExitCheckpoint: incrementing the flush counter
DEBUG [pool-1-thread-1] (AbstractDataSource.java:737) -  [2] getStatusReport: Mon Aug 24 10:51:14 CST 2015
DEBUG [Thread-1] (UserExitDataSource.java:1601) - UserExitDataSource closing, #1 of class=UserExitDataSource
DEBUG [main] (PendingOpGroup.java:315) - now ready to checkpoint? false (was ready? false): {pendingOps=3, groupSize=0, timer=0:00:00.000 [total = 0 ms ]}
DEBUG [Thread-1] (UserExitDataSource.java:1608) - Shutting down data source; attempting a final checkpoint.
INFO [pool-1-thread-1] (AbstractDataSource.java:730) - Memory at Status : Max: 455.00 MB, Total: 60.50 MB, Free: 27.54 MB, Used: 32.96 MB
DEBUG [pool-1-thread-1] (UserExitDataSource.java:1637) - time spent checkpointing: 0:00:00.000 [total = 0 ms ]
DEBUG [Thread-1] (UserExitDataSource.java:1668) - doCheckpoint() called
INFO [pool-1-thread-1] (AbstractDataSource.java:980) - Status report: Mon Aug 24 10:51:14 CST 2015
*************************************************
Status Report for UserExit
*************************************************

Total elapsed time:        2 days 14:47:06.139 [total = 226026 sec = 3767 min = 62 hr ]   => Total time since first event
Event processing time:  0:00:12.692 [total = 12 sec ]   => Time spent sending msgs (max: 4795 ms)
Metadata process time:  0:00:02.159 [total = 2 sec ]   => Time spent receiving metadata (1 tables, 3 columns)

Operations Received/Sent:  3 / 3
 Rate (overall):         0 op/s    (peak: 0 op/s)
      (per event):       0 op/s

Transactions Received/Sent: 2 / 0
 Rate (overall):         0 tx/s    (peak: 0 tx/s)
      (per event):       0 tx/s

3 records processed as of Mon Aug 24 10:51:14 CST 2015 (rate 0/sec, delta 3)

*************************************************

有人知道如何解决这个问题吗?提前致谢!

【问题讨论】:

    标签: java oracle oracle-golden-gate


    【解决方案1】:

    对于可能遇到此问题的其他人:

    原来是个bug……

    我从 版本 12.1.2.1.4 20470586 OGGCORE_12.1.2.1.0OGGBP_PLATFORMS_150303.1209 切换到 版本 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230 .现在一切正常。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-03-08
      • 2013-08-04
      • 1970-01-01
      • 2014-07-03
      • 2021-10-20
      • 1970-01-01
      • 1970-01-01
      • 2018-08-26
      相关资源
      最近更新 更多