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

Function findPhysicalLocation

fdbserver/DiskQueue.actor.cpp:1485–1526  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1483 }
1484
1485 void findPhysicalLocation(loc_t loc, int* file, int64_t* page, const char* context) {
1486 bool ok = false;
1487
1488 if (context)
1489 TraceEvent(SevInfo, "FindPhysicalLocation", dbgid)
1490 .detail("Page0Valid", firstPages(0).checkHash())
1491 .detail("Page0Seq", firstPages(0).seq)
1492 .detail("Page1Valid", firstPages(1).checkHash())
1493 .detail("Page1Seq", firstPages(1).seq)
1494 .detail("Location", loc)
1495 .detail("Context", context)
1496 .detail("File0Name", rawQueue->files[0].dbgFilename);
1497
1498 for (int i = 1; i >= 0; i--) {
1499 ASSERT_WE_THINK(firstPages(i).checkHash());
1500 if (firstPages(i).seq <= (size_t)loc) {
1501 *file = i;
1502 *page = (loc - firstPages(i).seq) / sizeof(Page);
1503 if (context)
1504 TraceEvent("FoundPhysicalLocation", dbgid)
1505 .detail("PageIndex", i)
1506 .detail("PageLocation", *page)
1507 .detail("SizeofPage", sizeof(Page))
1508 .detail("PageSequence", firstPages(i).seq)
1509 .detail("Location", loc)
1510 .detail("Context", context)
1511 .detail("File0Name", rawQueue->files[0].dbgFilename);
1512 ok = true;
1513 break;
1514 }
1515 }
1516 if (!ok)
1517 TraceEvent(SevError, "DiskQueueLocationError", dbgid)
1518 .detail("Page0Valid", firstPages(0).checkHash())
1519 .detail("Page0Seq", firstPages(0).seq)
1520 .detail("Page1Valid", firstPages(1).checkHash())
1521 .detail("Page1Seq", firstPages(1).seq)
1522 .detail("Location", loc)
1523 .detail("Context", context ? context : "")
1524 .detail("File0Name", rawQueue->files[0].dbgFilename);
1525 ASSERT(ok);
1526 }
1527
1528 // isValid(firstPage) == compare(firstPage, firstPage)
1529 // isValid(otherPage) == compare(firstPage, otherPage)

Callers

nothing calls this directly

Calls 3

TraceEventClass · 0.85
detailMethod · 0.80
checkHashMethod · 0.80

Tested by

no test coverage detected