Merge lp:~linuxjedi/drizzle/trunk-bug-689448 into lp:drizzle/7.0

Proposed by Andrew Hutchings
Status: Merged
Approved by: Brian Aker
Approved revision: 2006
Merged at revision: 2011
Proposed branch: lp:~linuxjedi/drizzle/trunk-bug-689448
Merge into: lp:drizzle/7.0
Diff against target: 49 lines (+18/-2)
3 files modified
drizzled/session.h (+1/-2)
plugin/innobase/tests/r/innodb_trx.result (+6/-0)
plugin/innobase/tests/t/innodb_trx.test (+11/-0)
To merge this branch: bzr merge lp:~linuxjedi/drizzle/trunk-bug-689448
Reviewer Review Type Date Requested Status
Drizzle Developers Pending
Review via email: mp+44058@code.launchpad.net

Description of the change

Avoid assert when retrieving an empty query string for the data_dictionary.innodb_trx table.

An assert on this table keeps cropping at various stages (3rd time now) so added a test case too.

To post a comment you must log in.
Revision history for this message
Brian Aker (brianaker) wrote :

Hi!

In this code you are working with a shared_ptr. This means that though you check it in one call, there is a chance it will have been changed by the time the second call is made. Either you need to make the call in just a single call, or you need to copy the shared_ptr locally and then make use of it from there.

Cheers,
   -Brina

Revision history for this message
Andrew Hutchings (linuxjedi) wrote :

ok, now just uses a copy of the shared pointer (or NULL)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'drizzled/session.h'
2--- drizzled/session.h 2010-12-08 18:53:46 +0000
3+++ drizzled/session.h 2010-12-17 18:47:12 +0000
4@@ -431,11 +431,10 @@
5 {
6 QueryString tmp_string(getQueryString());
7
8- assert(tmp_string);
9 if (not tmp_string)
10 {
11 length= 0;
12- return 0;
13+ return NULL;
14 }
15
16 length= tmp_string->length();
17
18=== modified file 'plugin/innobase/tests/r/innodb_trx.result'
19--- plugin/innobase/tests/r/innodb_trx.result 2010-11-11 11:28:48 +0000
20+++ plugin/innobase/tests/r/innodb_trx.result 2010-12-17 18:47:12 +0000
21@@ -26,3 +26,9 @@
22 `TRX_ADAPTIVE_HASH_LATCHED` BIGINT NOT NULL,
23 `TRX_ADAPTIVE_HASH_TIMEOUT` BIGINT NOT NULL
24 ) ENGINE=FunctionEngine COLLATE = utf8_general_ci
25+use test;
26+create table t1 (a int);
27+start transaction;
28+select TRX_STATE,TRX_QUERY from data_dictionary.INNODB_TRX;
29+TRX_STATE TRX_QUERY
30+RUNNING NULL
31
32=== modified file 'plugin/innobase/tests/t/innodb_trx.test'
33--- plugin/innobase/tests/t/innodb_trx.test 2010-03-01 02:11:17 +0000
34+++ plugin/innobase/tests/t/innodb_trx.test 2010-12-17 18:47:12 +0000
35@@ -3,3 +3,14 @@
36 select * from INNODB_TRX;
37
38 show create table INNODB_TRX;
39+
40+# Make sure we don't hit a bad assert() with an empty transaction
41+connect (con1,localhost,root,,);
42+connect (con2,localhost,root,,);
43+connection con1;
44+use test;
45+create table t1 (a int);
46+start transaction;
47+connection con2;
48+sleep 0.1;
49+select TRX_STATE,TRX_QUERY from data_dictionary.INNODB_TRX;

Subscribers

People subscribed via source and target branches