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

Method addEmptyPage

fdbserver/DiskQueue.actor.cpp:1132–1171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1130 loc_t endLocation() const { return pushedPageCount() ? backPage().endSeq() : nextPageSeq; }
1131
1132 void addEmptyPage() {
1133 if (pushedPageCount()) {
1134 backPage().updateHash();
1135 ASSERT(backPage().payloadSize == Page::maxPayload);
1136 }
1137
1138 // pushed_pages.resize( pushed_pages.arena(), pushed_pages.size()+1 );
1139 if (!pushed_page_buffer)
1140 pushed_page_buffer = new StringBuffer(dbgid);
1141 pushed_page_buffer->alignReserve(sizeof(Page), pushed_page_buffer->size() + sizeof(Page));
1142 pushed_page_buffer->append(sizeof(Page));
1143
1144 ASSERT(nextPageSeq % sizeof(Page) == 0);
1145
1146 auto& p = backPage();
1147 memset(static_cast<void*>(&p), 0, sizeof(Page)); // FIXME: unnecessary?
1148 p.magic = 0xFDB;
1149 switch (diskQueueVersion) {
1150 case DiskQueueVersion::V0:
1151 p.implementationVersion = 0;
1152 break;
1153 case DiskQueueVersion::V1:
1154 p.implementationVersion = 1;
1155 break;
1156 case DiskQueueVersion::V2:
1157 p.implementationVersion = 2;
1158 break;
1159 }
1160 p.payloadSize = 0;
1161 p.seq = nextPageSeq;
1162 nextPageSeq += sizeof(Page);
1163 p.popped = poppedSeq;
1164
1165 if (pushedPageCount() == 8000) {
1166 TraceEvent("DiskQueueHighPageCount", dbgid)
1167 .detail("PushedPages", pushedPageCount())
1168 .detail("NextPageSeq", nextPageSeq)
1169 .detail("File0Name", rawQueue->files[0].dbgFilename);
1170 }
1171 }
1172
1173 ACTOR static void verifyCommit(DiskQueue* self,
1174 Future<Void> commitSynced,

Callers

nothing calls this directly

Calls 7

pushedPageCountFunction · 0.85
TraceEventClass · 0.85
updateHashMethod · 0.80
alignReserveMethod · 0.80
detailMethod · 0.80
sizeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected