From 773e533a09d2cd78807d43212cbd9caa62a9b673 Mon Sep 17 00:00:00 2001 From: Jingyu Zhou Date: Mon, 13 Jul 2020 21:10:34 -0700 Subject: [PATCH] Make Arena's impl private --- fdbserver/BackupWorker.actor.cpp | 12 +++--------- flow/Arena.h | 6 +++++- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/fdbserver/BackupWorker.actor.cpp b/fdbserver/BackupWorker.actor.cpp index d18d839e20..2554ca9619 100644 --- a/fdbserver/BackupWorker.actor.cpp +++ b/fdbserver/BackupWorker.actor.cpp @@ -67,10 +67,6 @@ struct VersionedMessage { } }; -static bool sameArena(const Arena& a, const Arena& b) { - return a.impl.getPtr() == b.impl.getPtr(); -} - struct BackupData { const UID myId; const Tag tag; // LogRouter tag for this worker, i.e., (-2, i) @@ -338,11 +334,10 @@ struct BackupData { for (int i = 0; i < num; i++) { const Arena& a = messages[i].arena; const Arena& b = messages[i + 1].arena; - if (!sameArena(a, b)) { + if (!a.sameArena(b)) { bytes += messages[i].bytes; TraceEvent(SevDebugMemory, "BackupWorkerMemory", myId) - .detail("Release", messages[i].bytes) - .detail("Arena", (void*)a.impl.getPtr()); + .detail("Release", messages[i].bytes); } } lock->release(bytes); @@ -903,10 +898,9 @@ ACTOR Future pullAsyncData(BackupData* self) { // Note we aggressively peek (uncommitted) messages, but only committed // messages/mutations will be flushed to disk/blob in uploadData(). while (r->hasMessage()) { - if (!sameArena(prev, r->arena())) { + if (!prev.sameArena(r->arena())) { TraceEvent(SevDebugMemory, "BackupWorkerMemory", self->myId) .detail("Take", r->arena().getSize()) - .detail("Arena", (void*)r->arena().impl.getPtr()) .detail("Current", self->lock->activePermits()); wait(self->lock->take(TaskPriority::DefaultYield, r->arena().getSize())); diff --git a/flow/Arena.h b/flow/Arena.h index 1b8e026686..a483c124a4 100644 --- a/flow/Arena.h +++ b/flow/Arena.h @@ -112,7 +112,11 @@ public: friend void* operator new ( size_t size, Arena& p ); friend void* operator new[] ( size_t size, Arena& p ); -//private: + bool sameArena(const Arena& other) const { + return impl.getPtr() == other.impl.getPtr(); + } + +private: Reference impl; };