-
Notifications
You must be signed in to change notification settings - Fork 84
feat: enable weakly consistent read for users who connected this obproxy #21 #22
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1176,7 +1176,24 @@ int ObProxySessionInfoHandler::save_changed_session_info(ObClientSessionInfo &cl | |
|
|
||
| // 6. handle vip for fllower replica in public cloud or handle config enable read only mode | ||
| if (OB_SUCC(ret) && is_auth_request) { | ||
| if (client_info.is_request_follower_user()) { | ||
| bool is_weak_read_user = false ; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The logic should be placed in the ObMysqlSM::analyze loginrequest function, where it is judged and called set_is_request_follower_user |
||
| int64_t total_size = get_global_proxy_config().weak_read_user_list.size(); | ||
| if (OB_UNLIKELY(total_size > 0)) { | ||
| ObMysqlAuthRequest &auth_req = client_info.get_login_req(); | ||
| ObHSRResult &hsr = auth_req.get_hsr_result(); | ||
| char user_buf[MAX_VALUE_LENGTH]; | ||
| for (int64_t i = 0; OB_SUCC(ret) && i < total_size; ++i) { | ||
| user_buf[0] = '\0'; | ||
| if (OB_FAIL(get_global_proxy_config().weak_read_user_list.get(i, user_buf, static_cast<int64_t>(sizeof(user_buf))))) { | ||
| LOG_WARN("get weak read user list variables failed", K(ret)); | ||
| } else if (hsr.response_.get_username().prefix_match(user_buf)){ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use this compare maybe misjudgment |
||
| is_weak_read_user = true; | ||
| break; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| if (client_info.is_request_follower_user() || get_global_proxy_config().enable_weak_read || is_weak_read_user) { | ||
| ObString ob_read_consistency("ob_read_consistency"); | ||
| // 2 means WEAK for ob_read_consistency | ||
| ObString weak("2"); | ||
|
|
||
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 expect three classes of instances:
Read-write, automatic read-write separation, read-only
So here should be read-only configuration items, including weak read and write prohibited