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

feat(dup): verify private log validity before starting to duplicate #315

Merged
merged 6 commits into from
Sep 19, 2019

Conversation

neverchanje
Copy link
Contributor

@neverchanje neverchanje commented Sep 17, 2019

Pseudocode:

func load_mutation_from_private_log() {
  verify_start_decree(start_decree);

  do_loading...
}

Before duplicating, we must ensure there are mutation logs available,
not being garbage collected.

qinzuoyan
qinzuoyan previously approved these changes Sep 19, 2019
src/dist/replication/lib/mutation_log.h Show resolved Hide resolved
if (result == invalid_decree) {
result = it->second.max_decree;
} else {
result = std::min(result, it->second.max_decree);
Copy link
Contributor

Choose a reason for hiding this comment

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

得到的是log_file中最小的max_decree,这个是最大的已经gc的decree嘛?

Copy link
Contributor Author

@neverchanje neverchanje Sep 19, 2019

Choose a reason for hiding this comment

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

it->second.max_decree 是上一个日志文件的最大 decree,相当于当前日志最小 decree - 1,这个设计的很 tricky。
最终就是遍历一下所有日志,找最小的

Copy link
Contributor

@hycdong hycdong Sep 19, 2019

Choose a reason for hiding this comment

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

确实tricky,以后可以考虑把max_decree这个变量名改掉

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.

3 participants