feat: enable weakly consistent read for users who connected this obproxy #21#22
Open
justdba wants to merge 3 commits intooceanbase:masterfrom
Open
feat: enable weakly consistent read for users who connected this obproxy #21#22justdba wants to merge 3 commits intooceanbase:masterfrom
justdba wants to merge 3 commits intooceanbase:masterfrom
Conversation
…oxy oceanbase#21 In the read-write separation scenario, a switch for the session-level enable weakly consistent read or for only the session-level enable weakly consistent to the specified user
oceanbase#21 In the read-write separation scenario, a switch for the session-level enable weakly consistent read or for only the session-level enable weakly consistent to the specified user
lemon0910
reviewed
Apr 18, 2022
| 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)){ |
| 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; i < total_size; ++i) { |
Contributor
There was a problem hiding this comment.
中间改为OB_SUCC(ret) && i < total_size
| if (client_info.is_request_follower_user()) { | ||
| bool is_weak_read_user = false ; | ||
| int64_t total_size = get_global_proxy_config().weak_read_user_list.size(); | ||
| if (OB_UNLIKELY(total_size > 0)){ |
fox1987
reviewed
May 25, 2022
| 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)){ |
wgs13579
reviewed
May 26, 2022
| // 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.
The logic should be placed in the ObMysqlSM::analyze loginrequest function, where it is judged and called set_is_request_follower_user
| // proxy cmd | ||
| DEF_INT(proxy_local_cmd, "0", "[0,]", "proxy local cmd type: 0->none(default), 1->exit, 2->restart, 3->commit, 4->rollback", CFG_NO_NEED_REBOOT, CFG_SECTION_OBPROXY, CFG_VISIBLE_LEVEL_MEMORY); | ||
|
|
||
| DEF_BOOL(enable_weak_read, "false", "weak read by default for all clients connected this proxy", CFG_NO_NEED_REBOOT, CFG_SECTION_OBPROXY, CFG_VISIBLE_LEVEL_USER); |
Collaborator
There was a problem hiding this comment.
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
This file contains hidden or 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
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.
In the read-write separation scenario, a switch for the session-level enable weakly consistent read or for only the session-level enable weakly consistent to the specified user