[GitHub] carbondata pull request #1662: [CARBONDATA-1288][DictionarySecureServer] Dic...
Github user asfgit closed the pull request at: https://github.com/apache/carbondata/pull/1662 ---
[GitHub] carbondata pull request #1662: [CARBONDATA-1288][DictionarySecureServer] Dic...
Github user sounakr commented on a diff in the pull request: https://github.com/apache/carbondata/pull/1662#discussion_r157336992 --- Diff: core/src/main/java/org/apache/carbondata/core/dictionary/service/NonSecureDictionaryServiceProvider.java --- @@ -0,0 +1,37 @@ +/* + * 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.carbondata.core.dictionary.service; + +import org.apache.carbondata.core.dictionary.client.DictionaryClient; +import org.apache.carbondata.core.dictionary.client.NonSecureDictionaryClient; + +public class NonSecureDictionaryServiceProvider implements DictionaryServiceProvider { + private int port = 0; --- End diff -- Done. ---
[GitHub] carbondata pull request #1662: [CARBONDATA-1288][DictionarySecureServer] Dic...
Github user sounakr commented on a diff in the pull request: https://github.com/apache/carbondata/pull/1662#discussion_r157335368 --- Diff: core/src/main/java/org/apache/carbondata/core/dictionary/server/NonSecureDictionaryServer.java --- @@ -0,0 +1,180 @@ +/* + * 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.carbondata.core.dictionary.server; + +import java.net.InetSocketAddress; + +import org.apache.carbondata.common.logging.LogService; +import org.apache.carbondata.common.logging.LogServiceFactory; +import org.apache.carbondata.core.constants.CarbonCommonConstants; +import org.apache.carbondata.core.dictionary.generator.key.DictionaryMessage; +import org.apache.carbondata.core.dictionary.generator.key.DictionaryMessageType; +import org.apache.carbondata.core.dictionary.service.AbstractDictionaryServer; +import org.apache.carbondata.core.metadata.schema.table.CarbonTable; +import org.apache.carbondata.core.util.CarbonProperties; + + +import io.netty.bootstrap.ServerBootstrap; +import io.netty.channel.ChannelInitializer; +import io.netty.channel.ChannelOption; +import io.netty.channel.ChannelPipeline; +import io.netty.channel.EventLoopGroup; +import io.netty.channel.nio.NioEventLoopGroup; +import io.netty.channel.socket.SocketChannel; +import io.netty.channel.socket.nio.NioServerSocketChannel; +import io.netty.handler.codec.LengthFieldBasedFrameDecoder; + +/** + * Dictionary Server to generate dictionary keys. + */ +public class NonSecureDictionaryServer extends AbstractDictionaryServer +implements DictionaryServer { + + private static final LogService LOGGER = + LogServiceFactory.getLogService(NonSecureDictionaryServer.class.getName()); + + private NonSecureDictionaryServerHandler nonSecureDictionaryServerHandler; + + private EventLoopGroup boss; + private EventLoopGroup worker; + private int port; + private String host; + private static Object lock = new Object(); + private static NonSecureDictionaryServer INSTANCE = null; + + private NonSecureDictionaryServer(int port) { +this.port = port; +startServer(); + } + + public static synchronized DictionaryServer getInstance(int port, CarbonTable carbonTable) + throws Exception { +if (INSTANCE == null) { + INSTANCE = new NonSecureDictionaryServer(port); +} +INSTANCE.initializeDictionaryGenerator(carbonTable); --- End diff -- Yes, Initially the code was like if (INSTANCE == null) { synchronized(lock) { if (INSTANCE == null) ... ... There was a dual check of INSTANCE for concurrency. The dual check will cause a find bug error. In order to void this the method is turned into synchronized method. Also initializeDictionaryGenerator will finally invoke method like initializeGeneratorForTable which is also synchronized. So even though we remove the method as synchronized the execution will never be concurrent. ---
[GitHub] carbondata pull request #1662: [CARBONDATA-1288][DictionarySecureServer] Dic...
Github user ManoharVanam commented on a diff in the pull request: https://github.com/apache/carbondata/pull/1662#discussion_r157157194 --- Diff: core/src/main/java/org/apache/carbondata/core/dictionary/server/NonSecureDictionaryServer.java --- @@ -0,0 +1,180 @@ +/* + * 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.carbondata.core.dictionary.server; + +import java.net.InetSocketAddress; + +import org.apache.carbondata.common.logging.LogService; +import org.apache.carbondata.common.logging.LogServiceFactory; +import org.apache.carbondata.core.constants.CarbonCommonConstants; +import org.apache.carbondata.core.dictionary.generator.key.DictionaryMessage; +import org.apache.carbondata.core.dictionary.generator.key.DictionaryMessageType; +import org.apache.carbondata.core.dictionary.service.AbstractDictionaryServer; +import org.apache.carbondata.core.metadata.schema.table.CarbonTable; +import org.apache.carbondata.core.util.CarbonProperties; + + +import io.netty.bootstrap.ServerBootstrap; +import io.netty.channel.ChannelInitializer; +import io.netty.channel.ChannelOption; +import io.netty.channel.ChannelPipeline; +import io.netty.channel.EventLoopGroup; +import io.netty.channel.nio.NioEventLoopGroup; +import io.netty.channel.socket.SocketChannel; +import io.netty.channel.socket.nio.NioServerSocketChannel; +import io.netty.handler.codec.LengthFieldBasedFrameDecoder; + +/** + * Dictionary Server to generate dictionary keys. + */ +public class NonSecureDictionaryServer extends AbstractDictionaryServer +implements DictionaryServer { + + private static final LogService LOGGER = + LogServiceFactory.getLogService(NonSecureDictionaryServer.class.getName()); + + private NonSecureDictionaryServerHandler nonSecureDictionaryServerHandler; + + private EventLoopGroup boss; + private EventLoopGroup worker; + private int port; + private String host; + private static Object lock = new Object(); + private static NonSecureDictionaryServer INSTANCE = null; + + private NonSecureDictionaryServer(int port) { +this.port = port; +startServer(); + } + + public static synchronized DictionaryServer getInstance(int port, CarbonTable carbonTable) + throws Exception { +if (INSTANCE == null) { + INSTANCE = new NonSecureDictionaryServer(port); +} +INSTANCE.initializeDictionaryGenerator(carbonTable); --- End diff -- INSTANCE.initializeDictionaryGenerator(carbonTable); is this statement required to be in synchronized method? ---
[GitHub] carbondata pull request #1662: [CARBONDATA-1288][DictionarySecureServer] Dic...
Github user ManoharVanam commented on a diff in the pull request: https://github.com/apache/carbondata/pull/1662#discussion_r157161157 --- Diff: core/src/main/java/org/apache/carbondata/core/dictionary/service/NonSecureDictionaryServiceProvider.java --- @@ -0,0 +1,37 @@ +/* + * 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.carbondata.core.dictionary.service; + +import org.apache.carbondata.core.dictionary.client.DictionaryClient; +import org.apache.carbondata.core.dictionary.client.NonSecureDictionaryClient; + +public class NonSecureDictionaryServiceProvider implements DictionaryServiceProvider { + private int port = 0; --- End diff -- pls provide serialVersionUID ---
[GitHub] carbondata pull request #1662: [CARBONDATA-1288][DictionarySecureServer] Dic...
GitHub user sounakr opened a pull request: https://github.com/apache/carbondata/pull/1662 [CARBONDATA-1288][DictionarySecureServer] Dictionary Secure Server Implementation Be sure to do all of the following checklist to help us incorporate your contribution quickly and easily: - [X] Any interfaces changed? Yes - [X] Any backward compatibility impacted? No - [X] Document update required? Yes - [X] Testing done Please provide details on - Whether new unit test cases have been added or why no new tests are required? - How it is tested? Please attach test report. - Is it a performance related change? Please attach the performance test report. - Any additional information to help reviewers in testing this change. - [X] For large changes, please consider breaking it into sub-tasks under an umbrella JIRA. You can merge this pull request into a Git repository by running: $ git pull https://github.com/sounakr/incubator-carbondata secure-dict Alternatively you can review and apply these changes as the patch at: https://github.com/apache/carbondata/pull/1662.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1662 commit f5d15f6c966629447272abb3938c86b3d198a857 Author: sounak Date: 2017-07-06T15:18:54Z Dictionary Secure Server Implementation ---