Below is the list of changes that have just been committed into a local
5.1 repository of knielsen. When knielsen does a push these changes
will be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2008-03-27 12:41:00+01:00, knielsen@ymer.(none) +3 -0
BUG#35593: Memory leak in failed NDB execute() with blobs.
During NdbTransaction::execute() with blobs, the code keeps temporary
lists of operations in local variables. In case of errors in the
execute(), in some scenarios these lists of operations were not linked
back into the transaction object, causing them to memory leak.
mysql-test/suite/ndb/r/ndb_blob.result@stripped, 2008-03-27 12:40:53+01:00,
knielsen@ymer.(none) +8 -0
BUG#35593: Memory leak in failed NDB execute() with blobs.
During NdbTransaction::execute() with blobs, the code keeps temporary
lists of operations in local variables. In case of errors in the
execute(), in some scenarios these lists of operations were not linked
back into the transaction object, causing them to memory leak.
mysql-test/suite/ndb/t/ndb_blob.test@stripped, 2008-03-27 12:40:53+01:00,
knielsen@ymer.(none) +21 -0
BUG#35593: Memory leak in failed NDB execute() with blobs.
During NdbTransaction::execute() with blobs, the code keeps temporary
lists of operations in local variables. In case of errors in the
execute(), in some scenarios these lists of operations were not linked
back into the transaction object, causing them to memory leak.
storage/ndb/src/ndbapi/NdbTransaction.cpp@stripped, 2008-03-27 12:40:53+01:00,
knielsen@ymer.(none) +18 -0
BUG#35593: Memory leak in failed NDB execute() with blobs.
During NdbTransaction::execute() with blobs, the code keeps temporary
lists of operations in local variables. In case of errors in the
execute(), in some scenarios these lists of operations were not linked
back into the transaction object, causing them to memory leak.
diff -Nrup a/mysql-test/suite/ndb/r/ndb_blob.result
b/mysql-test/suite/ndb/r/ndb_blob.result
--- a/mysql-test/suite/ndb/r/ndb_blob.result 2007-12-10 13:29:20 +01:00
+++ b/mysql-test/suite/ndb/r/ndb_blob.result 2008-03-27 12:40:53 +01:00
@@ -448,6 +448,14 @@ select * from t1;
a b
1
commit;
+begin;
+insert into t1 values (3, repeat("w", 8000));
+insert into t1 values (2, repeat("x", 10000)),
+(3, repeat("y", 5000)),
+(4, repeat("z", 15000));
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+rollback;
+commit;
drop table t1;
set autocommit=1;
use test;
diff -Nrup a/mysql-test/suite/ndb/t/ndb_blob.test b/mysql-test/suite/ndb/t/ndb_blob.test
--- a/mysql-test/suite/ndb/t/ndb_blob.test 2007-12-10 13:29:20 +01:00
+++ b/mysql-test/suite/ndb/t/ndb_blob.test 2008-03-27 12:40:53 +01:00
@@ -381,6 +381,27 @@ create table t1 (
insert into t1 values(1, '');
select * from t1;
commit;
+
+# -- bug #35593 Memory leak in failed NDB execute() with blobs.
+connect (con1,localhost,root,,test);
+connect (con2,localhost,root,,test);
+
+# Force a deadlock.
+
+connection con2;
+begin;
+insert into t1 values (3, repeat("w", 8000));
+
+connection con1;
+--error 1205
+insert into t1 values (2, repeat("x", 10000)),
+ (3, repeat("y", 5000)),
+ (4, repeat("z", 15000));
+rollback;
+
+connection con2;
+commit;
+
drop table t1;
# -- bug #5349 --
diff -Nrup a/storage/ndb/src/ndbapi/NdbTransaction.cpp
b/storage/ndb/src/ndbapi/NdbTransaction.cpp
--- a/storage/ndb/src/ndbapi/NdbTransaction.cpp 2007-12-07 10:34:48 +01:00
+++ b/storage/ndb/src/ndbapi/NdbTransaction.cpp 2008-03-27 12:40:53 +01:00
@@ -368,6 +368,24 @@ NdbTransaction::execute(ExecType aTypeOf
{
if(savedError.code==0)
savedError= theError;
+ /**
+ * We abort the execute here. But we still need to put the split-off
+ * operation list back into the transaction object, or we will get a
+ * memory leak.
+ */
+ if (tPrepOp != NULL && tRestOp != NULL) {
+ if (theFirstOpInList == NULL)
+ theFirstOpInList = tRestOp;
+ else
+ theLastOpInList->next(tRestOp);
+ theLastOpInList = tLastOp;
+ }
+ if (tCompletedFirstOp != NULL) {
+ tCompletedLastOp->next(theCompletedFirstOp);
+ theCompletedFirstOp = tCompletedFirstOp;
+ if (theCompletedLastOp == NULL)
+ theCompletedLastOp = tCompletedLastOp;
+ }
DBUG_RETURN(-1);
}
| Thread |
|---|
| • bk commit into 5.1 tree (knielsen:1.2533) BUG#35593 | knielsen | 27 Mar 2008 |