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

Function readPhysicalMultiPage

fdbserver/VersionedBTree.actor.cpp:3041–3101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3039 }
3040
3041 ACTOR static Future<Reference<ArenaPage>> readPhysicalMultiPage(DWALPager* self,
3042 Standalone<VectorRef<PhysicalPageID>> pageIDs,
3043 int priority) {
3044 ASSERT(!self->memoryOnly);
3045
3046 // if (g_network->getCurrentTask() > TaskPriority::DiskRead) {
3047 // wait(delay(0, TaskPriority::DiskRead));
3048 // }
3049
3050 state Reference<ArenaPage> page = self->newPageBuffer(pageIDs.size());
3051 debug_printf("DWALPager(%s) op=readPhysicalMultiStart %s ptr=%p\n",
3052 self->filename.c_str(),
3053 toString(pageIDs).c_str(),
3054 page->rawData());
3055
3056 // TODO: Could a dispatched read try to write to page after it has been destroyed if this actor is cancelled?
3057 state int blockSize = self->physicalPageSize;
3058 std::vector<Future<int>> reads;
3059 for (int i = 0; i < pageIDs.size(); ++i) {
3060 reads.push_back(
3061 readPhysicalBlock(self, page, i * blockSize, blockSize, ((int64_t)pageIDs[i]) * blockSize, priority));
3062 }
3063 // wait for all the parallel read futures
3064 wait(waitForAll(reads));
3065
3066 debug_printf("DWALPager(%s) op=readPhysicalMultiDiskReadsComplete %s ptr=%p bytes=%d\n",
3067 self->filename.c_str(),
3068 toString(pageIDs).c_str(),
3069 page->rawData(),
3070 pageIDs.size() * blockSize);
3071
3072 try {
3073 page->postReadHeader(pageIDs.front());
3074 if (page->isEncrypted()) {
3075 EncryptionKey k = wait(self->keyProvider->getSecrets(page->encryptionKey));
3076 page->encryptionKey = k;
3077 }
3078 page->postReadPayload(pageIDs.front());
3079 debug_printf("DWALPager(%s) op=readPhysicalVerified %s ptr=%p bytes=%d\n",
3080 self->filename.c_str(),
3081 toString(pageIDs).c_str(),
3082 page->rawData(),
3083 pageIDs.size() * blockSize);
3084 } catch (Error& e) {
3085 // For header pages, error is a warning because recovery may still be possible
3086 TraceEvent(SevError, "RedwoodPageError")
3087 .error(e)
3088 .detail("Filename", self->filename.c_str())
3089 .detail("PageIDs", pageIDs)
3090 .detail("PageSize", self->physicalPageSize);
3091
3092 debug_printf("DWALPager(%s) postread failed for %s with %s\n",
3093 self->filename.c_str(),
3094 toString(pageIDs).c_str(),
3095 e.what());
3096
3097 throw;
3098 }

Callers 1

readMultiPageFunction · 0.85

Calls 15

readPhysicalBlockFunction · 0.85
waitForAllFunction · 0.85
TraceEventClass · 0.85
rawDataMethod · 0.80
postReadHeaderMethod · 0.80
frontMethod · 0.80
isEncryptedMethod · 0.80
postReadPayloadMethod · 0.80
detailMethod · 0.80
toStringFunction · 0.70
sizeMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected