Thank you Ravi Prakash for your time and review comments. Could you please give some more insight on the following statement:
So your getNumActiveLeases() is actually returning number of files open for write (which is >= number of active leases)
LeaseManager has the data structure private final Collection<String> paths = new TreeSet<String>();. IIUC during the write/append operation the client who owns the file will get a unique lease from NN and maintains by adding a path entry in this list. Could you please tell me in which case files open for write (which is >= number of active leases), am I missing any case?
Here, the metric NumActiveLeases count shows the cumulative of all the unique file paths which will be the number of leases granted by the NN at that point of time.