Bug #117865 ALTER TABLE with copying and BLOB column uses too large transactions
Submitted: 2 Apr 17:41 Modified: 3 Apr 6:06
Reporter: Mikael Ronström Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:8.4.3 OS:Any
Assigned to: CPU Architecture:Any

[2 Apr 17:41] Mikael Ronström
Description:
ALTER TABLE with copying and BLOB columns doesn't respect the
TRANS_TRANSACTIONS_OFF setting.

How to repeat:
Run this test case:
-- source include/have_ndb.inc
create table t1 (a int NOT NULL PRIMARY KEY, b int, c text) engine=ndb;
let $1=25001;
disable_query_log;
while ($1)
{
 eval insert into t1 values($1, 1, 'abc');
 dec $1;
}
enable_query_log;
alter table t1 modify column b bigint NOT NULL;
drop table t1;

Suggested fix:
diff --git a/storage/ndb/plugin/ha_ndbcluster.cc b/storage/ndb/plugin/ha_ndbcluster.cc
index 477aa4f67e2..f4f468a039f 100644
--- a/storage/ndb/plugin/ha_ndbcluster.cc
+++ b/storage/ndb/plugin/ha_ndbcluster.cc
@@ -3190,6 +3190,9 @@ inline int ha_ndbcluster::fetch_next(NdbScanOperation *cursor) {
     if (m_thd_ndb->m_unsent_blob_ops) {
       if (execute_no_commit(m_thd_ndb, trans, m_ignore_no_key) != 0)
         return ndb_err(trans);
+      if (m_thd_ndb->check_trans_option(Thd_ndb::TRANS_TRANSACTIONS_OFF)) {
+        m_thd_ndb->m_unsent_bytes = 12;
+      }
     }
 
     /* Should be no unexamined completed operations
[3 Apr 6:06] MySQL Verification Team
Hello Mikael,

Thank you for the report and feedback.

Sincerely,
Umesh