[jira] [Commented] (ZOOKEEPER-4703) Datadir and DatalogDir size are incorrect

2023-09-04 Thread Jane (Jira)


[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-4703?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17761911#comment-17761911
 ] 

Jane commented on ZOOKEEPER-4703:
-

I think you are right and since three months have passed, I can fix it for you. 
Thank you for the issue and the suggested code changes.

> 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
>Assignee: 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)


[jira] [Commented] (ZOOKEEPER-4703) Datadir and DatalogDir size are incorrect

2023-06-06 Thread Li Wang (Jira)


[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-4703?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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)