Skip to content

Commit df7a3a7

Browse files
anand1976facebook-github-bot
authored andcommitted
Add debug printfs in secondary cache adapter destructor (facebook#13606)
Summary: Add debug printfs to troubleshoot an intermittent crash test assertion failure. Pull Request resolved: facebook#13606 Reviewed By: mszeszko-meta Differential Revision: D74661545 Pulled By: anand1976 fbshipit-source-id: 1b2a30fbbea3dcea5ce1a199344e946da687ff1f
1 parent 2a0886b commit df7a3a7

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

cache/secondary_cache_adapter.cc

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,17 @@ CacheWithSecondaryAdapter::~CacheWithSecondaryAdapter() {
121121
assert(s.ok());
122122
assert(placeholder_usage_ == 0);
123123
assert(reserved_usage_ == 0);
124-
assert(pri_cache_res_->GetTotalMemoryUsed() == sec_capacity);
124+
bool pri_cache_res_mismatch =
125+
pri_cache_res_->GetTotalMemoryUsed() != sec_capacity;
126+
if (pri_cache_res_mismatch) {
127+
fprintf(stderr,
128+
"~CacheWithSecondaryAdapter: Primary cache reservation: "
129+
"%zu, Secondary cache capacity: %zu, "
130+
"Secondary cache reserved: %zu\n",
131+
pri_cache_res_->GetTotalMemoryUsed(), sec_capacity,
132+
sec_reserved_);
133+
assert(pri_cache_res_mismatch);
134+
}
125135
}
126136
#endif // NDEBUG
127137
}

0 commit comments

Comments
 (0)