Split change index into two for open/closed changes

When preprocessing predicates to send to the index, determine the set
of change statuses that can possibly match that change, and use this
to send the query to the minimal set of indexes needed to satisfy it.
Do not attempt to rewrite the query further by e.g. splitting the
result and pruning subtrees that cannot be satisfied by a particular
index; assume once we hit the index, the extra cost of branches that
cannot contribute to the result is negligible.

When updating a change, delete the change from the index where it
doesn't belong. This adds an indexing step at many more places that
modify changes.

Change-Id: I928d34c883d3f8558e9324db5fa558f7b3b97612
9 files changed