Make Arena's impl private

This commit is contained in:
Jingyu Zhou 2020-07-13 21:10:34 -07:00
parent 9b1322f010
commit 773e533a09
2 changed files with 8 additions and 10 deletions

View File

@ -67,10 +67,6 @@ struct VersionedMessage {
} }
}; };
static bool sameArena(const Arena& a, const Arena& b) {
return a.impl.getPtr() == b.impl.getPtr();
}
struct BackupData { struct BackupData {
const UID myId; const UID myId;
const Tag tag; // LogRouter tag for this worker, i.e., (-2, i) 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++) { for (int i = 0; i < num; i++) {
const Arena& a = messages[i].arena; const Arena& a = messages[i].arena;
const Arena& b = messages[i + 1].arena; const Arena& b = messages[i + 1].arena;
if (!sameArena(a, b)) { if (!a.sameArena(b)) {
bytes += messages[i].bytes; bytes += messages[i].bytes;
TraceEvent(SevDebugMemory, "BackupWorkerMemory", myId) TraceEvent(SevDebugMemory, "BackupWorkerMemory", myId)
.detail("Release", messages[i].bytes) .detail("Release", messages[i].bytes);
.detail("Arena", (void*)a.impl.getPtr());
} }
} }
lock->release(bytes); lock->release(bytes);
@ -903,10 +898,9 @@ ACTOR Future<Void> pullAsyncData(BackupData* self) {
// Note we aggressively peek (uncommitted) messages, but only committed // Note we aggressively peek (uncommitted) messages, but only committed
// messages/mutations will be flushed to disk/blob in uploadData(). // messages/mutations will be flushed to disk/blob in uploadData().
while (r->hasMessage()) { while (r->hasMessage()) {
if (!sameArena(prev, r->arena())) { if (!prev.sameArena(r->arena())) {
TraceEvent(SevDebugMemory, "BackupWorkerMemory", self->myId) TraceEvent(SevDebugMemory, "BackupWorkerMemory", self->myId)
.detail("Take", r->arena().getSize()) .detail("Take", r->arena().getSize())
.detail("Arena", (void*)r->arena().impl.getPtr())
.detail("Current", self->lock->activePermits()); .detail("Current", self->lock->activePermits());
wait(self->lock->take(TaskPriority::DefaultYield, r->arena().getSize())); wait(self->lock->take(TaskPriority::DefaultYield, r->arena().getSize()));

View File

@ -112,7 +112,11 @@ public:
friend void* operator new ( size_t size, Arena& p ); friend void* operator new ( size_t size, Arena& p );
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<struct ArenaBlock> impl; Reference<struct ArenaBlock> impl;
}; };