Merge lp:~zorba-coders/zorba/bug-914655 into lp:zorba

Proposed by David Graf
Status: Merged
Approved by: Markos Zaharioudakis
Approved revision: 10752
Merged at revision: 10763
Proposed branch: lp:~zorba-coders/zorba/bug-914655
Merge into: lp:zorba
Diff against target: 63 lines (+32/-0)
4 files modified
src/runtime/eval/eval.cpp (+14/-0)
src/runtime/eval/eval.h (+2/-0)
test/rbkt/ExpQueryResults/zorba/eval/eval_reset.xml.res (+1/-0)
test/rbkt/Queries/zorba/eval/eval_reset.xq (+15/-0)
To merge this branch: bzr merge lp:~zorba-coders/zorba/bug-914655
Reviewer Review Type Date Requested Status
Markos Zaharioudakis Approve
Matthias Brantner Approve
David Graf (community) Approve
Review via email: mp+101922@code.launchpad.net

Commit message

Fix for bug #914655.

Description of the change

Fix for bug #914655.

To post a comment you must log in.
Revision history for this message
David Graf (davidagraf) wrote :

Fix for bug #914655.

Revision history for this message
David Graf (davidagraf) :
review: Approve
Revision history for this message
Matthias Brantner (matthias-brantner) wrote :

Looks good to me. Could the problem be reproduced without debugger? If so, we should add a test for it.

Also adding Markos as a reviewer.

review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job bug-914655-2012-04-14T06-16-05.653Z is finished. The final status was:

All tests succeeded!

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1, Needs Fixing < 1, Pending < 1. Got: 2 Approve, 2 Pending.

Revision history for this message
David Graf (davidagraf) wrote :

> Looks good to me. Could the problem be reproduced without debugger? If so, we
> should add a test for it.

Good point. I found a test to add.

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job bug-914655-2012-04-15T16-56-58.153Z is finished. The final status was:

All tests succeeded!

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1, Needs Fixing < 1, Pending < 1. Got: 2 Approve, 2 Pending.

Revision history for this message
Markos Zaharioudakis (markos-za) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job bug-914655-2012-04-16T08-11-01.617Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/runtime/eval/eval.cpp'
2--- src/runtime/eval/eval.cpp 2012-04-09 23:08:06 +0000
3+++ src/runtime/eval/eval.cpp 2012-04-14 07:02:20 +0000
4@@ -62,6 +62,20 @@
5 {
6 }
7
8+/****************************************************************************//**
9+
10+********************************************************************************/
11+void
12+EvalIteratorState::reset(PlanState& aPlanState)
13+{
14+ PlanIteratorState::reset(aPlanState);
15+ // When an exception is thrown during an EvalIterator::nextImpl invocation
16+ // or when the EvalIterator doesn't return all resulting items of an other reason,
17+ // the PlanWrapper is not properly destroyed. Therefore, we destroy it in the reset
18+ // to prevent troubles the next time the EvalIterator is used.
19+ thePlanWrapper = 0;
20+}
21+
22
23 /****************************************************************************//**
24
25
26=== modified file 'src/runtime/eval/eval.h'
27--- src/runtime/eval/eval.h 2012-03-30 19:03:09 +0000
28+++ src/runtime/eval/eval.h 2012-04-14 07:02:20 +0000
29@@ -37,6 +37,8 @@
30 EvalIteratorState();
31
32 ~EvalIteratorState();
33+
34+ void reset(PlanState&);
35 };
36
37
38
39=== added file 'test/rbkt/ExpQueryResults/zorba/eval/eval_reset.xml.res'
40--- test/rbkt/ExpQueryResults/zorba/eval/eval_reset.xml.res 1970-01-01 00:00:00 +0000
41+++ test/rbkt/ExpQueryResults/zorba/eval/eval_reset.xml.res 2012-04-14 07:02:20 +0000
42@@ -0,0 +1,1 @@
43+not empty not empty not empty
44
45=== added file 'test/rbkt/Queries/zorba/eval/eval_reset.xq'
46--- test/rbkt/Queries/zorba/eval/eval_reset.xq 1970-01-01 00:00:00 +0000
47+++ test/rbkt/Queries/zorba/eval/eval_reset.xq 2012-04-14 07:02:20 +0000
48@@ -0,0 +1,15 @@
49+(:
50+ : Checks if the underlying EvalIterator is reset properly in case if not every
51+ : resulting item of the EvalIterator in the iteration before was consumed.
52+ : Simulated by doing an empty check on resulting items of the eval function.
53+ :)
54+
55+import module namespace reflection = "http://www.zorba-xquery.com/modules/reflection";
56+
57+for $x in (1,2,3)
58+let $code := "($x, 1, 2, 3)"
59+return
60+ if (not(empty(reflection:eval($code)))) then
61+ "not empty"
62+ else
63+ "empty"

Subscribers

People subscribed via source and target branches