Skip to content

Commit 51101cb

Browse files
jameseh96daverigby
authored andcommitted
MB-35282: Make cbvdiff tolerate nodes with zero active or replica items
Change-Id: Ia0877febb16dda791bcf246620ca116bab1a3dae Reviewed-on: http://review.couchbase.org/113334 Tested-by: James Harrison <[email protected]> Reviewed-by: Dave Rigby <[email protected]>
1 parent 02194de commit 51101cb

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

engines/ep/management/cbvdiff

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33
import optparse
44
import socket
55
import sys
6-
import os
7-
import subprocess
86

97
import mc_bin_client
108

9+
1110
def main():
1211
parser = optparse.OptionParser(
1312
usage="usage: %prog ip1:memcachedport1,ip2:memcachedport2",
@@ -85,12 +84,12 @@ def main():
8584
# ------ Global Stats Collected ----------
8685
item_count = 0
8786
for vbid in vbstats:
88-
active_count = int(vbstats[vbid]["num_items"]["active"])
89-
replica_count = int(vbstats[vbid]["num_items"]["replica"])
87+
active_count = int(vbstats[vbid]["num_items"].get("active", 0))
88+
replica_count = int(vbstats[vbid]["num_items"].get("replica", 0))
9089
if active_count != replica_count:
9190
print("VBucket %d: active count %d != %d replica count \n"
9291
% (vbid, active_count, replica_count))
93-
item_count += int(vbstats[vbid]["num_items"]["active"])
92+
item_count += int(vbstats[vbid]["num_items"].get("active", 0))
9493
print("Active item count = %d\n" % item_count)
9594

9695
if __name__ == '__main__':

0 commit comments

Comments
 (0)