nickwallen commented on a change in pull request #1458: METRON-2177 Upgrade 
Profiler for HBase 2.0.2
URL: https://github.com/apache/metron/pull/1458#discussion_r307052275
 
 

 ##########
 File path: 
metron-analytics/metron-profiler-client/src/main/java/org/apache/metron/profiler/client/HBaseProfilerClientFactory.java
 ##########
 @@ -0,0 +1,98 @@
+/*
+ *
+ *  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.metron.profiler.client;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.metron.hbase.client.HBaseClient;
+import org.apache.metron.hbase.client.HBaseClientFactory;
+import org.apache.metron.hbase.client.HBaseConnectionFactory;
+import org.apache.metron.hbase.client.HBaseTableClientFactory;
+import org.apache.metron.profiler.hbase.ColumnBuilder;
+import org.apache.metron.profiler.hbase.RowKeyBuilder;
+import org.apache.metron.profiler.hbase.SaltyRowKeyBuilder;
+import org.apache.metron.profiler.hbase.ValueOnlyColumnBuilder;
+
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import static 
org.apache.metron.profiler.client.stellar.ProfilerClientConfig.PROFILER_COLUMN_FAMILY;
+import static 
org.apache.metron.profiler.client.stellar.ProfilerClientConfig.PROFILER_HBASE_TABLE;
+import static 
org.apache.metron.profiler.client.stellar.ProfilerClientConfig.PROFILER_HBASE_CONNECTION_FACTORY;
+import static 
org.apache.metron.profiler.client.stellar.ProfilerClientConfig.PROFILER_SALT_DIVISOR;
+import static 
org.apache.metron.profiler.client.stellar.Util.getPeriodDurationInMillis;
+
+/**
+ * Creates an {@link HBaseProfilerClient}.
+ */
+public class HBaseProfilerClientFactory implements ProfilerClientFactory {
+
+  private HBaseClientFactory hBaseClientFactory;
+
+  public HBaseProfilerClientFactory() {
+    this(new HBaseTableClientFactory());
+  }
+
+  public HBaseProfilerClientFactory(HBaseClientFactory hBaseClientFactory) {
+    this.hBaseClientFactory = hBaseClientFactory;
+  }
+
+  @Override
+  public HBaseProfilerClient create(Map<String, Object> globals) {
 
 Review comment:
   >  I didn't catch this initially, but it looks like one subtlety here is 
that your new connection interface is relevant on a per-table basis, so if you 
need to modify 2 tables then you'd need to construct 2 connections to handle 
that.
   
   Yes, that is true.  I am not aware of any places where this is an issue 
currently.  If this does come up, I think we can easily handle it by some new 
implementations of `HBaseConnectionFactory` and/or `HBaseClientFactory`.
   
   > I was thinking through this a bit and was considering whether it makes 
sense to make the table operations more ad-hoc.
   
   Keep in mind, I didn't invent the HBaseClient API as part of this HDP 3.1 
upgrade effort.  I am just reusing what we already have in 
[master](https://github.com/apache/metron/blob/a2a46e6567c78e5066c0d3360d7838d1a5851fa7/metron-platform/metron-hbase/metron-hbase-common/src/main/java/org/apache/metron/hbase/client/HBaseClient.java#L145).
   
   I'm not a big fan of the API itself, it is a bit clunky.  It originally came 
from the storm-hbase integration project and could certainly use some 
improvements.
   
   After we get all these Hbase upgrade changes in, we can certainly think 
about improving the HBaseClient API.  I don't think that doing it in the middle 
of this upgrade makes the most sense.

----------------------------------------------------------------
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