[
https://issues.apache.org/jira/browse/ZOOKEEPER-4703?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17729869#comment-17729869
]
Li Wang commented on ZOOKEEPER-4703:
------------------------------------
The cause of the issue is that wrong APIs are used for getting the dir size.
@Override
public long getDataDirSize() {
if (zkDb == null) {
return 0L;
}
File path = {*}zkDb.snapLog.getDataDir{*}();
return getDirSize(path);
}
@Override
public long getLogDirSize() {
if (zkDb == null) {
return 0L;
}
File path = {*}zkDb.snapLog.getSnapDir{*}();
return getDirSize(path);
}
Fix:
1. changing getDataDataDirSize() to call *zkDb.snapLog.getSnapDir()*
2. changing ** getLogDirSize() to call *zkDb.snapLog.getDataDir()*
> Datadir and DatalogDir size are incorrect
> -----------------------------------------
>
> Key: ZOOKEEPER-4703
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-4703
> Project: ZooKeeper
> Issue Type: Bug
> Components: server
> Affects Versions: 3.6.1, 3.7.1, 3.8.1
> Reporter: Li Wang
> Priority: Minor
>
> Zookeeper server reports incorrect size for DataDir and DataLogDir.
> For example, DirCommand returns the following
> {
> "datadir_size" : 2214592528,
> "logdir_size" : 24556680368,
> "command" : "dirs",
> "error" : null
> }
> Excepted response:
> {
> "datadir_size" : 24556680368
> "logdir_size" : 2214592528,
> "command" : "dirs",
> "error" : null
> }
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)