Skip to content

Commit 077b559

Browse files
kavehahmadi60facebook-github-bot
authored andcommitted
log number of deleted inodes after GC completes
Summary: ## Log Number of Deleted Inodes After GC Completes This diff adds logging for the number of deleted inodes after the Garbage Collector (GC) completes. **Changes:** * In `EdenServer.cpp`, the lambda function passed to `thenTry` now captures the `totalNumberOfInodesBeforeGC` variable, which is used to calculate the number of deleted inodes. * In `LogEvent.h`, a new field `numOfDeletedInodes` is added to the `WorkingCopyGc` struct, along with a new constructor parameter to initialize it. The `populate` function is updated to include this new field. **Purpose:** This diff aims to provide additional logging information about the GC process, specifically the number of inodes deleted after completion. This can help with debugging and monitoring the performance of the GC. Reviewed By: MichaelCuevas, jdelliot Differential Revision: D75327069 fbshipit-source-id: 4d1b056e4e040a0e391120868565917a57ae5be2
1 parent f476b48 commit 077b559

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

eden/fs/service/EdenServer.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2753,20 +2753,26 @@ ImmediateFuture<uint64_t> EdenServer::garbageCollectWorkingCopy(
27532753
.thenTry([workingCopyRuntime,
27542754
structuredLogger = structuredLogger_,
27552755
mountPath,
2756-
inodeMap = mount.getInodeMap()](
2756+
inodeMap = mount.getInodeMap(),
2757+
totalNumberOfInodesBeforeGC](
27572758
folly::Try<uint64_t> numInvalidatedTry) {
27582759
auto runtime =
27592760
std::chrono::duration<double>{workingCopyRuntime.elapsed()};
27602761

27612762
bool success = numInvalidatedTry.hasValue();
27622763
int64_t numInvalidated =
27632764
success ? folly::to_signed(numInvalidatedTry.value()) : 0;
2764-
structuredLogger->logEvent(
2765-
WorkingCopyGc{runtime.count(), numInvalidated, success});
27662765
auto inodeCountsAfterGC = inodeMap->getInodeCounts();
27672766
auto totalNumberOfInodesAfterGC = inodeCountsAfterGC.fileCount +
27682767
inodeCountsAfterGC.treeCount +
27692768
inodeCountsAfterGC.unloadedInodeCount;
2769+
2770+
structuredLogger->logEvent(WorkingCopyGc{
2771+
runtime.count(),
2772+
numInvalidated,
2773+
success,
2774+
static_cast<int64_t>(
2775+
(totalNumberOfInodesBeforeGC - totalNumberOfInodesAfterGC))});
27702776
XLOGF(
27712777
DBG1,
27722778
"GC for: {}, completed in: {} seconds and invalidated {} inodes, total number of inodes {}",

eden/fs/telemetry/LogEvent.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -586,14 +586,23 @@ struct WorkingCopyGc : public EdenFSEvent {
586586
double duration = 0.0;
587587
int64_t numInvalidated = 0;
588588
bool success = false;
589+
int64_t numOfDeletedInodes = 0;
589590

590-
WorkingCopyGc(double duration, int64_t numInvalidated, bool success)
591-
: duration(duration), numInvalidated(numInvalidated), success(success) {}
591+
WorkingCopyGc(
592+
double duration,
593+
int64_t numInvalidated,
594+
bool success,
595+
int64_t numOfDeletedInodes)
596+
: duration(duration),
597+
numInvalidated(numInvalidated),
598+
success(success),
599+
numOfDeletedInodes(numOfDeletedInodes) {}
592600

593601
void populate(DynamicEvent& event) const override {
594602
event.addDouble("duration", duration);
595603
event.addInt("num_invalidated", numInvalidated);
596604
event.addBool("success", success);
605+
event.addInt("num_deleted_inodes", numOfDeletedInodes);
597606
}
598607

599608
const char* getType() const override {

0 commit comments

Comments
 (0)