djkevincr commented on a change in pull request #178: GORA-485 Apache Kudu 
datastore for Gora
URL: https://github.com/apache/gora/pull/178#discussion_r316540236
 
 

 ##########
 File path: gora-kudu/src/main/java/org/apache/gora/kudu/store/KuduStore.java
 ##########
 @@ -0,0 +1,654 @@
+/*
+ * 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.gora.kudu.store;
+
+import org.apache.gora.kudu.query.KuduResult;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.invoke.MethodHandles;
+import java.nio.ByteBuffer;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.ConcurrentHashMap;
+import org.apache.gora.kudu.mapping.Column;
+import org.apache.gora.kudu.mapping.KuduMapping;
+import org.apache.gora.kudu.mapping.KuduMappingBuilder;
+import org.apache.gora.kudu.utils.KuduParameters;
+import org.apache.gora.persistency.impl.PersistentBase;
+import org.apache.gora.query.PartitionQuery;
+import org.apache.gora.query.Query;
+import org.apache.gora.query.Result;
+import org.apache.gora.store.impl.DataStoreBase;
+import org.apache.gora.util.AvroUtils;
+import org.apache.gora.util.GoraException;
+import org.apache.kudu.ColumnSchema;
+import org.apache.avro.Schema;
+import org.apache.avro.specific.SpecificDatumReader;
+import org.apache.avro.specific.SpecificDatumWriter;
+import org.apache.avro.util.Utf8;
+import org.apache.gora.kudu.query.KuduQuery;
+import org.apache.gora.kudu.utils.KuduClientUtils;
+import org.apache.gora.persistency.Persistent;
+import org.apache.gora.query.impl.PartitionQueryImpl;
+import org.apache.gora.util.IOUtils;
+import org.apache.kudu.Type;
+import org.apache.kudu.client.CreateTableOptions;
+import org.apache.kudu.client.Delete;
+import org.apache.kudu.client.KuduClient;
+import org.apache.kudu.client.KuduException;
+import org.apache.kudu.client.KuduPredicate;
+import org.apache.kudu.client.KuduScanner;
+import org.apache.kudu.client.KuduSession;
+import org.apache.kudu.client.KuduTable;
+import org.apache.kudu.client.OperationResponse;
+import org.apache.kudu.client.PartialRow;
+import org.apache.kudu.client.RowResult;
+import org.apache.kudu.client.RowResultIterator;
+import org.apache.kudu.client.SessionConfiguration;
+import org.apache.kudu.client.Update;
+import org.apache.kudu.client.Upsert;
+import org.apache.kudu.util.DecimalUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Implementation of a Apache Kudu data store to be used by Apache Gora.
+ *
+ * @param <K> class to be used for the key
+ * @param <T> class to be persisted within the store
+ */
+public class KuduStore<K, T extends PersistentBase> extends DataStoreBase<K, 
T> {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+  private static final String PARSE_MAPPING_FILE_KEY = 
"gora.kudu.mapping.file";
+  private static final String DEFAULT_MAPPING_FILE = "gora-kudu-mapping.xml";
+  private static final String XML_MAPPING_DEFINITION = "gora.mapping";
+  private KuduMapping kuduMapping;
+  private KuduClient client;
+  private KuduSession session;
 
 Review comment:
   As per the docs KuduSession is not thread safe -  
https://kudu.apache.org/apidocs/org/apache/kudu/client/KuduSession.html 
   This variable is a shared variable and instantiated at class level. I 
noticed there are multiple operations you do on top of KuduSession instance. 
These can possibly fail at concurrency.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to