MCPcopy Create free account
hub / github.com/apple/foundationdb / getKeyLocation

Function getKeyLocation

fdbclient/NativeAPI.actor.cpp:2940–2972  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2938
2939template <class F>
2940Future<KeyRangeLocationInfo> getKeyLocation(Database const& cx,
2941 TenantInfo const& tenant,
2942 Key const& key,
2943 F StorageServerInterface::*member,
2944 SpanContext spanContext,
2945 Optional<UID> debugID,
2946 UseProvisionalProxies useProvisionalProxies,
2947 Reverse isBackward,
2948 Version version) {
2949 // we first check whether this range is cached
2950 Optional<KeyRangeLocationInfo> locationInfo = cx->getCachedLocation(tenant.name, key, isBackward);
2951 if (!locationInfo.present()) {
2952 return getKeyLocation_internal(
2953 cx, tenant, key, spanContext, debugID, useProvisionalProxies, isBackward, version);
2954 }
2955
2956 bool onlyEndpointFailedAndNeedRefresh = false;
2957 for (int i = 0; i < locationInfo.get().locations->size(); i++) {
2958 if (checkOnlyEndpointFailed(cx, locationInfo.get().locations->get(i, member).getEndpoint())) {
2959 onlyEndpointFailedAndNeedRefresh = true;
2960 }
2961 }
2962
2963 if (onlyEndpointFailedAndNeedRefresh) {
2964 cx->invalidateCache(locationInfo.get().tenantEntry.prefix, key);
2965
2966 // Refresh the cache with a new getKeyLocations made to proxies.
2967 return getKeyLocation_internal(
2968 cx, tenant, key, spanContext, debugID, useProvisionalProxies, isBackward, version);
2969 }
2970
2971 return locationInfo.get();
2972}
2973
2974template <class F>
2975Future<KeyRangeLocationInfo> getKeyLocation(Reference<TransactionState> trState,

Calls 11

checkOnlyEndpointFailedFunction · 0.85
TenantInfoClass · 0.85
mapFunction · 0.85
getCachedLocationMethod · 0.80
invalidateCacheMethod · 0.80
getTenantInfoMethod · 0.80
tenantIdMethod · 0.80
trySetTenantIdMethod · 0.80
getMethod · 0.65
presentMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected