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

Incorrect fg_write_max_bytes_per_sec when set max_bytes_per_sec small than total weight #5401

Closed
Lloyd-Pottiger opened this issue Jul 18, 2022 · 0 comments · Fixed by #5415
Closed
Assignees
Labels
component/storage severity/minor type/bug The issue is confirmed as a bug.

Comments

@Lloyd-Pottiger
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

image

2. What did you expect to see? (Required)

fg_write_max_bytes_per_sec 1 
bg_write_max_bytes_per_sec 1 
fg_read_max_bytes_per_sec 1 
bg_read_max_bytes_per_sec 1 

3. What did you see instead (Required)

fg_write_max_bytes_per_sec 0
bg_write_max_bytes_per_sec 0 
fg_read_max_bytes_per_sec 0
bg_read_max_bytes_per_sec 0

4. What is your TiFlash version? (Required)

master

5. Why does this bug occur?

in dbms/src/Server/StorageConfigParser.cpp

UInt64 StorageIORateLimitConfig::getFgWriteMaxBytesPerSec() const
{
    if (totalWeight() <= 0 || writeWeight() <= 0)
    {
        return 0;
    }
    return use_max_bytes_per_sec ? max_bytes_per_sec / totalWeight() * fg_write_weight
                                 : max_write_bytes_per_sec / writeWeight() * fg_write_weight;
}

UInt64 StorageIORateLimitConfig::getBgWriteMaxBytesPerSec() const
{
    if (totalWeight() <= 0 || writeWeight() <= 0)
    {
        return 0;
    }
    return use_max_bytes_per_sec ? max_bytes_per_sec / totalWeight() * bg_write_weight
                                 : max_write_bytes_per_sec / writeWeight() * bg_write_weight;
}

UInt64 StorageIORateLimitConfig::getFgReadMaxBytesPerSec() const
{
    if (totalWeight() <= 0 || readWeight() <= 0)
    {
        return 0;
    }
    return use_max_bytes_per_sec ? max_bytes_per_sec / totalWeight() * fg_read_weight
                                 : max_read_bytes_per_sec / readWeight() * fg_read_weight;
}

UInt64 StorageIORateLimitConfig::getBgReadMaxBytesPerSec() const
{
    if (totalWeight() <= 0 || readWeight() <= 0)
    {
        return 0;
    }
    return use_max_bytes_per_sec ? max_bytes_per_sec / totalWeight() * bg_read_weight
                                 : max_read_bytes_per_sec / readWeight() * bg_read_weight;
}

where max_bytes_per_sec and totalWeight() are UInt64 variables. and totalWeight() = 100, so max_bytes_per_sec / totalWeight() = 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/storage severity/minor type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant