This is an automated email from the ASF dual-hosted git repository.
panjuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new d1ffc6f Use batch commit transaction (#7837)
d1ffc6f is described below
commit d1ffc6fd3a58dd98b19e3ab9235bfeb96c5cf1da
Author: avalon5666 <[email protected]>
AuthorDate: Mon Oct 19 10:27:02 2020 +0800
Use batch commit transaction (#7837)
---
.../scaling/core/execute/executor/importer/AbstractJDBCImporter.java | 2 ++
1 file changed, 2 insertions(+)
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/execute/executor/importer/AbstractJDBCImporter.java
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/execute/executor/importer/AbstractJDBCImporter.java
index 0b0cb7d..2271cfa 100755
---
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/execute/executor/importer/AbstractJDBCImporter.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/execute/executor/importer/AbstractJDBCImporter.java
@@ -109,9 +109,11 @@ public abstract class AbstractJDBCImporter extends
AbstractShardingScalingExecut
private List<Record> doFlush(final DataSource dataSource, final
List<Record> buffer) {
int i = 0;
try (Connection connection = dataSource.getConnection()) {
+ connection.setAutoCommit(false);
for (; i < buffer.size(); i++) {
execute(connection, buffer.get(i));
}
+ connection.commit();
} catch (final SQLException ex) {
log.error("flush failed: {}", buffer.get(i), ex);
return buffer.subList(i, buffer.size());