diff --git a/fdbclient/NativeAPI.actor.cpp b/fdbclient/NativeAPI.actor.cpp index 68c4018f99..2f2fefee6d 100644 --- a/fdbclient/NativeAPI.actor.cpp +++ b/fdbclient/NativeAPI.actor.cpp @@ -1116,16 +1116,19 @@ ACTOR Future< pair> > getKeyLocation( Database g_traceBatch.addEvent("TransactionDebug", info.debugID.get().first(), "NativeAPI.getKeyLocation.After"); ASSERT( keyServersShards.size() ); // There should always be storage servers, except on version 0 which should not get to this function + Reference cachedLocation; for (pair> keyServersShard : keyServersShards) { - cx->setCachedLocation(keyServersShard.first, keyServersShard.second); + auto locationInfo = cx->setCachedLocation(keyServersShard.first, keyServersShard.second); if (isBackward ? (keyServersShard.first.begin < key && keyServersShard.first.end >= key) : keyServersShard.first.contains(key)) { range = keyServersShard.first; - serverInterfaces = keyServersShard.second; + cachedLocation = locationInfo; } } - break; + ASSERT(isBackward ? (range.begin < key && range.end >= key) : range.contains(key)); + + return make_pair(range, cachedLocation); } } }