Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MultiPartitionMerger的counter merge存在bug #31

Closed
yulei666 opened this issue Mar 6, 2023 · 3 comments
Closed

MultiPartitionMerger的counter merge存在bug #31

yulei666 opened this issue Mar 6, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@yulei666
Copy link
Contributor

yulei666 commented Mar 6, 2023

string MultiPartSegmentDirectory::GetLatestCounterMapContent() const

string MultiPartSegmentDirectory::GetLatestCounterMapContent() const
{
    if (mPartSegIds.empty())
    {
        return CounterMap::EMPTY_COUNTER_MAP_JSON;
    }

    CounterMap mergedCounterMap;
    for (const auto& segVec : mPartSegIds)
    {
        if (segVec.empty())
        {
            continue;
        }
        segmentid_t lastSegIdOfPartition = segVec.back();
        mergedCounterMap.Merge(
                GetCounterMapContent(mSegments.at(lastSegIdOfPartition)),
                CounterBase::FJT_MERGE);
    }
    return mergedCounterMap.ToJsonString();
}

这段Counter merge的代码有问题,merge出来State类型的counter会覆盖,所以deletedDocCount和partitionDocCount这两个counter的值是错误的。

{"__type__":"DIR","offline":{"__type__":"DIR","build":{"__type__":"DIR","addDocCount":{"__type__":"ACC","value":2000},"deleteDocCount":{"__type__":"ACC","value":0},"updateDocCount":{"__type__":"ACC","value":0}},"deletedDocCount":{"__type__":"STATE","value":0},"partitionDocCount":{"__type__":"STATE","value":1000}}

将两个partition合并,会出现这种情况,ACC了2000次,有2000个doc,但是partitionDocCount的值只有1000。

@foreverhy
Copy link
Collaborator

是的,多 partition 合并时,对于一些 state 类型的指标也应该累加。

@foreverhy foreverhy added the bug Something isn't working label Mar 6, 2023
@foreverhy
Copy link
Collaborator

@yulei666 有时间可以提交一个 pr 来 fix 一下么

@yulei666
Copy link
Contributor Author

yulei666 commented Mar 6, 2023

@yulei666 有时间可以提交一个 pr 来 fix 一下么

可以啊

foreverhy pushed a commit that referenced this issue Mar 7, 2023
fix the bug of #31

Signed-off-by: Yu Lei <yulei666@126.com>
Co-authored-by: Yu Lei <lei.yu@shopee.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants