Skip to content

Commit

Permalink
fix undo support oracle table meta cache (apache#1749)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-ygy authored and jsbxyyx committed Oct 11, 2019
1 parent 5b8e453 commit 12dc58c
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
*/
package io.seata.rm.datasource.undo;

import com.alibaba.druid.util.JdbcConstants;
import io.seata.common.Constants;
import io.seata.common.exception.NotSupportYetException;
import io.seata.common.util.BlobUtils;
import io.seata.common.util.CollectionUtils;
import io.seata.config.ConfigurationFactory;
Expand All @@ -28,6 +30,7 @@
import io.seata.rm.datasource.DataSourceProxy;
import io.seata.rm.datasource.sql.struct.TableMeta;
import io.seata.rm.datasource.sql.struct.TableMetaCache;
import io.seata.rm.datasource.sql.struct.TableMetaCacheOracle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -303,7 +306,14 @@ public void undo(DataSourceProxy dataSourceProxy, String xid, long branchId) thr
Collections.reverse(sqlUndoLogs);
}
for (SQLUndoLog sqlUndoLog : sqlUndoLogs) {
TableMeta tableMeta = TableMetaCache.getTableMeta(dataSourceProxy, sqlUndoLog.getTableName());
TableMeta tableMeta;
if (JdbcConstants.ORACLE.equalsIgnoreCase(dataSourceProxy.getDbType())) {
tableMeta = TableMetaCacheOracle.getTableMeta(dataSourceProxy, sqlUndoLog.getTableName());
} else if (JdbcConstants.MYSQL.equalsIgnoreCase(dataSourceProxy.getDbType())) {
tableMeta = TableMetaCache.getTableMeta(dataSourceProxy, sqlUndoLog.getTableName());
} else {
throw new NotSupportYetException("not support dbType[" + dataSourceProxy.getDbType() + "]");
}
sqlUndoLog.setTableMeta(tableMeta);
AbstractUndoExecutor undoExecutor = UndoExecutorFactory.getUndoExecutor(
dataSourceProxy.getDbType(),
Expand Down

0 comments on commit 12dc58c

Please sign in to comment.