Skip to content

variable name is misleading,please fix it #3962

@shanghaifei

Description

@shanghaifei

in the module store,in the file org/apache/rocketmq/store/MappedFile.java
in the method isAbleToCommit()
please use the variable name 'commit' instead variable name 'flush'
it's wrong,please fix it

protected boolean isAbleToCommit(final int commitLeastPages) {
        // this is commit position,not flush position
        // int flush = this.committedPosition.get();
        int commit = this.committedPosition.get();
        int write = this.wrotePosition.get();

        if (this.isFull()) {
            return true;
        }

        if (commitLeastPages > 0) {
            //return ((write / OS_PAGE_SIZE) - (flush / OS_PAGE_SIZE)) >= commitLeastPages;
            return ((write / OS_PAGE_SIZE) - (commit / OS_PAGE_SIZE)) >= commitLeastPages;
        }

        //return write > flush;
        return write > commit;
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions