[ https://issues.apache.org/jira/browse/ZOOKEEPER-1423?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14619429#comment-14619429 ]
Raul Gutierrez Segales commented on ZOOKEEPER-1423: --------------------------------------------------- In: {code} + private long getDirSize(File dir) { + long size = dir.length(); + if (dir.isDirectory()) { + for (File f: dir.listFiles()) { + size += getDirSize(f); + } + } + return size; + } {code} Is calling length() on a directory reliable? According to http://docs.oracle.com/javase/7/docs/api/java/io/File.html#length(), it's not defined: "Returns the length of the file denoted by this abstract pathname. The return value is unspecified if this pathname denotes a directory." Though running a test prog on Linux (i.e.: https://gist.github.com/rgs1/31e57c9bf2ddcb2c8018) it does show the right thing. I wonder if it breaks on other platforms... If so, we probably shouldn't add up the size of the directory. One last nit, in: {code} +package org.apache.zookeeper.server.command; + + +import org.apache.zookeeper.server.ServerCnxn; + +import java.io.IOException; +import java.io.PrintWriter; + {code} The stdlib imports usually go first, so it would be: {code} +import java.io.IOException; +import java.io.PrintWriter; + +import org.apache.zookeeper.server.ServerCnxn; {code} > 4lw and jmx should expose the size of the datadir/datalogdir > ------------------------------------------------------------ > > Key: ZOOKEEPER-1423 > URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1423 > Project: ZooKeeper > Issue Type: Improvement > Components: jmx > Affects Versions: 3.5.0 > Reporter: Patrick Hunt > Assignee: Edward Ribeiro > Labels: newbie > Fix For: 3.5.1 > > Attachments: ZOOKEEPER-1423.2.patch, ZOOKEEPER-1423.3.patch, > ZOOKEEPER-1423.4.patch, ZOOKEEPER-1423.5.patch, ZOOKEEPER-1423.6.patch, > ZOOKEEPER-1423.patch > > > There are no metrics currently available on the size of the > datadir/datalogdir. These grow w/o bound unless the cleanup script is run. It > would be good to expose these metrics through jmx/4lw such that monitoring > can be done on the size. Would key ppl in on whether cleanup was actually > running. In particular this could be monitored/alerted on by third party > systems (nagios, ganglia and the like). -- This message was sent by Atlassian JIRA (v6.3.4#6332)