-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix(rdb_load): Handle JSON loading failure when parsing fails #4801
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(rdb_load): Handle JSON loading failure when parsing fails #4801
Conversation
src/server/rdb_load.cc
Outdated
if (json) { | ||
pv_->SetJson(std::move(*json)); | ||
} else { | ||
LOG(ERROR) << "Invalid JSON string"; |
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.
Won't this trigger errors in productions ? Is that something that we want ? cc @adiholden
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.
I checked other methods and they log ERROR for similar issues
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 usually print error log for internal error, when we do not expect to have failures.
Here in rdb load its iether that we had bug in snapshot serializing json incorrect or user tries to load some json but we can not parse it.
I do think that its worth to have an error print here. Please also print the blob string here so it will be easier to investigate if we see this error.
How did you get to this error flow stefan?
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.
Yep I agree with Adi here, it would be useful for us to be aware of those problematic flows
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.
I didn't reproduce it, but I checked the memory tracking, and during the check, I found out that if an error occurs (so the JSON should be empty), we are still trying to use the parsed value
2ab51f8
to
1facbb4
Compare
@@ -56,10 +56,6 @@ size_t QlMAllocSize(quicklist* ql, bool slow) { | |||
} | |||
|
|||
size_t UpdateSize(size_t size, int64_t update) { | |||
if (update >= 0) { |
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.
What does this change fixes?
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 discussed it with Kostas that it can be deleted here. We don't need this check. The method will still work correctly
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.
@adiholden this should have been removed on the previous PR, but since he had this open, I suggested him to change it here (to avoid reiterating the PR one more time). The removed code is redundant.
Signed-off-by: Stepan Bagritsevich <[email protected]>
Signed-off-by: Stepan Bagritsevich <[email protected]>
Signed-off-by: Stepan Bagritsevich <[email protected]>
1facbb4
to
cdea355
Compare
@@ -56,10 +56,6 @@ size_t QlMAllocSize(quicklist* ql, bool slow) { | |||
} | |||
|
|||
size_t UpdateSize(size_t size, int64_t update) { | |||
if (update >= 0) { |
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.
@adiholden this should have been removed on the previous PR, but since he had this open, I suggested him to change it here (to avoid reiterating the PR one more time). The removed code is redundant.
Small fix for the case if we cannot parse json string during loading.