mononoke: check pushredirector status in backsyncer_cmd

Summary:
We'd like to have backsyncer_cmd report how many pushes are left to backsync so
that we can add an alarm on that. But this alarm should also work fine with
frequent rollout and rollbacks that we are going to make.

This diff changes `backsync_forever` function to read configerator killswitch
and do not import anything if killswitch is disabled. This diff also changes
ods reporting - it now reports 0 if push redirection is disabled. That means we
can add alarm on the queue size and make sure that it won't misfire when push
redirection is disabled.

This diff also did a few refactorings:
1) backsync_forever was only used in backsyncer_cmd, so it was moved there
2) backsync_forever now just calls backsync_all_latest to avoid code
duplication

Reviewed By: farnz

Differential Revision: D18617272

fbshipit-source-id: 49cdc8211c97c7d8473f016835e4e55916209b71
This commit is contained in:
Stanislau Hlebik 2019-11-20 10:31:44 -08:00 committed by Facebook Github Bot
parent 43078719e6
commit 22fddb5155
3 changed files with 4 additions and 2 deletions

View File

@ -20,6 +20,6 @@ mod unbundle;
pub use client::{gettreepack_entries, RepoClient, WireprotoLogging};
pub use mononoke_repo::{streaming_clone, MononokeRepo};
pub use push_redirector::RepoSyncTarget;
pub use push_redirector::{RepoSyncTarget, CONFIGERATOR_PUSHREDIRECT_ENABLE};
pub use repo_read_write_status::RepoReadWriteFetcher;
pub use streaming_clone::SqlStreamingChunksFetcher;

View File

@ -41,6 +41,8 @@ use std::sync::Arc;
use synced_commit_mapping::SyncedCommitMapping;
use topo_sort::sort_topological;
pub const CONFIGERATOR_PUSHREDIRECT_ENABLE: &str = "scm/mononoke/pushredirect/enable";
#[derive(Clone)]
/// Core push redirector struct. Performs conversions of pushes
/// to be processed by the large repo, and conversions of results

View File

@ -29,6 +29,7 @@ use itertools::join;
use lazy_static::lazy_static;
use metaconfig_types::{CommonConfig, WhitelistEntry};
use openssl::ssl::SslAcceptor;
use repo_client::CONFIGERATOR_PUSHREDIRECT_ENABLE;
use scuba_ext::ScubaSampleBuilderExt;
use slog::{crit, error, o, Drain, Level, Logger};
use slog_kvfilter::KVFilter;
@ -46,7 +47,6 @@ use crate::request_handler::request_handler;
const CHUNK_SIZE: usize = 10000;
const CONFIGERATOR_LIMITS_CONFIG: &str = "scm/mononoke/loadshedding/limits";
const CONFIGERATOR_PUSHREDIRECT_ENABLE: &str = "scm/mononoke/pushredirect/enable";
lazy_static! {
static ref OPEN_CONNECTIONS: AtomicUsize = AtomicUsize::new(0);
}