While source changes, the loop condition will never be checked again after the return true.
oh yeah, well that was not my intent. I wanted it to recheck. However for correctness, the source does not need to be rechecked. If after getting the new source it becomes invalid then either one key or a row will be read before switching. Its just not switching as soon as it could in this special case.
My thinking was that getting the iterator could take a bit of time because it may involve I/O. Therefore the new datasource could be invalidated by other concurrent actions (like bulk import or compactions). I am not really sure if its worth handling this special case. I would not be opposed to just changing to an if.