Allow resetting stat_cache from Hack (#8459)nightly-2019.04.03
commitabbecbcd3abc54ae14214d36cacd1a59fc868873
authorJamie Scheinblum <js@slack-corp.com>
Tue, 2 Apr 2019 21:24:38 +0000 (2 14:24 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Tue, 2 Apr 2019 21:35:12 +0000 (2 14:35 -0700)
treeb235f6cba2ecc305245c7a3c155f6bd84ad01434
parent547beb0ad83ada0be05ff23c6582ad424cb9e37a
Allow resetting stat_cache from Hack (#8459)

Summary:
We'd like to enable the stat_cache, but are worried about any drift of the in-memory view of the stat_cache with what's on disk.

Background on our deploy:
• We rsync files onto the we serving hosts into A or B directory, and flip the serving root back and forth.
• We drain each host on deploy, and then run a quick warm up script
• We do not restart hhvm between deploys
• We do no currently run with the stat_cache

What we'd like:
• We'd like to enable the stat_cache in prod and clear the cache on each deploy without restarting hhvm (operationally, this is complicated, although we do aim to do that this year before switching to repo auth)
• On each deploy, we'll run a script before putting traffic on the server, which would call clearstatcache()

We're looking for feedback on this approach, or any hints of alternate ways to solve this. To be clear, we've not seen any problems with the StatCache, we're just nervous at the risk that it gets out of sync on deploy.

Additionally, we're not quite sure when it's safe to reset the stat_cache, so we defer that until the requestInit function, partially because of the comment that the work in StatCache::requestInit() that must be done before ExecutionContext::requestInit. https://github.com/facebook/hhvm/blob/HHVM-3.30/hphp/runtime/base/program-functions.cpp#L2617

Thanks!
Pull Request resolved: https://github.com/facebook/hhvm/pull/8459

Reviewed By: fredemmott

Differential Revision: D14353058

Pulled By: alexeyt

fbshipit-source-id: e55ff873746171f14c3454b6e248ea6a22f5469e
hphp/runtime/base/stat-cache.cpp
hphp/runtime/base/stat-cache.h
hphp/runtime/server/admin-request-handler.cpp