Attaching v3 patch which removes the conf param, and cache clear on useCache==false.
Is there code duplication in locateMeta? If so, does there have to be (no biggie.. just asking).
There is some between locateMeta and locateRegionInMeta, but adding this logic in locateRegionInMeta would make it even more complex. I think it should be fine.
I know it's a copy paste; but I don't think we should do that: often the second try is w/o cache to be sure, but trashing the cache for the others is bad, as the default for a second try is nearly always to bypass the cache
I think we can go either ways. The nice part about removing from cache is that one thread already knows that the location that is cached is no good, so it just removes it so that other threads will wait for this to finish the lookup of the new location. On some cases, this will save unnecessary trips to the bad location (and possible socket timeouts), while on other cases, a retry from a thread will stall the other lookup. v3 patch removes this cache invalidation though.