Skip to content
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

[feature] read-write separation enhancements #624

Closed
BohuTANG opened this issue Apr 26, 2020 · 1 comment
Closed

[feature] read-write separation enhancements #624

BohuTANG opened this issue Apr 26, 2020 · 1 comment
Assignees
Labels
P0 High priority type: feature
Milestone

Comments

@BohuTANG
Copy link
Contributor

BohuTANG commented Apr 26, 2020

Summary

Now all reads and writes are sent to the backend mysql master node, and in some scenarios (which requires weak data consistency), we can route the reads to the slave node.

  1. config
  • add replica-address to backend config, identify read-only backends vip
  • ProxyConfig add balance: 0 -- disable balance, 1 -- enable balance to replica
  1. add replicaConnections in https://github.com/radondb/radon/blob/master/src/backend/txn.go#L98

  2. check the query, if it is read&not-in-multi-statement txn, txn will fetch a connection from replicaConnections and executes.

API:
Add and remove replica nodes or setting balance mode

Hint:
Add /*+ balance=0 */ to force execution on address(write nodes).

@BohuTANG BohuTANG added type: feature P0 High priority labels Apr 26, 2020
@BohuTANG BohuTANG added this to the v1.1.1 milestone Apr 26, 2020
@zhyass
Copy link
Contributor

zhyass commented Apr 26, 2020

ACK

zhyass added a commit to zhyass/radon that referenced this issue May 8, 2020
[summary]
1.config
Add 'replica-address' to backend config, identify read-only backends vip.
Add 'loadbalance' to proxy config, 0 -- disable balance, 1 -- enable balance to replica.
2.When the statement is read and not in a multi-statement transaction, the sql is sent to the 'replica-address' for execution.

[test case]
src/backend/pool_test.go
src/backend/queryz_test.go
src/backend/txn_test.go
src/backend/txnmgr_test.go
src/proxy/proxy_test.go

[patch codecov]
src/backend/mock.go 98.8%
src/backend/pool.go 90.9%
src/backend/txn.go 89.1%
src/backend/txnmgr.go 88.5%
src/proxy/proxy.go 86.0%
zhyass added a commit to zhyass/radon that referenced this issue May 8, 2020
[summary]
1.config
Add 'replica-address' to backend config, identify read-only backends vip.
Add 'loadbalance' to proxy config, 0 -- disable balance, 1 -- enable balance to replica.
2.When the statement is read and not in a multi-statement transaction, the sql is sent to the 'replica-address' for execution.

[test case]
src/backend/pool_test.go
src/backend/queryz_test.go
src/backend/txn_test.go
src/backend/txnmgr_test.go
src/proxy/proxy_test.go

[patch codecov]
src/backend/mock.go 98.8%
src/backend/pool.go 90.9%
src/backend/txn.go 89.1%
src/backend/txnmgr.go 88.5%
src/proxy/proxy.go 86.0%
zhyass added a commit to zhyass/radon that referenced this issue May 8, 2020
[summary]
1.config
Add 'replica-address' to backend config, identify read-only backends vip.
Add 'loadbalance' to proxy config, 0 -- disable balance, 1 -- enable balance to replica.
2.When the statement is read and not in a multi-statement transaction, the sql will sent to the 'replica-address' for execution.
[test case]
src/backend/pool_test.go
src/backend/queryz_test.go
src/backend/txn_test.go
src/backend/txnmgr_test.go
src/proxy/proxy_test.go
[patch codecov]
src/backend/mock.go 98.8%
src/backend/pool.go 90.9%
src/backend/txn.go 89.1%
src/backend/txnmgr.go 88.5%
src/proxy/proxy.go 86.0%
zhyass added a commit to zhyass/radon that referenced this issue May 9, 2020
[summary]
1.api
Add 'replica-address' to `/v1/radon/backend`.
Add 'loadbalance' to `/v1/radon/config`.

[test case]
src/ctl/v1/backend_test.go
src/ctl/v1/radon_test.go

[patch codecov]
src/ctl/v1/backend.go 87.8%
src/ctl/v1/radon.go 92.6%
zhyass added a commit to zhyass/radon that referenced this issue May 9, 2020
[summary]
1.config
Add 'replica-address' to backend config, identify read-only backends vip.
Add 'loadbalance' to proxy config, 0 -- disable balance, 1 -- enable balance to replica.
2.When the statement is read and not in a multi-statement transaction, the sql will sent to the 'replica-address' for execution.
[test case]
src/backend/pool_test.go
src/backend/queryz_test.go
src/backend/txn_test.go
src/backend/txnmgr_test.go
src/proxy/proxy_test.go
[patch codecov]
src/backend/mock.go 98.8%
src/backend/pool.go 90.9%
src/backend/txn.go 89.1%
src/backend/txnmgr.go 88.5%
src/proxy/proxy.go 86.0%
zhyass added a commit to zhyass/radon that referenced this issue May 9, 2020
[summary]
1.api
Add 'replica-address' to `/v1/radon/backend`.
Add 'loadbalance' to `/v1/radon/config`.

[test case]
src/ctl/v1/backend_test.go
src/ctl/v1/radon_test.go

[patch codecov]
src/ctl/v1/backend.go 87.8%
src/ctl/v1/radon.go 92.6%
zhyass added a commit to zhyass/radon that referenced this issue May 9, 2020
[summary]
1.config
Add 'replica-address' to backend config, identify read-only backends vip.
Add 'loadbalance' to proxy config, 0 -- disable balance, 1 -- enable balance to replica.
2.When the statement is read and not in a multi-statement transaction, the sql will sent to the 'replica-address' for execution.
[test case]
src/backend/pool_test.go
src/backend/queryz_test.go
src/backend/txn_test.go
src/backend/txnmgr_test.go
src/proxy/proxy_test.go
[patch codecov]
src/backend/mock.go 98.8%
src/backend/pool.go 90.9%
src/backend/txn.go 89.1%
src/backend/txnmgr.go 88.5%
src/proxy/proxy.go 86.0%
zhyass added a commit to zhyass/radon that referenced this issue May 9, 2020
[summary]
1.api
Add 'replica-address' to `/v1/radon/backend`.
Add 'loadbalance' to `/v1/radon/config`.

[test case]
src/ctl/v1/backend_test.go
src/ctl/v1/radon_test.go

[patch codecov]
src/ctl/v1/backend.go 87.8%
src/ctl/v1/radon.go 92.6%
BohuTANG added a commit that referenced this issue May 9, 2020
*: support read-write separation #624
zhyass added a commit to zhyass/radon that referenced this issue May 9, 2020
[summary]
The query with '/*+loadbalance*/' will be forced to execute on normal, which means loadbalance'll be disabled.
select /*+ loadbalance */ ...
[test case]
src/backend/txn_test.go
src/proxy/execute_test.go
[patch codecov]
src/backend/txn.go 88.8%
src/proxy/execute.go 87.6%
zhyass added a commit to zhyass/radon that referenced this issue May 9, 2020
[summary]
The query with '/*+loadbalance*/' will be forced to execute on normal, which means loadbalance'll be disabled.
select /*+ loadbalance */ ...
[test case]
src/backend/txn_test.go
src/proxy/execute_test.go
[patch codecov]
src/backend/txn.go 89.1%
src/proxy/execute.go 87.8%
zhyass added a commit to zhyass/radon that referenced this issue May 9, 2020
[summary]
The query with '/*+loadbalance*/' will be forced to execute on normal, which means loadbalance'll be disabled.
select /*+ loadbalance */ ...
[test case]
src/backend/txn_test.go
src/proxy/execute_test.go
[patch codecov]
src/backend/txn.go 89.1%
src/proxy/execute.go 87.8%
zhyass added a commit to zhyass/radon that referenced this issue May 9, 2020
[summary]
update api.md and radon_sql_support.md docs.
[test case]
N/A
[patch codecov]
N/A
zhyass added a commit to zhyass/radon that referenced this issue May 9, 2020
[summary]
The query with '/*+loadbalance=0*/' will be forced to execute on normal, which means loadbalance'll be disabled.
[test case]
src/backend/txn_test.go
src/proxy/execute_test.go
[patch codecov]
src/backend/txn.go 89.1%
src/proxy/execute.go 87.8%
zhyass added a commit to zhyass/radon that referenced this issue May 9, 2020
[summary]
update api.md and radon_sql_support.md docs.
[test case]
N/A
[patch codecov]
N/A
zhyass added a commit to zhyass/radon that referenced this issue May 9, 2020
[summary]
update api.md and radon_sql_support.md docs.
[test case]
N/A
[patch codecov]
N/A
zhyass added a commit to zhyass/radon that referenced this issue May 10, 2020
[summary]
1. When the query is Select and not in multi-statement, the config load-balance can take effect.
2. By using hint can directly decide the load-balance mode, instead of check ProxyConfig.
[test case]
src/backend/txn_test.go
src/proxy/execute_test.go
[patch codecov]
src/backend/txn.go 89.1%
src/proxy/execute.go 87.8%
zhyass added a commit to zhyass/radon that referenced this issue May 10, 2020
[summary]
update api.md and radon_sql_support.md docs.
[test case]
N/A
[patch codecov]
N/A
BohuTANG added a commit that referenced this issue May 11, 2020
*: add hint for read-write separation #624
@zhyass zhyass closed this as completed May 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P0 High priority type: feature
Projects
None yet
Development

No branches or pull requests

2 participants