Skip to content

Commit 7b95aa9

Browse files
Kevin Wilfongfacebook-github-bot
Kevin Wilfong
authored andcommitted
bug: CacheFuzzer does not respect restartCache when initializing cache bytes (facebookincubator#12033)
Summary: Pull Request resolved: facebookincubator#12033 When CacheFuzzer calls initializeCache it may allocate a new cache or restart the existing cache. When it's supposed to restart the cache it picks a new value for memoryCacheBytes and ssdCacheBytes. If when the cache was originally started ssdCacheBytes was 0, then SSD specific settings like ssdCacheShards won't have values. If ssdCacheBytes > 0 when the cache is restarted it will try to reuse the original value of those SSD specific settings, which since they were never initialized are arbitrary and can be non-sensical (e.g. <= 0 in the case of shards). This leads to division by 0 and other errors when the cache is initialized. I think the intention was for the value of the cache bytes to be reused if the cache is restarted like the other settings (the get methods already take that boolean as a parameter). That fixes the issue. Reviewed By: zacw7 Differential Revision: D67909205 fbshipit-source-id: 74253a876ddcd25b0a73a84d2599ef1d499cc210
1 parent 28694f4 commit 7b95aa9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

velox/exec/fuzzer/CacheFuzzer.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,8 @@ void CacheFuzzer::initializeCache(bool restartCache) {
319319
// We have up to 20 threads and 16 threads are used for reading so
320320
// there are some threads left over for SSD background write.
321321
executor_ = std::make_unique<folly::IOThreadPoolExecutor>(20);
322-
const auto memoryCacheBytes = getMemoryCacheBytes();
323-
const auto ssdCacheBytes = getSsdCacheBytes();
322+
const auto memoryCacheBytes = getMemoryCacheBytes(restartCache);
323+
const auto ssdCacheBytes = getSsdCacheBytes(restartCache);
324324

325325
std::unique_ptr<SsdCache> ssdCache;
326326
if (ssdCacheBytes > 0) {

0 commit comments

Comments
 (0)