Fetch sitever for mutable renames from tunables

Summary: Makes it easy to change when we need to invalidate the cache

Differential Revision: D34553656

fbshipit-source-id: e6c63f11f21b851fa385906073062134ebefe9fc
This commit is contained in:
Simon Farnsworth 2022-03-08 03:10:41 -08:00 committed by Facebook GitHub Bot
parent b72982b327
commit 3405e71fa5
3 changed files with 11 additions and 2 deletions

View File

@ -25,6 +25,7 @@ path_hash = { version = "0.1.0", path = "../common/path_hash" }
sql = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }
sql_construct = { version = "0.1.0", path = "../common/sql_construct" }
sql_ext = { version = "0.1.0", path = "../common/rust/sql_ext" }
tunables = { version = "0.1.0", path = "../tunables" }
[dev-dependencies]
fbinit-tokio = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }

View File

@ -6,7 +6,7 @@
*/
use abomonation_derive::Abomonation;
use anyhow::Error;
use anyhow::{Context, Error};
use async_trait::async_trait;
use bytes::Bytes;
use cachelib::VolatileLruCachePool;
@ -37,7 +37,11 @@ impl CacheHandlers {
pub fn new(fb: FacebookInit, pool: VolatileLruCachePool) -> Result<Self, Error> {
let memcache = MemcacheClient::new(fb)?.into();
let presence_cachelib = pool.into();
let presence_keygen = KeyGen::new("scm.mononoke.mutable_renames.present", CODEVER, 0); // FIXME: Sitever needs fixing up to come from tunables
let sitever = tunables::tunables()
.get_mutable_renames_sitever()
.try_into()
.context("While converting from i64 to u32 sitever")?;
let presence_keygen = KeyGen::new("scm.mononoke.mutable_renames.present", CODEVER, sitever);
Ok(Self {
memcache,
presence_cachelib,

View File

@ -248,6 +248,10 @@ pub struct MononokeTunables {
// EdenAPI requests that take long than this get logged unsampled
edenapi_unsampled_duration_threshold_ms: AtomicI64,
// Setting this tunable to a new non-zero value and restarting
// mononoke hosts will invalidate mutable renames cache
mutable_renames_sitever: AtomicI64,
}
fn log_tunables(tunables: &TunablesStruct) -> String {