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/03/19 16:18:45 UTC
[GitHub] [shardingsphere] totalo opened a new pull request #9750: feat:add SQLServerTableMetaDataLoader
totalo opened a new pull request #9750:
URL: https://github.com/apache/shardingsphere/pull/9750
For #9617 .
Changes proposed in this pull request:
- add SQLServerTableMetaDataLoader
--
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 #9750: feat:add SQLServerTableMetaDataLoader
Posted by GitBox <gi...@apache.org>.
terrymanu merged pull request #9750:
URL: https://github.com/apache/shardingsphere/pull/9750
--
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 #9750: feat:add SQLServerTableMetaDataLoader
Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #9750:
URL: https://github.com/apache/shardingsphere/pull/9750#issuecomment-804531308
# [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/9750?src=pr&el=h1) Report
> Merging [#9750](https://codecov.io/gh/apache/shardingsphere/pull/9750?src=pr&el=desc) (52ba7e4) into [master](https://codecov.io/gh/apache/shardingsphere/commit/17514111ba1bb98978f1ee88947c70f120645b9d?el=desc) (1751411) will **increase** coverage by `0.03%`.
> The diff coverage is `87.03%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/9750/graphs/tree.svg?width=650&height=150&src=pr&token=ZvlXpWa7so)](https://codecov.io/gh/apache/shardingsphere/pull/9750?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #9750 +/- ##
============================================
+ Coverage 67.60% 67.64% +0.03%
- Complexity 680 681 +1
============================================
Files 1667 1668 +1
Lines 27846 27900 +54
Branches 4925 4938 +13
============================================
+ Hits 18825 18872 +47
Misses 7642 7642
- Partials 1379 1386 +7
```
| [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/9750?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
|---|---|---|---|
| [...r/loader/dialect/SQLServerTableMetaDataLoader.java](https://codecov.io/gh/apache/shardingsphere/pull/9750/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9pbmZyYS9tZXRhZGF0YS9zY2hlbWEvYnVpbGRlci9sb2FkZXIvZGlhbGVjdC9TUUxTZXJ2ZXJUYWJsZU1ldGFEYXRhTG9hZGVyLmphdmE=) | `87.03% <87.03%> (ø)` | `1.00 <1.00> (?)` | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/9750?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/9750?src=pr&el=footer). Last update [1751411...52ba7e4](https://codecov.io/gh/apache/shardingsphere/pull/9750?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] terrymanu commented on a change in pull request #9750: feat:add SQLServerTableMetaDataLoader
Posted by GitBox <gi...@apache.org>.
terrymanu commented on a change in pull request #9750:
URL: https://github.com/apache/shardingsphere/pull/9750#discussion_r598413127
##########
File path: shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/loader/dialect/SQLServerTableMetaDataLoader.java
##########
@@ -0,0 +1,140 @@
+/*
+ * 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.infra.metadata.schema.builder.loader.dialect;
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.shardingsphere.infra.metadata.schema.builder.loader.DataTypeLoader;
+import org.apache.shardingsphere.infra.metadata.schema.builder.spi.DialectTableMetaDataLoader;
+import org.apache.shardingsphere.infra.metadata.schema.model.ColumnMetaData;
+import org.apache.shardingsphere.infra.metadata.schema.model.IndexMetaData;
+import org.apache.shardingsphere.infra.metadata.schema.model.TableMetaData;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * Table meta data loader for SQLServer.
+ * @author totalo
+ * @date 20210316
Review comment:
Please remove @author and @date, let's keep consist with other codes
--
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] totalo commented on a change in pull request #9750: feat:add SQLServerTableMetaDataLoader
Posted by GitBox <gi...@apache.org>.
totalo commented on a change in pull request #9750:
URL: https://github.com/apache/shardingsphere/pull/9750#discussion_r598498843
##########
File path: shardingsphere-scaling/shardingsphere-scaling-bootstrap/src/test/java/org/apache/shardingsphere/scaling/web/HttpServerInitializerTest.java
##########
@@ -45,9 +42,8 @@
private ChannelPipeline channelPipeline;
@Before
- @SneakyThrows(ReflectiveOperationException.class)
public void setUp() {
- ReflectionUtil.setFieldValue(ScalingContext.getInstance(), "serverConfig", new ServerConfiguration());
+ ServerConfigurationInitializer.init();
Review comment:
Because in my local test, I found that the serverConfig is empty. When instantiating the HttpServerHandler, the checkServerConfig method can’t get through.
--
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] Lucas-307 commented on a change in pull request #9750: feat:add SQLServerTableMetaDataLoader
Posted by GitBox <gi...@apache.org>.
Lucas-307 commented on a change in pull request #9750:
URL: https://github.com/apache/shardingsphere/pull/9750#discussion_r598651461
##########
File path: shardingsphere-scaling/shardingsphere-scaling-bootstrap/src/test/java/org/apache/shardingsphere/scaling/web/HttpServerInitializerTest.java
##########
@@ -45,9 +42,8 @@
private ChannelPipeline channelPipeline;
@Before
- @SneakyThrows(ReflectiveOperationException.class)
public void setUp() {
- ReflectionUtil.setFieldValue(ScalingContext.getInstance(), "serverConfig", new ServerConfiguration());
+ ServerConfigurationInitializer.init();
Review comment:
Maybe mock ServerConfiguration and then reflect set into is better.
```java
ReflectionUtil.setFieldValue(ScalingContext.getInstance(), "serverConfig", mockServerConfig());
```
```java
private ServerConfiguration mockServerConfig() {
ServerConfiguration result = new ServerConfiguration();
result.setGovernanceConfig(new GovernanceConfiguration("test", new GovernanceCenterConfiguration("Zookeeper", "localhost:2181", null), false));
return result;
}
```
`ServerConfigurationInitializer.init()` will useless if ScalingContext.serverConfig != null, that's why use reflection.
--
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] totalo commented on a change in pull request #9750: feat:add SQLServerTableMetaDataLoader
Posted by GitBox <gi...@apache.org>.
totalo commented on a change in pull request #9750:
URL: https://github.com/apache/shardingsphere/pull/9750#discussion_r598495595
##########
File path: shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/initializer/impl/GovernanceBootstrapInitializerTest.java
##########
@@ -227,4 +227,10 @@ public void assertDecorateTransactionContexts() {
protected void prepareSpecifiedInitializer() {
setInitializer(new GovernanceBootstrapInitializer());
}
+
+ private StandardMetaDataContexts mockStandardMetaDataContexts() {
+ StandardMetaDataContexts standardMetaDataContexts = mock(StandardMetaDataContexts.class);
+ when(standardMetaDataContexts.getProps()).thenReturn(new ConfigurationProperties(new Properties()));
+ return standardMetaDataContexts;
+ }
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] totalo commented on pull request #9750: feat:add SQLServerTableMetaDataLoader
Posted by GitBox <gi...@apache.org>.
totalo commented on pull request #9750:
URL: https://github.com/apache/shardingsphere/pull/9750#issuecomment-803696185
> The CI is broken, please fix it
I have corrected the related errors, please review again
--
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] totalo commented on pull request #9750: feat:add SQLServerTableMetaDataLoader
Posted by GitBox <gi...@apache.org>.
totalo commented on pull request #9750:
URL: https://github.com/apache/shardingsphere/pull/9750#issuecomment-804511563
> Please revert other changes beside SQLServer meta data loader
ok i hava done
--
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] totalo commented on a change in pull request #9750: feat:add SQLServerTableMetaDataLoader
Posted by GitBox <gi...@apache.org>.
totalo commented on a change in pull request #9750:
URL: https://github.com/apache/shardingsphere/pull/9750#discussion_r598432009
##########
File path: shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/loader/dialect/SQLServerTableMetaDataLoader.java
##########
@@ -0,0 +1,140 @@
+/*
+ * 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.infra.metadata.schema.builder.loader.dialect;
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.shardingsphere.infra.metadata.schema.builder.loader.DataTypeLoader;
+import org.apache.shardingsphere.infra.metadata.schema.builder.spi.DialectTableMetaDataLoader;
+import org.apache.shardingsphere.infra.metadata.schema.model.ColumnMetaData;
+import org.apache.shardingsphere.infra.metadata.schema.model.IndexMetaData;
+import org.apache.shardingsphere.infra.metadata.schema.model.TableMetaData;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * Table meta data loader for SQLServer.
+ * @author totalo
+ * @date 20210316
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] terrymanu commented on a change in pull request #9750: feat:add SQLServerTableMetaDataLoader
Posted by GitBox <gi...@apache.org>.
terrymanu commented on a change in pull request #9750:
URL: https://github.com/apache/shardingsphere/pull/9750#discussion_r598493671
##########
File path: shardingsphere-scaling/shardingsphere-scaling-bootstrap/src/test/java/org/apache/shardingsphere/scaling/web/HttpServerInitializerTest.java
##########
@@ -45,9 +42,8 @@
private ChannelPipeline channelPipeline;
@Before
- @SneakyThrows(ReflectiveOperationException.class)
public void setUp() {
- ReflectionUtil.setFieldValue(ScalingContext.getInstance(), "serverConfig", new ServerConfiguration());
+ ServerConfigurationInitializer.init();
Review comment:
This change seem no relate with your PR, why to change it?
##########
File path: shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/initializer/impl/GovernanceBootstrapInitializerTest.java
##########
@@ -227,4 +227,10 @@ public void assertDecorateTransactionContexts() {
protected void prepareSpecifiedInitializer() {
setInitializer(new GovernanceBootstrapInitializer());
}
+
+ private StandardMetaDataContexts mockStandardMetaDataContexts() {
+ StandardMetaDataContexts standardMetaDataContexts = mock(StandardMetaDataContexts.class);
+ when(standardMetaDataContexts.getProps()).thenReturn(new ConfigurationProperties(new Properties()));
+ return standardMetaDataContexts;
+ }
Review comment:
Another PR fix NPE, so, could you revert the changes?
--
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