Fix race condition in checking topic mergeability

The list of changes in the topic is looked up using the secondary
index, which prepopulates the mergeable field on the ChangeData. This
value may be stale, as it is just a boolean yes/no, suitable
primarily for rendering the search results list. In particular, it
may not reflect the current state of the branch tip, if the
ReindexAfterUpdate queue has not yet been fully processed.

ActionsIT was hitting this race condition by submitting a change then
immediately checking the mergeability of a change conflicting with the
new branch tip. The mergeability of this second change should switch
from true to false as a result (blocking submission of the whole
topic). Because of this race condition, it was indeterminate which
mergeability bit would be returned from the search index.

The workaround for now is to allow explicitly clearing the mergeable
bit in ChangeData. A more robust change would be to tweak the index
system to say we want to prepopulate the ChangeData with fewer stored
fields from the index. As InternalChangeQuery is used more, this may
become more and more important.

Change-Id: I847c7896371451b85a05f4d768b805b953b61466
3 files changed