Details
-
Bug
-
Resolution: Fixed
-
Critical
-
2.2.0
-
Security Level: Public
-
None
-
Untriaged
-
Unknown
Description
We were applying wrong rereduce function in views when we collect and merge the query result and apply the rereduce.In that rereduce function, we create a reduce context and store in erlang process table, but we were not deleting that context processing the query. So if the next query comes and mochiweb uses the same erlang process, the next query will find the context and use it. If both are queries are from different views, the reduce context applied to second query is wrong and the result will be wrong.To reproduce this issue, create following 2 view functions in different design doc:
view1:
map:
function (doc, meta) { |
emit(["A", "B"], ["couch", "base"]); |
}
|
reduce:
function(keys, values, rereduce) { |
return ["couch", "base"]; |
}
|
view2:
map:
|
function (doc, meta) { |
emit(["A1", "B1"], ["couch1", "base1"]); |
}
|
reduce:
function(keys, values, rereduce) { |
return ["couch1", "base1"]; |
}
|
Now when we query view1 and view2 with group=true, we can see that in view2 result there is value from view1.