-
Notifications
You must be signed in to change notification settings - Fork 469
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
fix(namespace): didn't reload namespaces from DB after the full sync #2527
fix(namespace): didn't reload namespaces from DB after the full sync #2527
Conversation
Namespaces will store inside DB if the repl-namespace-enabled was set to yes. And then replicas will intercept and parse the increment replication log to see if it needs to reload namespaces. But it won't have the namespace update log when doing the full sync, so we need to forcely reload from DB once the full replication was done.
if (!s.IsOK()) { | ||
LOG(ERROR) << "[replication] Failed to load and rewrite namespace: " << s.Msg(); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extract a PostFullSync
function, move it to this function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have post_fullsync_cb
now, but it's used for cleaning resources if failed to do the full sync. So it should be not good to put this inside that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it a callback function after successfully loading the data?
Lines 284 to 290 in 2836bf0
auto s = replication_thread_->Start([this]() { PrepareRestoreDB(); }, | |
[this]() { | |
this->is_loading_ = false; | |
if (auto s = task_runner_.Start(); !s) { | |
LOG(WARNING) << "Failed to start task runner: " << s.Msg(); | |
} | |
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No indeed, it should be used for resetting resources corresponding to pre_fullsync_cb
. That said, it must be called once if the pre_fullsync_cb
was invoked. I will submit another PR to fix #2511 which is caused by that didn't call post_fullsync_cb
while failing to restore DB.
Can you point out the reason here? |
What's the meaning of this comment? Do you mean why the full sync won't propagate the namespace change log? |
Yes I'm learning the code here, it would help if you can point the reason out |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I got to know this, since #1776 do not reload when ns is added...
Quality Gate passedIssues Measures |
Namespaces would store inside DB if the repl-namespace-enabled was set to yes.
Then replicas will intercept and parse the increment replication log to
see if it needs to reload namespaces. But it won't have the namespace update log
when doing the full sync, so we need to reload from DB once the full replication is done.
This closes #2520