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

Function debugFileTruncate

fdbrpc/TraceFileIO.cpp:164–189  ·  view source on GitHub ↗

Updates the in-memory copy of tracked data to account for truncates (this simply invalidates any data after truncate point)

Source from the content-addressed store, hash-verified

162// Updates the in-memory copy of tracked data to account for truncates (this simply invalidates any data after truncate
163// point)
164void debugFileTruncate(std::string context, std::string file, int64_t offset) {
165 if (debugFileRegions.empty())
166 debugFileSetup();
167 if (debugFileTrim(file) == debugFileName) {
168 bool found = false;
169 for (auto itr = debugFileRegions.begin(); itr != debugFileRegions.end(); ++itr) {
170 if (itr->first + itr->second > offset) {
171 found = true;
172 TraceEvent("DebugFileTruncate")
173 .detail("Context", context)
174 .detail("Filename", file)
175 .detail("Offset", offset);
176 uint8_t* storeMask = debugFileMask[itr->first];
177 ASSERT(storeMask);
178
179 int64_t dbgOffset = std::max((int64_t)0, offset - itr->first);
180 memset(&storeMask[dbgOffset], 0, itr->second - dbgOffset);
181 }
182 }
183 if (!found)
184 TraceEvent("DebugFileSkippingTruncate")
185 .detail("Context", context)
186 .detail("Filename", file)
187 .detail("Offset", offset);
188 }
189}
190
191#else
192void debugFileCheck(std::string context, std::string file, const void* data, int64_t offset, int length) {}

Callers 1

truncateFunction · 0.85

Calls 7

debugFileSetupFunction · 0.85
debugFileTrimFunction · 0.85
TraceEventClass · 0.85
detailMethod · 0.80
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected