-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_cache_dumps.pl
More file actions
executable file
·56 lines (49 loc) · 1.59 KB
/
Copy pathcheck_cache_dumps.pl
File metadata and controls
executable file
·56 lines (49 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/perl
my $epoch = shift || die "specify epoch";
my %auth; # mds -> id -> replica -> nonce
my %replica; # mds -> id -> auth -> nonce
print "reading\n";
for (my $i=0; -e "cachedump.$epoch.mds$i"; $i++) {
open(O,"cachedump.$epoch.mds$i");
while (<O>) {
my ($name,$s);
($name,$s) = /^\[(inode \d+) \S+ (\S+)/;
($name,$s) = /^\[(dir \d+) \S+ (\S+)/ unless $name;
($name,$s) = /^\[dentry (\S+) (\S+)/ unless $name;
if ($name) {
if ($s =~ /^auth/) {
$auth{$i}->{$name} = {};
my ($rl) = $s =~ /\{(.*)\}/;
for my $r (split(/,/,$rl)) {
my ($who,$nonce) = $r =~ /(\d+)\=(\d+)/;
$auth{$i}->{$name}->{$who} = $nonce;
#print "auth $name rep by $who $nonce $s\n";
}
}
else {
my ($a,$b,$n) = $s =~ /rep@(\d+)\,([\-\d]+)\.(\d+)/;
die $_ unless $a >= 0;
$replica{$i}->{$name}->{$a} = $n;
if ($b >= 0) {
$replica{$i}->{$name}->{$b} = $n;
}
}
}
}
}
print "verifying replicas\n";
for my $mds (keys %replica) {
for my $name (keys %{$replica{$mds}}) {
for my $auth (keys %{$replica{$mds}->{$name}}) {
if ($auth{$auth}->{$name}->{$mds}) {
if ($auth{$auth}->{$name}->{$mds} < $replica{$mds}->{$name}->{$auth}) {
print "problem: mds$mds has $name from mds$auth nonce $replica{$mds}->{$name}->{$auth}, auth has nonce $auth{$auth}->{$name}->{$mds}\n";
} else {
print "ok: mds$mds has $name from mds$auth nonce $replica{$mds}->{$name}->{$auth}, auth has nonce $auth{$auth}->{$name}->{$mds}\n";
}
} else {
print "??: mds$mds has $name from mds$auth nonce $replica{$mds}->{$name}->{$auth}, auth has no nonce\n";
}
}
}
}