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/09/23 11:13:17 UTC
[GitHub] [shardingsphere] lanchengx opened a new pull request #12657: Read data source disabled
lanchengx opened a new pull request #12657:
URL: https://github.com/apache/shardingsphere/pull/12657
Changes proposed in this pull request:
- Add setStatementExcutor
- Move the `setVariable` function to the executor
- Add test
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] codecov-commenter commented on pull request #12657: Read data source disabled
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #12657:
URL: https://github.com/apache/shardingsphere/pull/12657#issuecomment-925864847
# [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/12657?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#12657](https://codecov.io/gh/apache/shardingsphere/pull/12657?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (261a0ba) into [master](https://codecov.io/gh/apache/shardingsphere/commit/77b1006ebd28b8ef73d42d6819099ab8658eee79?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (77b1006) will **increase** coverage by `0.04%`.
> The diff coverage is `68.88%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/12657/graphs/tree.svg?width=650&height=150&src=pr&token=ZvlXpWa7so&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/shardingsphere/pull/12657?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #12657 +/- ##
============================================
+ Coverage 63.37% 63.42% +0.04%
- Complexity 1327 1336 +9
============================================
Files 2440 2448 +8
Lines 37009 37163 +154
Branches 6405 6424 +19
============================================
+ Hits 23456 23570 +114
- Misses 11648 11694 +46
+ Partials 1905 1899 -6
```
| [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/12657?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...tatement/ral/common/status/SetStatusStatement.java](https://codecov.io/gh/apache/shardingsphere/pull/12657/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZGlzdHNxbC1wYXJzZXIvc2hhcmRpbmdzcGhlcmUtZGlzdHNxbC1wYXJzZXItc3RhdGVtZW50L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9kaXN0c3FsL3BhcnNlci9zdGF0ZW1lbnQvcmFsL2NvbW1vbi9zdGF0dXMvU2V0U3RhdHVzU3RhdGVtZW50LmphdmE=) | `0.00% <0.00%> (ø)` | |
| [...ore/ReadwriteSplittingDistSQLStatementVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/12657/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtcmVhZHdyaXRlLXNwbGl0dGluZy9zaGFyZGluZ3NwaGVyZS1yZWFkd3JpdGUtc3BsaXR0aW5nLWRpc3RzcWwvc2hhcmRpbmdzcGhlcmUtcmVhZHdyaXRlLXNwbGl0dGluZy1kaXN0c3FsLXBhcnNlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcmVhZHdyaXRlc3BsaXR0aW5nL2Rpc3RzcWwvcGFyc2VyL2NvcmUvUmVhZHdyaXRlU3BsaXR0aW5nRGlzdFNRTFN0YXRlbWVudFZpc2l0b3IuamF2YQ==) | `0.00% <0.00%> (ø)` | |
| [...ere/infra/metadata/schema/loader/SchemaLoader.java](https://codecov.io/gh/apache/shardingsphere/pull/12657/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9pbmZyYS9tZXRhZGF0YS9zY2hlbWEvbG9hZGVyL1NjaGVtYUxvYWRlci5qYXZh) | `0.00% <0.00%> (ø)` | |
| [...sphere/infra/optimize/ShardingSphereOptimizer.java](https://codecov.io/gh/apache/shardingsphere/pull/12657/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtb3B0aW1pemUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2luZnJhL29wdGltaXplL1NoYXJkaW5nU3BoZXJlT3B0aW1pemVyLmphdmE=) | `0.00% <ø> (ø)` | |
| [.../customized/CustomizedOptimizerContextFactory.java](https://codecov.io/gh/apache/shardingsphere/pull/12657/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtb3B0aW1pemUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2luZnJhL29wdGltaXplL2NvbnRleHQvY3VzdG9taXplZC9DdXN0b21pemVkT3B0aW1pemVyQ29udGV4dEZhY3RvcnkuamF2YQ==) | `0.00% <0.00%> (ø)` | |
| [...text/original/OriginalOptimizerContextFactory.java](https://codecov.io/gh/apache/shardingsphere/pull/12657/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtb3B0aW1pemUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2luZnJhL29wdGltaXplL2NvbnRleHQvb3JpZ2luYWwvT3JpZ2luYWxPcHRpbWl6ZXJDb250ZXh0RmFjdG9yeS5qYXZh) | `0.00% <0.00%> (ø)` | |
| [...ginal/props/OptimizerPropertiesBuilderFactory.java](https://codecov.io/gh/apache/shardingsphere/pull/12657/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtb3B0aW1pemUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2luZnJhL29wdGltaXplL2NvbnRleHQvb3JpZ2luYWwvcHJvcHMvT3B0aW1pemVyUHJvcGVydGllc0J1aWxkZXJGYWN0b3J5LmphdmE=) | `0.00% <ø> (ø)` | |
| [...ginal/props/impl/H2OptimizerPropertiesBuilder.java](https://codecov.io/gh/apache/shardingsphere/pull/12657/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtb3B0aW1pemUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2luZnJhL29wdGltaXplL2NvbnRleHQvb3JpZ2luYWwvcHJvcHMvaW1wbC9IMk9wdGltaXplclByb3BlcnRpZXNCdWlsZGVyLmphdmE=) | `0.00% <ø> (ø)` | |
| [.../props/impl/MariaDBOptimizerPropertiesBuilder.java](https://codecov.io/gh/apache/shardingsphere/pull/12657/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtb3B0aW1pemUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2luZnJhL29wdGltaXplL2NvbnRleHQvb3JpZ2luYWwvcHJvcHMvaW1wbC9NYXJpYURCT3B0aW1pemVyUHJvcGVydGllc0J1aWxkZXIuamF2YQ==) | `0.00% <ø> (ø)` | |
| [...al/props/impl/MySQLOptimizerPropertiesBuilder.java](https://codecov.io/gh/apache/shardingsphere/pull/12657/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtb3B0aW1pemUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2luZnJhL29wdGltaXplL2NvbnRleHQvb3JpZ2luYWwvcHJvcHMvaW1wbC9NeVNRTE9wdGltaXplclByb3BlcnRpZXNCdWlsZGVyLmphdmE=) | `0.00% <ø> (ø)` | |
| ... and [102 more](https://codecov.io/gh/apache/shardingsphere/pull/12657/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/12657?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/12657?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [54aed2a...261a0ba](https://codecov.io/gh/apache/shardingsphere/pull/12657?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] RaigorJiang commented on a change in pull request #12657: Read data source disabled
Posted by GitBox <gi...@apache.org>.
RaigorJiang commented on a change in pull request #12657:
URL: https://github.com/apache/shardingsphere/pull/12657#discussion_r715269603
##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/set/excutor/SetStatusExecutor.java
##########
@@ -0,0 +1,73 @@
+/*
+ * 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.ral.common.set.excutor;
+
+import lombok.AllArgsConstructor;
+import org.apache.shardingsphere.distsql.parser.statement.ral.common.status.SetStatusStatement;
+import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
+import org.apache.shardingsphere.infra.distsql.exception.resource.RequiredResourceMissedException;
+import org.apache.shardingsphere.infra.exception.SchemaNotExistedException;
+import org.apache.shardingsphere.mode.metadata.persist.MetaDataPersistService;
+import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
+import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
+import org.apache.shardingsphere.proxy.backend.exception.NoDatabaseSelectedException;
+import org.apache.shardingsphere.proxy.backend.response.header.ResponseHeader;
+import org.apache.shardingsphere.proxy.backend.response.header.update.UpdateResponseHeader;
+import org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.set.SetStatementExecutor;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Optional;
+
+/**
+ * Set status statement executor.
+ */
+@AllArgsConstructor
+public final class SetStatusExecutor implements SetStatementExecutor {
+
+ private static final String READWRITE_SPLITTING = "READWRITE_SPLITTING";
+
+ private final SetStatusStatement sqlStatement;
+
+ private final BackendConnection backendConnection;
+
+ @Override
+ public ResponseHeader execute() throws DistSQLException {
+ String schemaName = sqlStatement.getSchema().isPresent() ? sqlStatement.getSchema().get().getIdentifier().getValue() : backendConnection.getSchemaName();
+ if (null == schemaName) {
+ throw new NoDatabaseSelectedException();
+ }
+ if (!ProxyContext.getInstance().getAllSchemaNames().contains(schemaName)) {
+ throw new SchemaNotExistedException(schemaName);
+ }
+ String resourceName = sqlStatement.getResourceName();
+ Collection<String> notExistedResources = ProxyContext.getInstance().getMetaData(schemaName).getResource().getNotExistedResources(Collections.singleton(resourceName));
+ DistSQLException.predictionThrow(notExistedResources.isEmpty(), new RequiredResourceMissedException(schemaName, Collections.singleton(resourceName)));
+ if (sqlStatement.getFeatureName().equals(READWRITE_SPLITTING)) {
Review comment:
Do we need to ignore case?
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] lanchengx commented on a change in pull request #12657: Read data source disabled
Posted by GitBox <gi...@apache.org>.
lanchengx commented on a change in pull request #12657:
URL: https://github.com/apache/shardingsphere/pull/12657#discussion_r715277409
##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/set/excutor/SetStatusExecutor.java
##########
@@ -0,0 +1,73 @@
+/*
+ * 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.ral.common.set.excutor;
+
+import lombok.AllArgsConstructor;
+import org.apache.shardingsphere.distsql.parser.statement.ral.common.status.SetStatusStatement;
+import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
+import org.apache.shardingsphere.infra.distsql.exception.resource.RequiredResourceMissedException;
+import org.apache.shardingsphere.infra.exception.SchemaNotExistedException;
+import org.apache.shardingsphere.mode.metadata.persist.MetaDataPersistService;
+import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
+import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
+import org.apache.shardingsphere.proxy.backend.exception.NoDatabaseSelectedException;
+import org.apache.shardingsphere.proxy.backend.response.header.ResponseHeader;
+import org.apache.shardingsphere.proxy.backend.response.header.update.UpdateResponseHeader;
+import org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.set.SetStatementExecutor;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Optional;
+
+/**
+ * Set status statement executor.
+ */
+@AllArgsConstructor
+public final class SetStatusExecutor implements SetStatementExecutor {
+
+ private static final String READWRITE_SPLITTING = "READWRITE_SPLITTING";
+
+ private final SetStatusStatement sqlStatement;
+
+ private final BackendConnection backendConnection;
+
+ @Override
+ public ResponseHeader execute() throws DistSQLException {
+ String schemaName = sqlStatement.getSchema().isPresent() ? sqlStatement.getSchema().get().getIdentifier().getValue() : backendConnection.getSchemaName();
+ if (null == schemaName) {
+ throw new NoDatabaseSelectedException();
+ }
+ if (!ProxyContext.getInstance().getAllSchemaNames().contains(schemaName)) {
+ throw new SchemaNotExistedException(schemaName);
+ }
+ String resourceName = sqlStatement.getResourceName();
+ Collection<String> notExistedResources = ProxyContext.getInstance().getMetaData(schemaName).getResource().getNotExistedResources(Collections.singleton(resourceName));
+ DistSQLException.predictionThrow(notExistedResources.isEmpty(), new RequiredResourceMissedException(schemaName, Collections.singleton(resourceName)));
+ if (sqlStatement.getFeatureName().equals(READWRITE_SPLITTING)) {
Review comment:
> Do we need to ignore case?
There may be new cases, like `circuit breaker` and `shadow`
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] RaigorJiang merged pull request #12657: Read data source disabled
Posted by GitBox <gi...@apache.org>.
RaigorJiang merged pull request #12657:
URL: https://github.com/apache/shardingsphere/pull/12657
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org