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

Method peekLocal

fdbserver/TagPartitionedLogSystem.actor.cpp:881–1082  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

879}
880
881Reference<ILogSystem::IPeekCursor> TagPartitionedLogSystem::peekLocal(UID dbgid,
882 Tag tag,
883 Version begin,
884 Version end,
885 bool useMergePeekCursors,
886 int8_t peekLocality) {
887 if (tag.locality >= 0 || tag.locality == tagLocalityUpgraded || tag.locality == tagLocalitySpecial) {
888 peekLocality = tag.locality;
889 }
890 ASSERT(peekLocality >= 0 || peekLocality == tagLocalityUpgraded || tag.locality == tagLocalitySpecial);
891
892 int bestSet = -1;
893 bool foundSpecial = false;
894 int logCount = 0;
895 for (int t = 0; t < tLogs.size(); t++) {
896 if (tLogs[t]->logServers.size() && tLogs[t]->locality != tagLocalitySatellite) {
897 logCount++;
898 }
899 if (tLogs[t]->logServers.size() &&
900 (tLogs[t]->locality == tagLocalitySpecial || tLogs[t]->locality == tagLocalityUpgraded ||
901 tLogs[t]->locality == peekLocality || peekLocality == tagLocalityUpgraded ||
902 peekLocality == tagLocalitySpecial)) {
903 if (tLogs[t]->locality == tagLocalitySpecial || tLogs[t]->locality == tagLocalityUpgraded) {
904 foundSpecial = true;
905 }
906 bestSet = t;
907 break;
908 }
909 }
910 if (bestSet == -1) {
911 TraceEvent("TLogPeekLocalNoBestSet", dbgid)
912 .detail("Tag", tag.toString())
913 .detail("Begin", begin)
914 .detail("End", end)
915 .detail("LogCount", logCount);
916 if (useMergePeekCursors || logCount > 1) {
917 throw worker_removed();
918 } else {
919 return makeReference<ILogSystem::ServerPeekCursor>(
920 Reference<AsyncVar<OptionalInterface<TLogInterface>>>(), tag, begin, getPeekEnd(), false, false);
921 }
922 }
923
924 if (begin >= tLogs[bestSet]->startVersion) {
925 TraceEvent("TLogPeekLocalBestOnly", dbgid)
926 .detail("Tag", tag.toString())
927 .detail("Begin", begin)
928 .detail("End", end)
929 .detail("BestSet", bestSet)
930 .detail("BestSetStart", tLogs[bestSet]->startVersion)
931 .detail("LogId", tLogs[bestSet]->logServers[tLogs[bestSet]->bestLocationFor(tag)]->get().id());
932 if (useMergePeekCursors) {
933 return makeReference<ILogSystem::MergedPeekCursor>(tLogs[bestSet]->logServers,
934 tLogs[bestSet]->bestLocationFor(tag),
935 tLogs[bestSet]->logServers.size() + 1 -
936 tLogs[bestSet]->tLogReplicationFactor,
937 tag,
938 begin,

Callers

nothing calls this directly

Calls 10

TraceEventClass · 0.85
detailMethod · 0.80
bestLocationForMethod · 0.80
logServerStringMethod · 0.80
emplace_backMethod · 0.80
getMethod · 0.65
sizeMethod · 0.45
toStringMethod · 0.45
idMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected