drill-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DRILL-4199) Add Support for HBase 1.X
Date Tue, 31 May 2016 20:15:13 GMT

    [ https://issues.apache.org/jira/browse/DRILL-4199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15308538#comment-15308538
] 

ASF GitHub Bot commented on DRILL-4199:
---------------------------------------

Github user adityakishore commented on a diff in the pull request:

    https://github.com/apache/drill/pull/443#discussion_r65254353
  
    --- Diff: contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseConnectionManager.java
---
    @@ -0,0 +1,92 @@
    +/**
    + * 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.drill.exec.store.hbase;
    +
    +import java.util.concurrent.ExecutionException;
    +import java.util.concurrent.TimeUnit;
    +
    +import org.apache.drill.common.exceptions.UserException;
    +import org.apache.drill.exec.store.hbase.HBaseStoragePlugin.HBaseConnectionKey;
    +import org.apache.hadoop.hbase.client.Connection;
    +import org.apache.hadoop.hbase.client.ConnectionFactory;
    +
    +import com.google.common.cache.CacheBuilder;
    +import com.google.common.cache.CacheLoader;
    +import com.google.common.cache.LoadingCache;
    +import com.google.common.cache.RemovalListener;
    +import com.google.common.cache.RemovalNotification;
    +import com.google.common.util.concurrent.UncheckedExecutionException;
    +
    +/**
    + * <p>A singleton class which manages the lifecycle of HBase connections.</p>
    + * <p>One connection per storage plugin instance is maintained.</p>
    + */
    +public final class HBaseConnectionManager
    +    extends CacheLoader<HBaseConnectionKey, Connection> implements RemovalListener<HBaseConnectionKey,
Connection> {
    +  private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(HBaseConnectionManager.class);
    +
    +  public static final HBaseConnectionManager INSTANCE = new HBaseConnectionManager();
    +
    +  private final LoadingCache<HBaseConnectionKey, Connection> connectionCache;
    +
    +  private HBaseConnectionManager() {
    +    this.connectionCache = CacheBuilder.newBuilder()
    +        .expireAfterAccess(24, TimeUnit.HOURS)
    +        .removalListener(this)
    +        .build(this);
    +  }
    +
    +  @Override
    +  public Connection load(HBaseConnectionKey key) throws Exception {
    +    Connection connection = ConnectionFactory.createConnection(key.getHBaseConf());
    +    logger.debug("HBase connection '{}' created.", connection);
    +    return connection;
    +  }
    +
    +  @Override
    +  public void onRemoval(RemovalNotification<HBaseConnectionKey, Connection> notification)
{
    +    try {
    +      Connection conn = notification.getValue();
    +      if (conn != null) {
    +        conn.close();
    +      }
    +      logger.debug("HBase connection '{}' closed.", notification.getValue());
    +    } catch (Throwable t) {
    +      logger.warn("Error while closing HBase connection.", t);
    +    }
    +  }
    +
    +  public Connection getConnection(HBaseConnectionKey key) {
    +    try {
    +      Connection conn = connectionCache.get(key);
    +      if (conn.isAborted()
    +          || conn.isClosed()) {
    +        connectionCache.invalidate(key);
    --- End diff --
    
    Thanks for catching this, not sure how it slipped through my own review :(
    
    Couldn't find a simple way to make Guava do this (validate a cached value before returning),
so will change it to do both eviction and load atomically in this code itself.


> Add Support for HBase 1.X
> -------------------------
>
>                 Key: DRILL-4199
>                 URL: https://issues.apache.org/jira/browse/DRILL-4199
>             Project: Apache Drill
>          Issue Type: New Feature
>          Components: Storage - HBase
>    Affects Versions: 1.7.0
>            Reporter: Divjot singh
>            Assignee: Aditya Kishore
>
> Is there any Road map to upgrade the Hbase version to 1.x series. Currently drill supports
Hbase 0.98 version.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message