parallel race condition found!
parallel race condition found!

problem
=======

problem occurs when a (non-parallel) bat iterator
- is used in a loop.
- and in the loop there is a parallel block (or it is a parallel bat loop).

basically the situation when the batloop would be repeatedly executed
and one time by thread A, the other time by thread B.

In that case, the new iteration interpret() would use the res
of the other threads. This leads to both threads overwrting their
results as they go, making the system highly unstable.

cause:
=======

batloop does some optimizations if it is in a loop. one of them was
thread-specific, namely re-using the handle->res member of the ITERATION
handle.

handle->res would allow batloops to contain return statement.
This is problematic as for parallel batloops it is very hard to implement.

solution
========

LANGUAGE CHANGE:

 b@batloop()
    if (b.count = 0) return -1;


does NOT work anymore!!!!

It also does not work from parallel blocks, by the way.

You may still use break:

 b@batloop()
    if (b.count = 0) break;

return statements in a batloop will be ignored

Now we don't need handle->res anymore, the whole bug also disappears.

zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb