From 4dddaa0274afd449d0abab190f2f36d2176b2a27 Mon Sep 17 00:00:00 2001 From: David Hall Date: Mon, 29 Jun 2020 11:21:02 -0500 Subject: [PATCH 1/2] MCOL-4124 return error when COMMIT|ROLLBACK error --- dbcon/mysql/ha_mcs_dml.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/dbcon/mysql/ha_mcs_dml.cpp b/dbcon/mysql/ha_mcs_dml.cpp index 8d5ac4ba8..d9903f269 100644 --- a/dbcon/mysql/ha_mcs_dml.cpp +++ b/dbcon/mysql/ha_mcs_dml.cpp @@ -549,22 +549,18 @@ int ha_mcs_impl_write_last_batch(TABLE* table, cal_connection_info& ci, bool abo { ci.rowsHaveInserted += size; command = "COMMIT"; - ProcessCommandStatement ( thd, command, ci, schema ); + rc = ProcessCommandStatement ( thd, command, ci, schema ); } else if (useHdfs) { ci.rowsHaveInserted += size; command = "COMMIT"; - ProcessCommandStatement ( thd, command, ci, schema ); + rc = ProcessCommandStatement ( thd, command, ci, schema ); } else if (( rc != 0) || abort ) { command = "ROLLBACK"; - ProcessCommandStatement ( thd, command, ci, schema ); - } - else - { - return rc; + rc =ProcessCommandStatement ( thd, command, ci, schema ); } return rc; @@ -630,7 +626,7 @@ int ha_mcs_impl_write_row_(const uchar* buf, TABLE* table, cal_connection_info& if ( thd->killed > 0 ) { command = "ROLLBACK"; - ProcessCommandStatement ( thd, command, ci, schema ); + rc = ProcessCommandStatement ( thd, command, ci, schema ); } else if (rc != dmlpackageprocessor::DMLPackageProcessor::ACTIVE_TRANSACTION_ERROR) { @@ -638,17 +634,17 @@ int ha_mcs_impl_write_row_(const uchar* buf, TABLE* table, cal_connection_info& if ( rc != 0 ) { command = "ROLLBACK"; - ProcessCommandStatement ( thd, command, ci, schema ); + rc = ProcessCommandStatement ( thd, command, ci, schema ); } else if (( rc == 0 ) && (!(thd->variables.option_bits & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))) { command = "COMMIT"; - ProcessCommandStatement ( thd, command, ci, schema ); + rc = ProcessCommandStatement ( thd, command, ci, schema ); } else if (useHdfs) { command = "COMMIT"; - ProcessCommandStatement ( thd, command, ci, schema ); + rc = ProcessCommandStatement ( thd, command, ci, schema ); } } } From ff3a7835c507d139c50afe4205a4405ed31c8529 Mon Sep 17 00:00:00 2001 From: David Hall Date: Mon, 29 Jun 2020 17:50:11 -0500 Subject: [PATCH 2/2] MCOL-4124 Don't not return error when Insert fails --- dbcon/mysql/ha_mcs_dml.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/dbcon/mysql/ha_mcs_dml.cpp b/dbcon/mysql/ha_mcs_dml.cpp index d9903f269..d79b1c6cb 100644 --- a/dbcon/mysql/ha_mcs_dml.cpp +++ b/dbcon/mysql/ha_mcs_dml.cpp @@ -545,24 +545,26 @@ int ha_mcs_impl_write_last_batch(TABLE* table, cal_connection_info& ci, bool abo return rc; //@Bug 4605 + int rc1 = 0; if ( (rc == 0) && !abort && (!(thd->variables.option_bits & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))) { ci.rowsHaveInserted += size; command = "COMMIT"; - rc = ProcessCommandStatement ( thd, command, ci, schema ); + rc1 = ProcessCommandStatement ( thd, command, ci, schema ); } else if (useHdfs) { ci.rowsHaveInserted += size; command = "COMMIT"; - rc = ProcessCommandStatement ( thd, command, ci, schema ); + rc1 = ProcessCommandStatement ( thd, command, ci, schema ); } else if (( rc != 0) || abort ) { command = "ROLLBACK"; - rc =ProcessCommandStatement ( thd, command, ci, schema ); + rc1 = ProcessCommandStatement ( thd, command, ci, schema ); } - + rc = max(rc, rc1); + return rc; } @@ -631,21 +633,23 @@ int ha_mcs_impl_write_row_(const uchar* buf, TABLE* table, cal_connection_info& else if (rc != dmlpackageprocessor::DMLPackageProcessor::ACTIVE_TRANSACTION_ERROR) { //@Bug 4605 + int rc1 = 0; if ( rc != 0 ) { command = "ROLLBACK"; - rc = ProcessCommandStatement ( thd, command, ci, schema ); + rc1 = ProcessCommandStatement ( thd, command, ci, schema ); } else if (( rc == 0 ) && (!(thd->variables.option_bits & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))) { command = "COMMIT"; - rc = ProcessCommandStatement ( thd, command, ci, schema ); + rc1 = ProcessCommandStatement ( thd, command, ci, schema ); } else if (useHdfs) { command = "COMMIT"; - rc = ProcessCommandStatement ( thd, command, ci, schema ); + rc1 = ProcessCommandStatement ( thd, command, ci, schema ); } + rc = max(rc, rc1); } } @@ -1698,7 +1702,7 @@ int ha_mcs_impl_write_batch_row_(const uchar* buf, TABLE* table, cal_impl_if::ca } else { - buf = buf + 2 ; + buf = buf + 2; } } else //utf8