Skip to content

Commit 70da99f

Browse files
markbtfacebook-github-bot
authored andcommitted
multiplex_wal: record the multiplex member that served each get request
Summary: The multiplexed blobstore doesn't record which of the multiplex members won the race to serve the request. Let's change that so we can analyze blobstore usage. Reviewed By: quark-zju Differential Revision: D75457108 fbshipit-source-id: 543e324900e00ec00a1bee14e08b4e0166ad85cf
1 parent 097dbc8 commit 70da99f

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

eden/mononoke/blobstore/multiplexedblob/src/scuba.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const MULTIPLEX_ID: &str = "multiplex_id";
2828
const BLOB_SIZE: &str = "blob_size";
2929
const SUCCESS: &str = "success";
3030
const SYNC_QUEUE: &str = "mysql_sync_queue";
31+
const BLOBSTORE_ID: &str = "blobstore_id";
3132

3233
fn record_scuba_common(
3334
mut ctx: CoreContext,
@@ -102,7 +103,7 @@ pub fn record_get(
102103
multiplex_id: &MultiplexId,
103104
key: &str,
104105
stats: FutureStats,
105-
result: &Result<Option<BlobstoreGetData>>,
106+
result: &Result<Option<(BlobstoreId, BlobstoreGetData)>>,
106107
) {
107108
let op = OperationType::Get;
108109
record_scuba_common(ctx.clone(), scuba, multiplex_id, key, stats, op);
@@ -116,7 +117,8 @@ pub fn record_get(
116117
let blob_present = mb_blob.is_some();
117118
scuba.add(BLOB_PRESENT, blob_present).add(SUCCESS, true);
118119

119-
if let Some(blob) = mb_blob.as_ref() {
120+
if let Some((bs_id, blob)) = mb_blob.as_ref() {
121+
scuba.add(BLOBSTORE_ID, *bs_id);
120122
scuba.add(BLOB_SIZE, blob.len());
121123
}
122124
}

eden/mononoke/blobstore/multiplexedblob_wal/src/multiplex.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ impl WalMultiplexedBlobstore {
445445
ctx: &'a CoreContext,
446446
key: &'a str,
447447
scuba: &Scuba,
448-
) -> Result<Option<BlobstoreGetData>> {
448+
) -> Result<Option<(BlobstoreId, BlobstoreGetData)>> {
449449
ctx.perf_counters()
450450
.increment_counter(PerfCounterType::BlobGets);
451451

@@ -466,7 +466,7 @@ impl WalMultiplexedBlobstore {
466466
while let Some((bs_id, result)) = get_futs.next().await {
467467
match result {
468468
Ok(Some(get_data)) => {
469-
return Ok(Some(get_data));
469+
return Ok(Some((bs_id, get_data)));
470470
}
471471
Ok(None) => {
472472
quorum = quorum.saturating_sub(1);
@@ -504,7 +504,7 @@ impl WalMultiplexedBlobstore {
504504
});
505505

506506
match result {
507-
Ok(Some(ref data)) => {
507+
Ok(Some((_bs_id, ref data))) => {
508508
ctx.perf_counters()
509509
.set_max_counter(PerfCounterType::BlobGetsMaxSize, data.len() as i64);
510510
ctx.perf_counters()
@@ -624,7 +624,7 @@ impl Blobstore for WalMultiplexedBlobstore {
624624
stats,
625625
&result,
626626
);
627-
result
627+
Ok(result?.map(|(_, data)| data))
628628
}
629629

630630
async fn is_present<'a>(

0 commit comments

Comments
 (0)