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

ASF GitHub Bot commented on TAJO-847:
-------------------------------------

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

    https://github.com/apache/tajo/pull/39#discussion_r13848338
  
    --- Diff: 
tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/MariaDBStore.java
 ---
    @@ -0,0 +1,301 @@
    +/**
    + * 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.tajo.catalog.store;
    +
    +import org.apache.hadoop.conf.Configuration;
    +import org.apache.tajo.catalog.CatalogUtil;
    +import org.apache.tajo.catalog.exception.CatalogException;
    +import org.apache.tajo.exception.InternalException;
    +
    +import java.sql.*;
    +import java.util.HashMap;
    +import java.util.Map;
    +
    +public class MariaDBStore extends AbstractDBStore  {
    +  /** 2014-06-09: First versioning */
    +  private static final int MARIADB_CATALOG_STORE_VERSION = 2;
    +
    +  private static final String CATALOG_DRIVER = "org.mariadb.jdbc.Driver";
    +  protected String getCatalogDriverName(){
    +    return CATALOG_DRIVER;
    +  }
    +
    +  public MariaDBStore(final Configuration conf) throws InternalException {
    +    super(conf);
    +  }
    +
    +  @Override
    +  public int getDriverVersion() {
    +    return MARIADB_CATALOG_STORE_VERSION;
    +  }
    +
    +  protected Connection createConnection(Configuration conf) throws 
SQLException {
    +    Connection con = DriverManager.getConnection(getCatalogUri(), 
this.connectionId,
    +        this.connectionPassword);
    +    //TODO con.setAutoCommit(false);
    +    return con;
    +  }
    +
    +  @Override
    +  protected boolean isConnValid(int timeout) throws CatalogException {
    +    boolean isValid = false;
    +
    +    try {
    +      isValid = super.isConnValid(timeout);
    +    } catch (NullPointerException e) {
    +      LOG.info("Conn abortion when checking isValid; retrieve false to 
create another Conn.");
    --- End diff --
    
    MariaDBStore's isValid NPE handling will give NACK to getConnection method 
so that Tajo tries to connect another JDBC session.


> Supporting MariaDB-based Store, which is compatible with MySQL.
> ---------------------------------------------------------------
>
>                 Key: TAJO-847
>                 URL: https://issues.apache.org/jira/browse/TAJO-847
>             Project: Tajo
>          Issue Type: New Feature
>          Components: catalog, conf and scripts
>    Affects Versions: 0.8.0
>         Environment: Tested with Hadoop 2.4.0, Tajo 0.8.0, MariaDB 5.5.37, 
> MariaDB-Java-Client (JDBC) 1.1.7 in OpenJDK 1.7.0_55 + Ubuntu 14.04 LTS x86_64
>            Reporter: Jinhang Choi
>            Assignee: Jinhang Choi
>            Priority: Minor
>             Fix For: 0.8.0
>
>         Attachments: TAJO-847.patch
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> There exists an open-source database MariaDB (http://mariadb.org) which can 
> be replacement for MySQL; Since the interface of MariaDB is perfectly 
> compatible to that of MySQL, it is easy to construct CatalogStore to use 
> MariaDB in Tajo.
> Therefore, I hereby suggest MariaDBStore by duplicating MySQLStore.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to