You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/01/14 08:50:13 UTC
[GitHub] [shardingsphere] jingshanglu opened a new pull request #9028: add support show replica_query rule
jingshanglu opened a new pull request #9028:
URL: https://github.com/apache/shardingsphere/pull/9028
Fixes #8936 .
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] jingshanglu commented on a change in pull request #9028: add support show replica_query rule
Posted by GitBox <gi...@apache.org>.
jingshanglu commented on a change in pull request #9028:
URL: https://github.com/apache/shardingsphere/pull/9028#discussion_r557810622
##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/impl/ReplicaQueryRuleQueryBackendHandler.java
##########
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.proxy.backend.text.distsql.rql.impl;
+
+import com.google.gson.Gson;
+import org.apache.shardingsphere.distsql.parser.statement.rql.show.ShowRuleStatement;
+import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
+import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
+import org.apache.shardingsphere.proxy.backend.response.header.ResponseHeader;
+import org.apache.shardingsphere.proxy.backend.response.header.query.QueryResponseHeader;
+import org.apache.shardingsphere.proxy.backend.response.header.query.impl.QueryHeader;
+import org.apache.shardingsphere.proxy.backend.text.SchemaRequiredBackendHandler;
+import org.apache.shardingsphere.replicaquery.api.config.ReplicaQueryRuleConfiguration;
+import org.apache.shardingsphere.replicaquery.api.config.rule.ReplicaQueryDataSourceRuleConfiguration;
+
+import java.sql.Types;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * Backend handler for show replica query rule.
+ */
+public final class ReplicaQueryRuleQueryBackendHandler extends SchemaRequiredBackendHandler<ShowRuleStatement> {
+
+ private Iterator<ReplicaQueryDataSourceRuleConfiguration> data;
+
+ private String schema;
Review comment:
ok
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] jingshanglu commented on a change in pull request #9028: add support show replica_query rule
Posted by GitBox <gi...@apache.org>.
jingshanglu commented on a change in pull request #9028:
URL: https://github.com/apache/shardingsphere/pull/9028#discussion_r557810780
##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/impl/ReplicaQueryRuleQueryBackendHandler.java
##########
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.proxy.backend.text.distsql.rql.impl;
+
+import com.google.gson.Gson;
+import org.apache.shardingsphere.distsql.parser.statement.rql.show.ShowRuleStatement;
+import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
+import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
+import org.apache.shardingsphere.proxy.backend.response.header.ResponseHeader;
+import org.apache.shardingsphere.proxy.backend.response.header.query.QueryResponseHeader;
+import org.apache.shardingsphere.proxy.backend.response.header.query.impl.QueryHeader;
+import org.apache.shardingsphere.proxy.backend.text.SchemaRequiredBackendHandler;
+import org.apache.shardingsphere.replicaquery.api.config.ReplicaQueryRuleConfiguration;
+import org.apache.shardingsphere.replicaquery.api.config.rule.ReplicaQueryDataSourceRuleConfiguration;
+
+import java.sql.Types;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * Backend handler for show replica query rule.
+ */
+public final class ReplicaQueryRuleQueryBackendHandler extends SchemaRequiredBackendHandler<ShowRuleStatement> {
+
+ private Iterator<ReplicaQueryDataSourceRuleConfiguration> data;
+
+ private String schema;
+
+ public ReplicaQueryRuleQueryBackendHandler(final ShowRuleStatement sqlStatement, final BackendConnection backendConnection) {
+ super(sqlStatement, backendConnection);
+ if (sqlStatement.getSchema().isPresent()) {
+ schema = sqlStatement.getSchema().get().getIdentifier().getValue();
+ } else {
+ schema = backendConnection.getSchemaName();
+ }
+ }
+
+ @Override
+ protected ResponseHeader execute(final String schemaName, final ShowRuleStatement sqlStatement) {
+ loadRuleConfiguration(schema);
+ return new QueryResponseHeader(getQueryHeader());
+ }
+
+ private List<QueryHeader> getQueryHeader() {
Review comment:
the excute() use the function.Line 61 calls this method.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] terrymanu commented on a change in pull request #9028: add support show replica_query rule
Posted by GitBox <gi...@apache.org>.
terrymanu commented on a change in pull request #9028:
URL: https://github.com/apache/shardingsphere/pull/9028#discussion_r557847602
##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/impl/ReplicaQueryRuleQueryBackendHandler.java
##########
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.proxy.backend.text.distsql.rql.impl;
+
+import com.google.gson.Gson;
+import org.apache.shardingsphere.distsql.parser.statement.rql.show.ShowRuleStatement;
+import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
+import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
+import org.apache.shardingsphere.proxy.backend.response.header.ResponseHeader;
+import org.apache.shardingsphere.proxy.backend.response.header.query.QueryResponseHeader;
+import org.apache.shardingsphere.proxy.backend.response.header.query.impl.QueryHeader;
+import org.apache.shardingsphere.proxy.backend.text.SchemaRequiredBackendHandler;
+import org.apache.shardingsphere.replicaquery.api.config.ReplicaQueryRuleConfiguration;
+import org.apache.shardingsphere.replicaquery.api.config.rule.ReplicaQueryDataSourceRuleConfiguration;
+
+import java.sql.Types;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * Backend handler for show replica query rule.
+ */
+public final class ReplicaQueryRuleQueryBackendHandler extends SchemaRequiredBackendHandler<ShowRuleStatement> {
+
+ private Iterator<ReplicaQueryDataSourceRuleConfiguration> data;
+
+ private String schema;
+
+ public ReplicaQueryRuleQueryBackendHandler(final ShowRuleStatement sqlStatement, final BackendConnection backendConnection) {
+ super(sqlStatement, backendConnection);
+ if (sqlStatement.getSchema().isPresent()) {
+ schema = sqlStatement.getSchema().get().getIdentifier().getValue();
+ } else {
+ schema = backendConnection.getSchemaName();
+ }
+ }
+
+ @Override
+ protected ResponseHeader execute(final String schemaName, final ShowRuleStatement sqlStatement) {
+ loadRuleConfiguration(schema);
+ return new QueryResponseHeader(getQueryHeader());
+ }
+
+ private List<QueryHeader> getQueryHeader() {
Review comment:
loadRuleConfiguration should before getQueryHeader
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] terrymanu merged pull request #9028: add support show replica_query rule
Posted by GitBox <gi...@apache.org>.
terrymanu merged pull request #9028:
URL: https://github.com/apache/shardingsphere/pull/9028
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] terrymanu commented on a change in pull request #9028: add support show replica_query rule
Posted by GitBox <gi...@apache.org>.
terrymanu commented on a change in pull request #9028:
URL: https://github.com/apache/shardingsphere/pull/9028#discussion_r557469307
##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/impl/ReplicaQueryRuleQueryBackendHandler.java
##########
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.proxy.backend.text.distsql.rql.impl;
+
+import com.google.gson.Gson;
+import org.apache.shardingsphere.distsql.parser.statement.rql.show.ShowRuleStatement;
+import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
+import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
+import org.apache.shardingsphere.proxy.backend.response.header.ResponseHeader;
+import org.apache.shardingsphere.proxy.backend.response.header.query.QueryResponseHeader;
+import org.apache.shardingsphere.proxy.backend.response.header.query.impl.QueryHeader;
+import org.apache.shardingsphere.proxy.backend.text.SchemaRequiredBackendHandler;
+import org.apache.shardingsphere.replicaquery.api.config.ReplicaQueryRuleConfiguration;
+import org.apache.shardingsphere.replicaquery.api.config.rule.ReplicaQueryDataSourceRuleConfiguration;
+
+import java.sql.Types;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * Backend handler for show replica query rule.
+ */
+public final class ReplicaQueryRuleQueryBackendHandler extends SchemaRequiredBackendHandler<ShowRuleStatement> {
+
+ private Iterator<ReplicaQueryDataSourceRuleConfiguration> data;
+
+ private String schema;
Review comment:
Can it use final here?
##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/impl/ReplicaQueryRuleQueryBackendHandler.java
##########
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.proxy.backend.text.distsql.rql.impl;
+
+import com.google.gson.Gson;
+import org.apache.shardingsphere.distsql.parser.statement.rql.show.ShowRuleStatement;
+import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
+import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
+import org.apache.shardingsphere.proxy.backend.response.header.ResponseHeader;
+import org.apache.shardingsphere.proxy.backend.response.header.query.QueryResponseHeader;
+import org.apache.shardingsphere.proxy.backend.response.header.query.impl.QueryHeader;
+import org.apache.shardingsphere.proxy.backend.text.SchemaRequiredBackendHandler;
+import org.apache.shardingsphere.replicaquery.api.config.ReplicaQueryRuleConfiguration;
+import org.apache.shardingsphere.replicaquery.api.config.rule.ReplicaQueryDataSourceRuleConfiguration;
+
+import java.sql.Types;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * Backend handler for show replica query rule.
+ */
+public final class ReplicaQueryRuleQueryBackendHandler extends SchemaRequiredBackendHandler<ShowRuleStatement> {
+
+ private Iterator<ReplicaQueryDataSourceRuleConfiguration> data;
+
+ private String schema;
+
+ public ReplicaQueryRuleQueryBackendHandler(final ShowRuleStatement sqlStatement, final BackendConnection backendConnection) {
+ super(sqlStatement, backendConnection);
+ if (sqlStatement.getSchema().isPresent()) {
+ schema = sqlStatement.getSchema().get().getIdentifier().getValue();
+ } else {
+ schema = backendConnection.getSchemaName();
+ }
+ }
+
+ @Override
+ protected ResponseHeader execute(final String schemaName, final ShowRuleStatement sqlStatement) {
+ loadRuleConfiguration(schema);
+ return new QueryResponseHeader(getQueryHeader());
+ }
+
+ private List<QueryHeader> getQueryHeader() {
Review comment:
Private method should be just next to the method in which it is used
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] codecov-io commented on pull request #9028: add support show replica_query rule
Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #9028:
URL: https://github.com/apache/shardingsphere/pull/9028#issuecomment-760089627
# [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/9028?src=pr&el=h1) Report
> Merging [#9028](https://codecov.io/gh/apache/shardingsphere/pull/9028?src=pr&el=desc) (70c330b) into [master](https://codecov.io/gh/apache/shardingsphere/commit/1e476044ade7964f6b036305529f302a010fe680?el=desc) (1e47604) will **decrease** coverage by `0.13%`.
> The diff coverage is `0.00%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/9028/graphs/tree.svg?width=650&height=150&src=pr&token=ZvlXpWa7so)](https://codecov.io/gh/apache/shardingsphere/pull/9028?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #9028 +/- ##
============================================
- Coverage 70.19% 70.06% -0.14%
- Complexity 655 658 +3
============================================
Files 1635 1636 +1
Lines 26326 26393 +67
Branches 4591 4603 +12
============================================
+ Hits 18479 18491 +12
- Misses 6585 6639 +54
- Partials 1262 1263 +1
```
| [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/9028?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
|---|---|---|---|
| [...end/text/distsql/rql/RQLBackendHandlerFactory.java](https://codecov.io/gh/apache/shardingsphere/pull/9028/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC90ZXh0L2Rpc3RzcWwvcnFsL1JRTEJhY2tlbmRIYW5kbGVyRmFjdG9yeS5qYXZh) | `27.27% <0.00%> (-32.73%)` | `0.00 <0.00> (ø)` | |
| [.../rql/impl/ReplicaQueryRuleQueryBackendHandler.java](https://codecov.io/gh/apache/shardingsphere/pull/9028/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC90ZXh0L2Rpc3RzcWwvcnFsL2ltcGwvUmVwbGljYVF1ZXJ5UnVsZVF1ZXJ5QmFja2VuZEhhbmRsZXIuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
| [...phere/governance/core/config/ConfigCenterNode.java](https://codecov.io/gh/apache/shardingsphere/pull/9028/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZ292ZXJuYW5jZS9zaGFyZGluZ3NwaGVyZS1nb3Zlcm5hbmNlLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2dvdmVybmFuY2UvY29yZS9jb25maWcvQ29uZmlnQ2VudGVyTm9kZS5qYXZh) | `52.77% <0.00%> (-38.14%)` | `0.00% <0.00%> (ø%)` | |
| [...re/scaling/core/schedule/ScalingTaskScheduler.java](https://codecov.io/gh/apache/shardingsphere/pull/9028/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtc2NhbGluZy9zaGFyZGluZ3NwaGVyZS1zY2FsaW5nLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NjYWxpbmcvY29yZS9zY2hlZHVsZS9TY2FsaW5nVGFza1NjaGVkdWxlci5qYXZh) | `24.56% <0.00%> (-1.86%)` | `0.00% <0.00%> (ø%)` | |
| [...pository/zookeeper/CuratorZookeeperRepository.java](https://codecov.io/gh/apache/shardingsphere/pull/9028/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZ292ZXJuYW5jZS9zaGFyZGluZ3NwaGVyZS1nb3Zlcm5hbmNlLXJlcG9zaXRvcnkvc2hhcmRpbmdzcGhlcmUtZ292ZXJuYW5jZS1yZXBvc2l0b3J5LXByb3ZpZGVyL3NoYXJkaW5nc3BoZXJlLWdvdmVybmFuY2UtcmVwb3NpdG9yeS16b29rZWVwZXItY3VyYXRvci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZ292ZXJuYW5jZS9yZXBvc2l0b3J5L3pvb2tlZXBlci9DdXJhdG9yWm9va2VlcGVyUmVwb3NpdG9yeS5qYXZh) | `72.05% <0.00%> (-0.04%)` | `31.00% <0.00%> (+3.00%)` | :arrow_down: |
| [...he/shardingsphere/scaling/core/job/ScalingJob.java](https://codecov.io/gh/apache/shardingsphere/pull/9028/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtc2NhbGluZy9zaGFyZGluZ3NwaGVyZS1zY2FsaW5nLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NjYWxpbmcvY29yZS9qb2IvU2NhbGluZ0pvYi5qYXZh) | `86.36% <0.00%> (ø)` | `0.00% <0.00%> (ø%)` | |
| [...re/scaling/elasticjob/ElasticJobScalingWorker.java](https://codecov.io/gh/apache/shardingsphere/pull/9028/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtc2NhbGluZy9zaGFyZGluZ3NwaGVyZS1zY2FsaW5nLWVsYXN0aWNqb2Ivc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NjYWxpbmcvZWxhc3RpY2pvYi9FbGFzdGljSm9iU2NhbGluZ1dvcmtlci5qYXZh) | `0.00% <0.00%> (ø)` | `0.00% <0.00%> (ø%)` | |
| [...ing/core/job/check/DataConsistencyCheckResult.java](https://codecov.io/gh/apache/shardingsphere/pull/9028/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtc2NhbGluZy9zaGFyZGluZ3NwaGVyZS1zY2FsaW5nLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NjYWxpbmcvY29yZS9qb2IvY2hlY2svRGF0YUNvbnNpc3RlbmN5Q2hlY2tSZXN1bHQuamF2YQ==) | `80.00% <0.00%> (ø)` | `0.00% <0.00%> (ø%)` | |
| [.../scaling/core/job/preparer/ScalingJobPreparer.java](https://codecov.io/gh/apache/shardingsphere/pull/9028/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtc2NhbGluZy9zaGFyZGluZ3NwaGVyZS1zY2FsaW5nLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NjYWxpbmcvY29yZS9qb2IvcHJlcGFyZXIvU2NhbGluZ0pvYlByZXBhcmVyLmphdmE=) | `88.09% <0.00%> (+0.29%)` | `0.00% <0.00%> (ø%)` | |
| ... and [1 more](https://codecov.io/gh/apache/shardingsphere/pull/9028/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/9028?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/9028?src=pr&el=footer). Last update [1e47604...70c330b](https://codecov.io/gh/apache/shardingsphere/pull/9028?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] jingshanglu commented on a change in pull request #9028: add support show replica_query rule
Posted by GitBox <gi...@apache.org>.
jingshanglu commented on a change in pull request #9028:
URL: https://github.com/apache/shardingsphere/pull/9028#discussion_r557913726
##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/impl/ReplicaQueryRuleQueryBackendHandler.java
##########
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.proxy.backend.text.distsql.rql.impl;
+
+import com.google.gson.Gson;
+import org.apache.shardingsphere.distsql.parser.statement.rql.show.ShowRuleStatement;
+import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
+import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
+import org.apache.shardingsphere.proxy.backend.response.header.ResponseHeader;
+import org.apache.shardingsphere.proxy.backend.response.header.query.QueryResponseHeader;
+import org.apache.shardingsphere.proxy.backend.response.header.query.impl.QueryHeader;
+import org.apache.shardingsphere.proxy.backend.text.SchemaRequiredBackendHandler;
+import org.apache.shardingsphere.replicaquery.api.config.ReplicaQueryRuleConfiguration;
+import org.apache.shardingsphere.replicaquery.api.config.rule.ReplicaQueryDataSourceRuleConfiguration;
+
+import java.sql.Types;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * Backend handler for show replica query rule.
+ */
+public final class ReplicaQueryRuleQueryBackendHandler extends SchemaRequiredBackendHandler<ShowRuleStatement> {
+
+ private Iterator<ReplicaQueryDataSourceRuleConfiguration> data;
+
+ private String schema;
+
+ public ReplicaQueryRuleQueryBackendHandler(final ShowRuleStatement sqlStatement, final BackendConnection backendConnection) {
+ super(sqlStatement, backendConnection);
+ if (sqlStatement.getSchema().isPresent()) {
+ schema = sqlStatement.getSchema().get().getIdentifier().getValue();
+ } else {
+ schema = backendConnection.getSchemaName();
+ }
+ }
+
+ @Override
+ protected ResponseHeader execute(final String schemaName, final ShowRuleStatement sqlStatement) {
+ loadRuleConfiguration(schema);
+ return new QueryResponseHeader(getQueryHeader());
+ }
+
+ private List<QueryHeader> getQueryHeader() {
Review comment:
ok
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] jingshanglu commented on a change in pull request #9028: add support show replica_query rule
Posted by GitBox <gi...@apache.org>.
jingshanglu commented on a change in pull request #9028:
URL: https://github.com/apache/shardingsphere/pull/9028#discussion_r557810780
##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/impl/ReplicaQueryRuleQueryBackendHandler.java
##########
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.proxy.backend.text.distsql.rql.impl;
+
+import com.google.gson.Gson;
+import org.apache.shardingsphere.distsql.parser.statement.rql.show.ShowRuleStatement;
+import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
+import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
+import org.apache.shardingsphere.proxy.backend.response.header.ResponseHeader;
+import org.apache.shardingsphere.proxy.backend.response.header.query.QueryResponseHeader;
+import org.apache.shardingsphere.proxy.backend.response.header.query.impl.QueryHeader;
+import org.apache.shardingsphere.proxy.backend.text.SchemaRequiredBackendHandler;
+import org.apache.shardingsphere.replicaquery.api.config.ReplicaQueryRuleConfiguration;
+import org.apache.shardingsphere.replicaquery.api.config.rule.ReplicaQueryDataSourceRuleConfiguration;
+
+import java.sql.Types;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * Backend handler for show replica query rule.
+ */
+public final class ReplicaQueryRuleQueryBackendHandler extends SchemaRequiredBackendHandler<ShowRuleStatement> {
+
+ private Iterator<ReplicaQueryDataSourceRuleConfiguration> data;
+
+ private String schema;
+
+ public ReplicaQueryRuleQueryBackendHandler(final ShowRuleStatement sqlStatement, final BackendConnection backendConnection) {
+ super(sqlStatement, backendConnection);
+ if (sqlStatement.getSchema().isPresent()) {
+ schema = sqlStatement.getSchema().get().getIdentifier().getValue();
+ } else {
+ schema = backendConnection.getSchemaName();
+ }
+ }
+
+ @Override
+ protected ResponseHeader execute(final String schemaName, final ShowRuleStatement sqlStatement) {
+ loadRuleConfiguration(schema);
+ return new QueryResponseHeader(getQueryHeader());
+ }
+
+ private List<QueryHeader> getQueryHeader() {
Review comment:
ok
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org