Merge lp:~hingo/drizzle/drizzle-execute-result_set-off-by-one into lp:~drizzle-trunk/drizzle/development
Status: | Merged |
---|---|
Approved by: | Mark Atwood on 2011-12-27 |
Approved revision: | 2458 |
Merged at revision: | 2480 |
Proposed branch: | lp:~hingo/drizzle/drizzle-execute-result_set-off-by-one |
Merge into: | lp:~drizzle-trunk/drizzle/development |
Diff against target: |
85 lines (+16/-3) 1 file modified
drizzled/plugin/client/cached.h (+16/-3) |
To merge this branch: | bzr merge lp:~hingo/drizzle/drizzle-execute-result_set-off-by-one |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Drizzle Merge Team | 2011-12-23 | Pending | |
Review via email:
|
Description of the change
Execute API has off by one error, there is always an empty row at the
end of each result set. This fixes it.
Sorry I have no test for this, I don't know who or what code uses this
in the server except for json_server, which has no tests currently.
David Shrewsbury (dshrews) wrote : | # |
Henrik Ingo (hingo) wrote : | # |
Thanks Shrews for enlightening me!
Of course, it would be even better to have a test somewhere that fails without this patch. But I'm glad to hear this area is covered by some tests, at least we should find out soon if I broke something or not.
Henrik Ingo (hingo) wrote : | # |
Just to document it for our children and whatnot, Shrews pointed me to the code in slave plugin that is affected by this:
queue_consumer.
*******
uint32_t found_rows= 0;
while (result_set.next())
{
string msg= result_
string com_id= result_
string orig_server_uuid= result_
string orig_commit_id= result_
if ((msg == "") || (found_rows == 1))
break;
/* No columns should be NULL */
assert(
assert(
assert(
assert(
google:
commit_id= com_id;
originating
originating
found_rows++;
}
if (found_rows == 0)
return false;
return true;
*******
The code will continue to work properly because of:
while (result_set.next())
The code currently works because it checks to omit the empty row at:
if ((msg == "") || (found_rows == 1))
break;
(It seems to me this is there specifically to work around this bug and could now be removed.)
Mark Atwood (fallenpegasus) wrote : | # |
Turns out it does fail in a test
http://
json_server.basic [ fail ]
--- ../plugin/
+++ /home/hudson/
@@ -3,9 +3,6 @@
http_post("http://
{
"query" : "select * from t1;",
- "result_set" : [
- [ "", "" ]
- ],
"sqlstate" : "00000"
}
@@ -15,8 +12,7 @@
{
"query" : "select * from t1;",
"result_set" : [
- [ "1", "from MySQL protocol" ],
- [ "", "" ]
+ [ "1", "from MySQL protocol" ]
],
"sqlstate" : "00000"
}
drizzletest: Result content mismatch
Henrik Ingo (hingo) wrote : | # |
More than anything else I'm surprised and confused to realize json_server has a tests directory and I've not seen it until now :-) Apologies for proposing to merge before running make test myself, I don't usually do that, in this case my brain apparently had just really decided that there is nothing to test, which is never true...
Seems you realized already that this test is wrong and the empty line needs to be removed from result set.
Hi Henrik,
The slave plugin makes extensive use of the Execute API. We should verify that the replication tests still pass with these changes. Running it through param-build should check that.
-Dave