-
Notifications
You must be signed in to change notification settings - Fork 312
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(meta): meta server failed and could not be started normally while setting environment variables after dropping table #2148
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…a table that has just been dropped
empiredan
changed the title
fix(meta): meta server failed while setting environment variables to a table that has just been dropped
fix(meta): meta server failed and could not be started normally after dropping table
Nov 21, 2024
empiredan
changed the title
fix(meta): meta server failed and could not be started normally after dropping table
fix(meta): meta server failed and could not be started normally while setting environment variables after dropping table
Nov 21, 2024
acelyc111
reviewed
Nov 22, 2024
acelyc111
approved these changes
Nov 24, 2024
Samunroyu
approved these changes
Nov 25, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#2149.
There are two problems that should be solved:
segfault
while dropping tables ?meta server failed ?
A pegasus cluster would flush security policies to remote meta storage
periodically (by
update_ranger_policy_interval_sec
) in the form of environmentvariables. We do this by
server_state::set_app_envs()
. However, after updatingthe meta data on the remote storage (namely ZooKeeper), the table is not checked
that if it still exists while updating environment variables of local memory:
In
std::string old_envs = dsn::utils::kv_map_to_string(app->envs, ',', '=');
, sinceapp
isnullptr
,app->envs
would point an invalid address, leading tosegfault
in
libdsn_utils.so
wheredsn::utils::kv_map_to_string
is.Therefore, the reason for the 1st problem is very clear: the callback for updating meta
data on remote storage is called immediately after the table is removed, and an invalid
address is accessed due to null pointer.
Then, the meta server would load meta data from remote storage after it is restart.
However, the intermediate status
AS_DROPPING
is also flushed to remote storagewith security policies since all meta data for a table is an unitary
json
object: the wholejson
would be set to remote storage once any property is updated.However
AS_DROPPING
is invalid, and cannot pass the assertion which would makemeta server fail again and again, which is the reason of the 2nd problem:
To fix the 1st problem, we just check if the table still exists after meta data is updated
on the remote storage. To fix the 2nd problem, we prevent meta data with intermediate
status
AS_DROPPING
from being flushed to remote storage.