Skip to content

Instantly share code, notes, and snippets.

@ronen-fr
Created January 30, 2022 06:17
Show Gist options
  • Save ronen-fr/556cb9b0ad3aad56c5a74c093d8db18d to your computer and use it in GitHub Desktop.
Save ronen-fr/556cb9b0ad3aad56c5a74c093d8db18d to your computer and use it in GitHub Desktop.
gawk -v PGID=21.37a7 -f order.awk < log
#!/bin/gawk
# call with the "pg of interest" as parameter, as in:
# gawk -v PGID=21.37a7 -f this-file < log
func logtm(tst)
{
gsub(/[:.]/," ",tst); split(tst,x);
return x[1]*3600 + x[2]*60 + x[3] + x[4]/1000.0
}
$0 ~ PGID".*scrub state WAIT_PUSHES" {
printf("T1 %s %s starting a chunk\n", $1, $2);
delete secs;
delete recv;
}
# / scrub requesting scrubmap from osd./ {
$0 ~ PGID".* scrub requesting scrubmap from osd." {
repl = gensub(/.*from osd.([0-9()]+).*/,"\\1","g",$0);
if (repl in secs); else {
printf("T2 %s %s %f sent request to %s\n", $1, $2, logtm($2), repl);
secs[repl] = logtm($2)
}
}
$0 ~ "rep_scrubmap[(]"PGID".*from shard [0-9()]+.*con" {
repl = gensub(/.*from shard ([0-9(]+\)?).*/,"\\1","1",$0);
if (repl in recv); else {
resp_time = 1000 * (logtm($2) - secs[repl]);
printf("T3 %s %s %f got map from %s requested %s. Response time: %dms\n", $1, $2, logtm($2), repl, secs[repl], resp_time);
recv[repl] = $2
}
}
$0 ~ PGID".*scrub_compare_maps has maps.*" {
printf("T4 %s %s got all maps\n", $1, $2);
}
T1 2022-01-05 15:17:07.386 starting a chunk
T2 2022-01-05 15:17:07.386 55027.386000 sent request to 800(10)
T2 2022-01-05 15:17:07.386 55027.386000 sent request to 879(7)
T2 2022-01-05 15:17:07.386 55027.386000 sent request to 1066(6)
T2 2022-01-05 15:17:07.386 55027.386000 sent request to 2922(2)
T2 2022-01-05 15:17:07.386 55027.386000 sent request to 2956(3)
T2 2022-01-05 15:17:07.386 55027.386000 sent request to 3805(5)
T2 2022-01-05 15:17:07.386 55027.386000 sent request to 4047(4)
T2 2022-01-05 15:17:07.386 55027.386000 sent request to 4192(9)
T2 2022-01-05 15:17:07.386 55027.386000 sent request to 4245(8)
T2 2022-01-05 15:17:07.386 55027.386000 sent request to 4557(1)
T3 2022-01-05 15:17:07.388 55027.388000 got map from 4557(1) requested 55027.4. Response time: 2ms
T3 2022-01-05 15:17:07.389 55027.389000 got map from 4245(8) requested 55027.4. Response time: 3ms
T3 2022-01-05 15:17:07.389 55027.389000 got map from 879(7) requested 55027.4. Response time: 3ms
T3 2022-01-05 15:17:07.389 55027.389000 got map from 3805(5) requested 55027.4. Response time: 3ms
T3 2022-01-05 15:17:07.389 55027.389000 got map from 1066(6) requested 55027.4. Response time: 3ms
T3 2022-01-05 15:17:07.389 55027.389000 got map from 2922(2) requested 55027.4. Response time: 3ms
T3 2022-01-05 15:17:07.389 55027.389000 got map from 4047(4) requested 55027.4. Response time: 3ms
T3 2022-01-05 15:17:07.389 55027.389000 got map from 4192(9) requested 55027.4. Response time: 3ms
T3 2022-01-05 15:17:07.389 55027.389000 got map from 800(10) requested 55027.4. Response time: 3ms
T3 2022-01-05 15:17:16.750 55036.750000 got map from 2956(3) requested 55027.4. Response time: 9364ms
T4 2022-01-05 15:17:16.750 got all maps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment