Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

feat(dup): protect private log from missing when duplication is enabled #320

Merged
merged 17 commits into from
Dec 3, 2019

Conversation

neverchanje
Copy link
Contributor

When duplication is enabled, we check the duplication progress each time log GC performs
to ensure log files won't be deleted while they are needed.

The pseudocode:

        decree min_confirmed_decree = _duplication_mgr->min_confirmed_decree();
        decree cleanable_decree = _app->last_durable_decree();
        if (min_confirmed_decree >= 0 && min_confirmed_decree < cleanable_decree) {
            cleanable_decree = min_confirmed_decree;
        } else if (is_duplicating()) {
            return;
        }

When duplication is enabled, we check the duplication progress each time log GC performs
to ensure log files won't be deleted while they are needed.

The pseudocode:

```cpp
        decree min_confirmed_decree = _duplication_mgr->min_confirmed_decree();
        decree cleanable_decree = _app->last_durable_decree();
        if (min_confirmed_decree >= 0 && min_confirmed_decree < cleanable_decree) {
            cleanable_decree = min_confirmed_decree;
        } else if (is_duplicating()) {
            return;
        }
```
}
};

TEST_F(replica_duplicator_test, new_duplicator) { test_new_duplicator(); }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这种TEST里面转调一个函数的方式,是因为无法访问某些private变量吗?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是的

@neverchanje neverchanje merged commit 503fdf6 into XiaoMi:master Dec 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants