You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ga...@apache.org on 2017/11/02 16:23:09 UTC

[07/12] hive git commit: HIVE-17812 Move remaining classes that HiveMetaStore depends on. This closes #261. (Alan Gates, reviewed by Vihang Karajgaonkar)

http://git-wip-us.apache.org/repos/asf/hive/blob/c5a9673a/metastore/src/java/org/apache/hadoop/hive/metastore/messaging/json/JSONDropIndexMessage.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/messaging/json/JSONDropIndexMessage.java b/metastore/src/java/org/apache/hadoop/hive/metastore/messaging/json/JSONDropIndexMessage.java
deleted file mode 100644
index e99a31f..0000000
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/messaging/json/JSONDropIndexMessage.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/**
- * 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.hadoop.hive.metastore.messaging.json;
-
-import org.apache.hadoop.hive.metastore.api.Index;
-import org.apache.hadoop.hive.metastore.messaging.DropIndexMessage;
-import org.apache.thrift.TException;
-import org.codehaus.jackson.annotate.JsonProperty;
-
-/**
- * JSON Implementation of DropIndexMessage.
- */
-public class JSONDropIndexMessage extends DropIndexMessage {
-
-  @JsonProperty
-  String server, servicePrincipal, db, indexName, origTableName, indexTableName;
-
-  @JsonProperty
-  Long timestamp;
-
-  /**
-   * Default constructor, required for Jackson.
-   */
-  public JSONDropIndexMessage() {}
-
-  public JSONDropIndexMessage(String server, String servicePrincipal, Index index, Long timestamp) {
-    this.server = server;
-    this.servicePrincipal = servicePrincipal;
-    this.db = index.getDbName();
-    this.indexName = index.getIndexName();
-    this.origTableName = index.getOrigTableName();
-    this.indexTableName = index.getIndexTableName();
-
-    this.timestamp = timestamp;
-    checkValid();
-  }
-
-  @Override
-  public String getDB() { return db; }
-
-  @Override
-  public String getServer() { return server; }
-
-  @Override
-  public String getServicePrincipal() { return servicePrincipal; }
-
-  @Override
-  public Long getTimestamp() { return timestamp; }
-
-  @Override
-  public String getIndexName() {
-    return indexName;
-  }
-
-  @Override
-  public String getOrigTableName() {
-    return origTableName;
-  }
-
-  @Override
-  public String getIndexTableName() {
-    return indexTableName;
-  }
-
-  @Override
-  public String toString() {
-    try {
-      return JSONMessageDeserializer.mapper.writeValueAsString(this);
-    }
-    catch (Exception exception) {
-      throw new IllegalArgumentException("Could not serialize: ", exception);
-    }
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hive/blob/c5a9673a/metastore/src/java/org/apache/hadoop/hive/metastore/messaging/json/JSONDropPartitionMessage.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/messaging/json/JSONDropPartitionMessage.java b/metastore/src/java/org/apache/hadoop/hive/metastore/messaging/json/JSONDropPartitionMessage.java
deleted file mode 100644
index 576806c..0000000
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/messaging/json/JSONDropPartitionMessage.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/**
- * 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.hadoop.hive.metastore.messaging.json;
-
-import org.apache.hadoop.hive.metastore.api.Table;
-import org.apache.hadoop.hive.metastore.messaging.DropPartitionMessage;
-import org.apache.thrift.TException;
-import org.codehaus.jackson.annotate.JsonProperty;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * JSON implementation of DropPartitionMessage.
- */
-public class JSONDropPartitionMessage extends DropPartitionMessage {
-
-  @JsonProperty
-  String server, servicePrincipal, db, table, tableType, tableObjJson;
-
-  @JsonProperty
-  Long timestamp;
-
-  @JsonProperty
-  List<Map<String, String>> partitions;
-
-  /**
-   * Default Constructor. Required for Jackson.
-   */
-  public JSONDropPartitionMessage() {
-  }
-
-  public JSONDropPartitionMessage(String server, String servicePrincipal, String db, String table,
-      List<Map<String, String>> partitions, Long timestamp) {
-    this(server, servicePrincipal, db, table,  null, partitions, timestamp);
-  }
-
-  public JSONDropPartitionMessage(String server, String servicePrincipal, String db, String table,
-      String tableType, List<Map<String, String>> partitions, Long timestamp) {
-    this.server = server;
-    this.servicePrincipal = servicePrincipal;
-    this.db = db;
-    this.table = table;
-    this.tableType = tableType;
-    this.partitions = partitions;
-    this.timestamp = timestamp;
-    checkValid();
-  }
-
-  public JSONDropPartitionMessage(String server, String servicePrincipal, Table tableObj,
-      List<Map<String, String>> partitionKeyValues, long timestamp) {
-    this(server, servicePrincipal, tableObj.getDbName(), tableObj.getTableName(),
-        tableObj.getTableType(), partitionKeyValues, timestamp);
-    try {
-      this.tableObjJson = JSONMessageFactory.createTableObjJson(tableObj);
-    } catch (TException e) {
-      throw new IllegalArgumentException("Could not serialize: ", e);
-    }
-  }
-
-  @Override
-  public String getServer() {
-    return server;
-  }
-
-  @Override
-  public String getServicePrincipal() {
-    return servicePrincipal;
-  }
-
-  @Override
-  public String getDB() {
-    return db;
-  }
-
-  @Override
-  public String getTable() {
-    return table;
-  }
-
-  @Override
-  public String getTableType() {
-    if (tableType != null) return tableType; else return "";
-  }
-
-  @Override
-  public Long getTimestamp() {
-    return timestamp;
-  }
-
-  @Override
-  public List<Map<String, String>> getPartitions() {
-    return partitions;
-  }
-
-  @Override
-  public Table getTableObj() throws Exception {
-    return (Table) JSONMessageFactory.getTObj(tableObjJson, Table.class);
-  }
-
-  public String getTableObjJson() {
-    return tableObjJson;
-  }
-
-  @Override
-  public String toString() {
-    try {
-      return JSONMessageDeserializer.mapper.writeValueAsString(this);
-    } catch (Exception exception) {
-      throw new IllegalArgumentException("Could not serialize: ", exception);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/hive/blob/c5a9673a/metastore/src/java/org/apache/hadoop/hive/metastore/messaging/json/JSONDropTableMessage.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/messaging/json/JSONDropTableMessage.java b/metastore/src/java/org/apache/hadoop/hive/metastore/messaging/json/JSONDropTableMessage.java
deleted file mode 100644
index 4334f73..0000000
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/messaging/json/JSONDropTableMessage.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/**
- * 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.hadoop.hive.metastore.messaging.json;
-
-import org.apache.hadoop.hive.metastore.api.Table;
-import org.apache.hadoop.hive.metastore.messaging.DropTableMessage;
-import org.apache.thrift.TException;
-import org.codehaus.jackson.annotate.JsonProperty;
-
-/**
- * JSON implementation of DropTableMessage.
- */
-public class JSONDropTableMessage extends DropTableMessage {
-
-  @JsonProperty
-  String server, servicePrincipal, db, table, tableType, tableObjJson;
-
-  @JsonProperty
-  Long timestamp;
-
-  /**
-   * Default constructor, needed for Jackson.
-   */
-  public JSONDropTableMessage() {
-  }
-
-  public JSONDropTableMessage(String server, String servicePrincipal, String db, String table,
-      Long timestamp) {
-    this(server, servicePrincipal, db, table, null, timestamp);
-  }
-
-  public JSONDropTableMessage(String server, String servicePrincipal, String db, String table,
-      String tableType, Long timestamp) {
-    this.server = server;
-    this.servicePrincipal = servicePrincipal;
-    this.db = db;
-    this.table = table;
-    this.tableType = tableType;
-    this.timestamp = timestamp;
-    checkValid();
-  }
-
-  public JSONDropTableMessage(String server, String servicePrincipal, Table tableObj,
-      Long timestamp) {
-    this(server, servicePrincipal, tableObj.getDbName(), tableObj.getTableName(),
-        tableObj.getTableType(), timestamp);
-    try {
-      this.tableObjJson = JSONMessageFactory.createTableObjJson(tableObj);
-    } catch (TException e) {
-      throw new IllegalArgumentException("Could not serialize: ", e);
-    }
-    checkValid();
-  }
-
-  @Override
-  public String getTable() {
-    return table;
-  }
-
-  @Override
-  public String getTableType() {
-    if (tableType != null) return tableType; else return "";
-  }
-
-  @Override
-  public Table getTableObj() throws Exception {
-    return (Table) JSONMessageFactory.getTObj(tableObjJson,Table.class);
-  }
-
-  @Override
-  public String getServer() {
-    return server;
-  }
-
-  @Override
-  public String getServicePrincipal() {
-    return servicePrincipal;
-  }
-
-  @Override
-  public String getDB() {
-    return db;
-  }
-
-  @Override
-  public Long getTimestamp() {
-    return timestamp;
-  }
-
-  @Override
-  public String toString() {
-    try {
-      return JSONMessageDeserializer.mapper.writeValueAsString(this);
-    } catch (Exception exception) {
-      throw new IllegalArgumentException("Could not serialize: ", exception);
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/hive/blob/c5a9673a/metastore/src/java/org/apache/hadoop/hive/metastore/messaging/json/JSONInsertMessage.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/messaging/json/JSONInsertMessage.java b/metastore/src/java/org/apache/hadoop/hive/metastore/messaging/json/JSONInsertMessage.java
deleted file mode 100644
index 1369fd2..0000000
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/messaging/json/JSONInsertMessage.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/**
- * 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.hadoop.hive.metastore.messaging.json;
-
-import org.apache.hadoop.hive.metastore.api.Partition;
-import org.apache.hadoop.hive.metastore.api.Table;
-import org.apache.hadoop.hive.metastore.messaging.InsertMessage;
-import org.apache.thrift.TException;
-import org.codehaus.jackson.annotate.JsonProperty;
-
-import com.google.common.collect.Lists;
-
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * JSON implementation of InsertMessage
- */
-public class JSONInsertMessage extends InsertMessage {
-
-  @JsonProperty
-  String server, servicePrincipal, db, table, tableType, tableObjJson, ptnObjJson;
-
-  @JsonProperty
-  Long timestamp;
-
-  @JsonProperty
-  String replace;
-
-  @JsonProperty
-  List<String> files;
-
-  /**
-   * Default constructor, needed for Jackson.
-   */
-  public JSONInsertMessage() {
-  }
-
-  public JSONInsertMessage(String server, String servicePrincipal, Table tableObj, Partition ptnObj,
-                           boolean replace, Iterator<String> fileIter, Long timestamp) {
-    this.server = server;
-    this.servicePrincipal = servicePrincipal;
-
-    if (null == tableObj) {
-      throw new IllegalArgumentException("Table not valid.");
-    }
-
-    this.db = tableObj.getDbName();
-    this.table = tableObj.getTableName();
-    this.tableType = tableObj.getTableType();
-
-    try {
-      this.tableObjJson = JSONMessageFactory.createTableObjJson(tableObj);
-      if (null != ptnObj) {
-        this.ptnObjJson = JSONMessageFactory.createPartitionObjJson(ptnObj);
-      } else {
-        this.ptnObjJson = null;
-      }
-    } catch (TException e) {
-      throw new IllegalArgumentException("Could not serialize: ", e);
-    }
-
-    this.timestamp = timestamp;
-    this.replace = Boolean.toString(replace);
-    this.files = Lists.newArrayList(fileIter);
-
-    checkValid();
-  }
-
-  @Override
-  public String getTable() {
-    return table;
-  }
-
-  @Override
-  public String getTableType() {
-    if (tableType != null) return tableType; else return "";
-  }
-
-  @Override
-  public String getServer() {
-    return server;
-  }
-
-  @Override
-  public Iterable<String> getFiles() {
-    return files;
-  }
-
-  @Override
-  public String getServicePrincipal() {
-    return servicePrincipal;
-  }
-
-  @Override
-  public String getDB() {
-    return db;
-  }
-
-  @Override
-  public Long getTimestamp() {
-    return timestamp;
-  }
-
-  @Override
-  public boolean isReplace() { return Boolean.parseBoolean(replace); }
-
-  @Override
-  public Table getTableObj() throws Exception {
-    return (Table) JSONMessageFactory.getTObj(tableObjJson,Table.class);
-  }
-
-  @Override
-  public Partition getPtnObj() throws Exception {
-    return ((null == ptnObjJson) ? null : (Partition) JSONMessageFactory.getTObj(ptnObjJson, Partition.class));
-  }
-
-  @Override
-  public String toString() {
-    try {
-      return JSONMessageDeserializer.mapper.writeValueAsString(this);
-    } catch (Exception exception) {
-      throw new IllegalArgumentException("Could not serialize: ", exception);
-    }
-  }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hive/blob/c5a9673a/metastore/src/java/org/apache/hadoop/hive/metastore/messaging/json/JSONMessageDeserializer.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/messaging/json/JSONMessageDeserializer.java b/metastore/src/java/org/apache/hadoop/hive/metastore/messaging/json/JSONMessageDeserializer.java
deleted file mode 100644
index 7f588a0..0000000
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/messaging/json/JSONMessageDeserializer.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/**
- * 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.hadoop.hive.metastore.messaging.json;
-
-import org.apache.hadoop.hive.metastore.messaging.AddForeignKeyMessage;
-import org.apache.hadoop.hive.metastore.messaging.AddNotNullConstraintMessage;
-import org.apache.hadoop.hive.metastore.messaging.AddPartitionMessage;
-import org.apache.hadoop.hive.metastore.messaging.AddPrimaryKeyMessage;
-import org.apache.hadoop.hive.metastore.messaging.AddUniqueConstraintMessage;
-import org.apache.hadoop.hive.metastore.messaging.AlterIndexMessage;
-import org.apache.hadoop.hive.metastore.messaging.AlterPartitionMessage;
-import org.apache.hadoop.hive.metastore.messaging.AlterTableMessage;
-import org.apache.hadoop.hive.metastore.messaging.CreateDatabaseMessage;
-import org.apache.hadoop.hive.metastore.messaging.CreateFunctionMessage;
-import org.apache.hadoop.hive.metastore.messaging.CreateIndexMessage;
-import org.apache.hadoop.hive.metastore.messaging.CreateTableMessage;
-import org.apache.hadoop.hive.metastore.messaging.DropConstraintMessage;
-import org.apache.hadoop.hive.metastore.messaging.DropDatabaseMessage;
-import org.apache.hadoop.hive.metastore.messaging.DropFunctionMessage;
-import org.apache.hadoop.hive.metastore.messaging.DropIndexMessage;
-import org.apache.hadoop.hive.metastore.messaging.DropPartitionMessage;
-import org.apache.hadoop.hive.metastore.messaging.DropTableMessage;
-import org.apache.hadoop.hive.metastore.messaging.InsertMessage;
-import org.apache.hadoop.hive.metastore.messaging.MessageDeserializer;
-import org.codehaus.jackson.map.DeserializationConfig;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.map.SerializationConfig;
-
-/**
- * MessageDeserializer implementation, for deserializing from JSON strings.
- */
-public class JSONMessageDeserializer extends MessageDeserializer {
-
-  static ObjectMapper mapper = new ObjectMapper(); // Thread-safe.
-
-  static {
-    mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-    mapper.configure(SerializationConfig.Feature.AUTO_DETECT_GETTERS, false);
-    mapper.configure(SerializationConfig.Feature.AUTO_DETECT_IS_GETTERS, false);
-    mapper.configure(SerializationConfig.Feature.AUTO_DETECT_FIELDS, false);
-  }
-
-  @Override
-  public CreateDatabaseMessage getCreateDatabaseMessage(String messageBody) {
-    try {
-      return mapper.readValue(messageBody, JSONCreateDatabaseMessage.class);
-    }
-    catch (Exception exception) {
-      throw new IllegalArgumentException("Could not construct JSONCreateDatabaseMessage.", exception);
-    }
-  }
-
-  @Override
-  public DropDatabaseMessage getDropDatabaseMessage(String messageBody) {
-    try {
-      return mapper.readValue(messageBody, JSONDropDatabaseMessage.class);
-    }
-    catch (Exception exception) {
-      throw new IllegalArgumentException("Could not construct JSONDropDatabaseMessage.", exception);
-    }
-  }
-
-  @Override
-  public CreateTableMessage getCreateTableMessage(String messageBody) {
-    try {
-      return mapper.readValue(messageBody, JSONCreateTableMessage.class);
-    }
-    catch (Exception exception) {
-      throw new IllegalArgumentException("Could not construct JSONCreateTableMessage.", exception);
-    }
-  }
-
-  @Override
-  public AlterTableMessage getAlterTableMessage(String messageBody) {
-    try {
-      return mapper.readValue(messageBody, JSONAlterTableMessage.class);
-    }
-    catch (Exception exception) {
-      throw new IllegalArgumentException("Could not construct appropriate alter table type.",
-          exception);
-    }
-  }
-
-  @Override
-  public DropTableMessage getDropTableMessage(String messageBody) {
-    try {
-      return mapper.readValue(messageBody, JSONDropTableMessage.class);
-    }
-    catch (Exception exception) {
-      throw new IllegalArgumentException("Could not construct JSONDropTableMessage.", exception);
-    }
-  }
-
-  @Override
-  public AddPartitionMessage getAddPartitionMessage(String messageBody) {
-    try {
-      return mapper.readValue(messageBody, JSONAddPartitionMessage.class);
-    }
-    catch (Exception exception) {
-      throw new IllegalArgumentException("Could not construct AddPartitionMessage.", exception);
-    }
-  }
-
-  @Override
-  public AlterPartitionMessage getAlterPartitionMessage(String messageBody) {
-    try {
-      return mapper.readValue(messageBody, JSONAlterPartitionMessage.class);
-    } catch (Exception e) {
-      throw new IllegalArgumentException("Could not construct AlterPartitionMessage.", e);
-    }
-  }
-
-  @Override
-  public DropPartitionMessage getDropPartitionMessage(String messageBody) {
-    try {
-      return mapper.readValue(messageBody, JSONDropPartitionMessage.class);
-    }
-    catch (Exception exception) {
-      throw new IllegalArgumentException("Could not construct DropPartitionMessage.", exception);
-    }
-  }
-
-  @Override
-  public CreateFunctionMessage getCreateFunctionMessage(String messageBody) {
-    try {
-      return mapper.readValue(messageBody, JSONCreateFunctionMessage.class);
-    }
-    catch (Exception exception) {
-      throw new IllegalArgumentException("Could not construct JSONCreateFunctionMessage.", exception);
-    }
-  }
-
-  @Override
-  public DropFunctionMessage getDropFunctionMessage(String messageBody) {
-    try {
-      return mapper.readValue(messageBody, JSONDropFunctionMessage.class);
-    }
-    catch (Exception exception) {
-      throw new IllegalArgumentException("Could not construct JSONDropDatabaseMessage.", exception);
-    }
-  }
-
-  @Override
-  public CreateIndexMessage getCreateIndexMessage(String messageBody) {
-    try {
-      return mapper.readValue(messageBody, JSONCreateIndexMessage.class);
-    }
-    catch (Exception exception) {
-      throw new IllegalArgumentException("Could not construct JSONCreateIndexMessage.", exception);
-    }
-  }
-
-  @Override
-  public DropIndexMessage getDropIndexMessage(String messageBody) {
-    try {
-      return mapper.readValue(messageBody, JSONDropIndexMessage.class);
-    }
-    catch (Exception exception) {
-      throw new IllegalArgumentException("Could not construct JSONDropIndexMessage.", exception);
-    }
-  }
-
-  @Override
-  public AlterIndexMessage getAlterIndexMessage(String messageBody) {
-    try {
-      return mapper.readValue(messageBody, JSONAlterIndexMessage.class);
-    }
-    catch (Exception exception) {
-      throw new IllegalArgumentException("Could not construct JSONAlterIndexMessage.", exception);
-    }
-  }
-
-  @Override
-  public InsertMessage getInsertMessage(String messageBody) {
-    try {
-      return mapper.readValue(messageBody, JSONInsertMessage.class);
-    } catch (Exception e) {
-      throw new IllegalArgumentException("Could not construct InsertMessage", e);
-    }
-  }
-
-  @Override
-  public AddPrimaryKeyMessage getAddPrimaryKeyMessage(String messageBody) {
-    try {
-      return mapper.readValue(messageBody, JSONAddPrimaryKeyMessage.class);
-    } catch (Exception e) {
-      throw new IllegalArgumentException("Could not construct AddPrimaryKeyMessage", e);
-    }
-  }
-
-  @Override
-  public AddForeignKeyMessage getAddForeignKeyMessage(String messageBody) {
-    try {
-      return mapper.readValue(messageBody, JSONAddForeignKeyMessage.class);
-    } catch (Exception e) {
-      throw new IllegalArgumentException("Could not construct AddForeignKeyMessage", e);
-    }
-  }
-
-  @Override
-  public AddUniqueConstraintMessage getAddUniqueConstraintMessage(String messageBody) {
-    try {
-      return mapper.readValue(messageBody, JSONAddUniqueConstraintMessage.class);
-    } catch (Exception e) {
-      throw new IllegalArgumentException("Could not construct AddUniqueConstraintMessage", e);
-    }
-  }
-
-  @Override
-  public AddNotNullConstraintMessage getAddNotNullConstraintMessage(String messageBody) {
-    try {
-      return mapper.readValue(messageBody, JSONAddNotNullConstraintMessage.class);
-    } catch (Exception e) {
-      throw new IllegalArgumentException("Could not construct AddNotNullConstraintMessage", e);
-    }
-  }
-
-  @Override
-  public DropConstraintMessage getDropConstraintMessage(String messageBody) {
-    try {
-      return mapper.readValue(messageBody, JSONDropConstraintMessage.class);
-    } catch (Exception e) {
-      throw new IllegalArgumentException("Could not construct DropConstraintMessage", e);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/hive/blob/c5a9673a/metastore/src/java/org/apache/hadoop/hive/metastore/messaging/json/JSONMessageFactory.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/messaging/json/JSONMessageFactory.java b/metastore/src/java/org/apache/hadoop/hive/metastore/messaging/json/JSONMessageFactory.java
deleted file mode 100644
index c7877ee..0000000
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/messaging/json/JSONMessageFactory.java
+++ /dev/null
@@ -1,354 +0,0 @@
-/**
- * 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.hadoop.hive.metastore.messaging.json;
-
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.Nullable;
-
-import com.google.common.collect.Iterables;
-
-import org.apache.hadoop.hive.metastore.api.Database;
-import org.apache.hadoop.hive.metastore.api.Function;
-import org.apache.hadoop.hive.metastore.api.Index;
-import org.apache.hadoop.hive.metastore.api.NotificationEvent;
-import org.apache.hadoop.hive.metastore.api.Partition;
-import org.apache.hadoop.hive.metastore.api.SQLForeignKey;
-import org.apache.hadoop.hive.metastore.api.SQLNotNullConstraint;
-import org.apache.hadoop.hive.metastore.api.SQLPrimaryKey;
-import org.apache.hadoop.hive.metastore.api.SQLUniqueConstraint;
-import org.apache.hadoop.hive.metastore.api.Table;
-import org.apache.hadoop.hive.metastore.messaging.AddForeignKeyMessage;
-import org.apache.hadoop.hive.metastore.messaging.AddNotNullConstraintMessage;
-import org.apache.hadoop.hive.metastore.messaging.AddPartitionMessage;
-import org.apache.hadoop.hive.metastore.messaging.AddPrimaryKeyMessage;
-import org.apache.hadoop.hive.metastore.messaging.AddUniqueConstraintMessage;
-import org.apache.hadoop.hive.metastore.messaging.AlterIndexMessage;
-import org.apache.hadoop.hive.metastore.messaging.AlterPartitionMessage;
-import org.apache.hadoop.hive.metastore.messaging.AlterTableMessage;
-import org.apache.hadoop.hive.metastore.messaging.CreateDatabaseMessage;
-import org.apache.hadoop.hive.metastore.messaging.CreateFunctionMessage;
-import org.apache.hadoop.hive.metastore.messaging.CreateIndexMessage;
-import org.apache.hadoop.hive.metastore.messaging.CreateTableMessage;
-import org.apache.hadoop.hive.metastore.messaging.DropConstraintMessage;
-import org.apache.hadoop.hive.metastore.messaging.DropDatabaseMessage;
-import org.apache.hadoop.hive.metastore.messaging.DropFunctionMessage;
-import org.apache.hadoop.hive.metastore.messaging.DropIndexMessage;
-import org.apache.hadoop.hive.metastore.messaging.DropPartitionMessage;
-import org.apache.hadoop.hive.metastore.messaging.DropTableMessage;
-import org.apache.hadoop.hive.metastore.messaging.InsertMessage;
-import org.apache.hadoop.hive.metastore.messaging.MessageDeserializer;
-import org.apache.hadoop.hive.metastore.messaging.MessageFactory;
-import org.apache.hadoop.hive.metastore.messaging.PartitionFiles;
-import org.apache.thrift.TBase;
-import org.apache.thrift.TDeserializer;
-import org.apache.thrift.TException;
-import org.apache.thrift.TSerializer;
-import org.apache.thrift.protocol.TJSONProtocol;
-import org.codehaus.jackson.JsonFactory;
-import org.codehaus.jackson.JsonNode;
-import org.codehaus.jackson.JsonParser;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.node.ObjectNode;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.collect.Iterators;
-import com.google.common.collect.Lists;
-
-/**
- * The JSON implementation of the MessageFactory. Constructs JSON implementations of each
- * message-type.
- */
-public class JSONMessageFactory extends MessageFactory {
-
-  private static final Logger LOG = LoggerFactory.getLogger(JSONMessageFactory.class.getName());
-
-  private static JSONMessageDeserializer deserializer = new JSONMessageDeserializer();
-
-  @Override
-  public MessageDeserializer getDeserializer() {
-    return deserializer;
-  }
-
-  @Override
-  public String getMessageFormat() {
-    return "json-0.2";
-  }
-
-  @Override
-  public CreateDatabaseMessage buildCreateDatabaseMessage(Database db) {
-    return new JSONCreateDatabaseMessage(MS_SERVER_URL, MS_SERVICE_PRINCIPAL, db.getName(), now());
-  }
-
-  @Override
-  public DropDatabaseMessage buildDropDatabaseMessage(Database db) {
-    return new JSONDropDatabaseMessage(MS_SERVER_URL, MS_SERVICE_PRINCIPAL, db.getName(), now());
-  }
-
-  @Override
-  public CreateTableMessage buildCreateTableMessage(Table table, Iterator<String> fileIter) {
-    return new JSONCreateTableMessage(MS_SERVER_URL, MS_SERVICE_PRINCIPAL, table, fileIter, now());
-  }
-
-  @Override
-  public AlterTableMessage buildAlterTableMessage(Table before, Table after, boolean isTruncateOp) {
-    return new JSONAlterTableMessage(MS_SERVER_URL, MS_SERVICE_PRINCIPAL, before, after, isTruncateOp, now());
-  }
-
-  @Override
-  public DropTableMessage buildDropTableMessage(Table table) {
-    return new JSONDropTableMessage(MS_SERVER_URL, MS_SERVICE_PRINCIPAL, table, now());
-  }
-
-  @Override
-  public AddPartitionMessage buildAddPartitionMessage(Table table,
-      Iterator<Partition> partitionsIterator, Iterator<PartitionFiles> partitionFileIter) {
-    return new JSONAddPartitionMessage(MS_SERVER_URL, MS_SERVICE_PRINCIPAL, table,
-        partitionsIterator, partitionFileIter, now());
-  }
-
-  @Override
-  public AlterPartitionMessage buildAlterPartitionMessage(Table table, Partition before,
-      Partition after, boolean isTruncateOp) {
-    return new JSONAlterPartitionMessage(MS_SERVER_URL, MS_SERVICE_PRINCIPAL, table, before, after, isTruncateOp,
-        now());
-  }
-
-  @Override
-  public DropPartitionMessage buildDropPartitionMessage(Table table,
-      Iterator<Partition> partitionsIterator) {
-    return new JSONDropPartitionMessage(MS_SERVER_URL, MS_SERVICE_PRINCIPAL, table,
-        getPartitionKeyValues(table, partitionsIterator), now());
-  }
-
-  @Override
-  public CreateFunctionMessage buildCreateFunctionMessage(Function fn) {
-    return new JSONCreateFunctionMessage(MS_SERVER_URL, MS_SERVICE_PRINCIPAL, fn, now());
-  }
-
-  @Override
-  public DropFunctionMessage buildDropFunctionMessage(Function fn) {
-    return new JSONDropFunctionMessage(MS_SERVER_URL, MS_SERVICE_PRINCIPAL, fn, now());
-  }
-
-  @Override
-  public CreateIndexMessage buildCreateIndexMessage(Index idx) {
-    return new JSONCreateIndexMessage(MS_SERVER_URL, MS_SERVICE_PRINCIPAL, idx, now());
-  }
-
-  @Override
-  public DropIndexMessage buildDropIndexMessage(Index idx) {
-    return new JSONDropIndexMessage(MS_SERVER_URL, MS_SERVICE_PRINCIPAL, idx, now());
-  }
-
-  @Override
-  public AlterIndexMessage buildAlterIndexMessage(Index before, Index after) {
-    return new JSONAlterIndexMessage(MS_SERVER_URL, MS_SERVICE_PRINCIPAL, before, after, now());
-  }
-
-  @Override
-  public InsertMessage buildInsertMessage(Table tableObj, Partition partObj,
-                                          boolean replace, Iterator<String> fileIter) {
-    return new JSONInsertMessage(MS_SERVER_URL, MS_SERVICE_PRINCIPAL, tableObj, partObj, replace, fileIter, now());
-  }
-
-  @Override
-  public AddPrimaryKeyMessage buildAddPrimaryKeyMessage(List<SQLPrimaryKey> pks) {
-    return new JSONAddPrimaryKeyMessage(MS_SERVER_URL, MS_SERVICE_PRINCIPAL, pks, now());
-  }
-
-  @Override
-  public AddForeignKeyMessage buildAddForeignKeyMessage(List<SQLForeignKey> fks) {
-    return new JSONAddForeignKeyMessage(MS_SERVER_URL, MS_SERVICE_PRINCIPAL, fks, now());
-  }
-
-  @Override
-  public AddUniqueConstraintMessage buildAddUniqueConstraintMessage(List<SQLUniqueConstraint> uks) {
-    return new JSONAddUniqueConstraintMessage(MS_SERVER_URL, MS_SERVICE_PRINCIPAL, uks, now());
-  }
-
-  @Override
-  public AddNotNullConstraintMessage buildAddNotNullConstraintMessage(List<SQLNotNullConstraint> nns) {
-    return new JSONAddNotNullConstraintMessage(MS_SERVER_URL, MS_SERVICE_PRINCIPAL, nns, now());
-  }
-
-  @Override
-  public DropConstraintMessage buildDropConstraintMessage(String dbName, String tableName,
-      String constraintName) {
-    return new JSONDropConstraintMessage(MS_SERVER_URL, MS_SERVICE_PRINCIPAL, dbName, tableName,
-        constraintName, now());
-  }
-
-  private long now() {
-    return System.currentTimeMillis() / 1000;
-  }
-
-  static Map<String, String> getPartitionKeyValues(Table table, Partition partition) {
-    Map<String, String> partitionKeys = new LinkedHashMap<String, String>();
-    for (int i = 0; i < table.getPartitionKeysSize(); ++i)
-      partitionKeys.put(table.getPartitionKeys().get(i).getName(), partition.getValues().get(i));
-    return partitionKeys;
-  }
-
-  static List<Map<String, String>> getPartitionKeyValues(final Table table,
-      Iterator<Partition> iterator) {
-    return Lists.newArrayList(Iterators.transform(iterator,
-        new com.google.common.base.Function<Partition, Map<String, String>>() {
-          @Override
-          public Map<String, String> apply(@Nullable Partition partition) {
-            return getPartitionKeyValues(table, partition);
-          }
-        }));
-  }
-
-  static String createPrimaryKeyObjJson(SQLPrimaryKey primaryKeyObj) throws TException {
-    TSerializer serializer = new TSerializer(new TJSONProtocol.Factory());
-    return serializer.toString(primaryKeyObj, "UTF-8");
-  }
-
-  static String createForeignKeyObjJson(SQLForeignKey foreignKeyObj) throws TException {
-    TSerializer serializer = new TSerializer(new TJSONProtocol.Factory());
-    return serializer.toString(foreignKeyObj, "UTF-8");
-  }
-
-  static String createUniqueConstraintObjJson(SQLUniqueConstraint uniqueConstraintObj) throws TException {
-    TSerializer serializer = new TSerializer(new TJSONProtocol.Factory());
-    return serializer.toString(uniqueConstraintObj, "UTF-8");
-  }
-
-  static String createNotNullConstraintObjJson(SQLNotNullConstraint notNullConstaintObj) throws TException {
-    TSerializer serializer = new TSerializer(new TJSONProtocol.Factory());
-    return serializer.toString(notNullConstaintObj, "UTF-8");
-  }
-
-  static String createTableObjJson(Table tableObj) throws TException {
-    TSerializer serializer = new TSerializer(new TJSONProtocol.Factory());
-    return serializer.toString(tableObj, "UTF-8");
-  }
-
-  static String createPartitionObjJson(Partition partitionObj) throws TException {
-    TSerializer serializer = new TSerializer(new TJSONProtocol.Factory());
-    return serializer.toString(partitionObj, "UTF-8");
-  }
-
-  static String createFunctionObjJson(Function functionObj) throws TException {
-    TSerializer serializer = new TSerializer(new TJSONProtocol.Factory());
-    return serializer.toString(functionObj, "UTF-8");
-  }
-
-  static String createIndexObjJson(Index indexObj) throws TException {
-    TSerializer serializer = new TSerializer(new TJSONProtocol.Factory());
-    return serializer.toString(indexObj, "UTF-8");
-  }
-
-  public static ObjectNode getJsonTree(NotificationEvent event) throws Exception {
-    return getJsonTree(event.getMessage());
-  }
-
-  public static ObjectNode getJsonTree(String eventMessage) throws Exception {
-    JsonParser jsonParser = (new JsonFactory()).createJsonParser(eventMessage);
-    ObjectMapper mapper = new ObjectMapper();
-    return mapper.readValue(jsonParser, ObjectNode.class);
-  }
-
-  public static Table getTableObj(ObjectNode jsonTree) throws Exception {
-    TDeserializer deSerializer = new TDeserializer(new TJSONProtocol.Factory());
-    Table tableObj = new Table();
-    String tableJson = jsonTree.get("tableObjJson").asText();
-    deSerializer.deserialize(tableObj, tableJson, "UTF-8");
-    return tableObj;
-  }
-
-  /*
-   * TODO: Some thoughts here : We have a current todo to move some of these methods over to
-   * MessageFactory instead of being here, so we can override them, but before we move them over,
-   * we should keep the following in mind:
-   *
-   * a) We should return Iterables, not Lists. That makes sure that we can be memory-safe when
-   * implementing it rather than forcing ourselves down a path wherein returning List is part of
-   * our interface, and then people use .size() or somesuch which makes us need to materialize
-   * the entire list and not change. Also, returning Iterables allows us to do things like
-   * Iterables.transform for some of these.
-   * b) We should not have "magic" names like "tableObjJson", because that breaks expectation of a
-   * couple of things - firstly, that of serialization format, although that is fine for this
-   * JSONMessageFactory, and secondly, that makes us just have a number of mappings, one for each
-   * obj type, and sometimes, as the case is with alter, have multiples. Also, any event-specific
-   * item belongs in that event message / event itself, as opposed to in the factory. It's okay to
-   * have utility accessor methods here that are used by each of the messages to provide accessors.
-   * I'm adding a couple of those here.
-   *
-   */
-
-  public static TBase getTObj(String tSerialized, Class<? extends TBase> objClass) throws Exception{
-    TDeserializer thriftDeSerializer = new TDeserializer(new TJSONProtocol.Factory());
-    TBase obj = objClass.newInstance();
-    thriftDeSerializer.deserialize(obj, tSerialized, "UTF-8");
-    return obj;
-  }
-
-  public static Iterable<? extends TBase> getTObjs(
-      Iterable<String> objRefStrs, final Class<? extends TBase> objClass) throws Exception {
-
-    try {
-      return Iterables.transform(objRefStrs, new com.google.common.base.Function<String,TBase>(){
-        @Override
-        public TBase apply(@Nullable String objStr){
-          try {
-            return getTObj(objStr, objClass);
-          } catch (Exception e) {
-            throw new RuntimeException(e);
-          }
-        }
-      });
-    } catch (RuntimeException re){
-      // We have to add this bit of exception handling here, because Function.apply does not allow us to throw
-      // the actual exception that might be a checked exception, so we wind up needing to throw a RuntimeException
-      // with the previously thrown exception as its cause. However, since RuntimeException.getCause() returns
-      // a throwable instead of an Exception, we have to account for the possibility that the underlying code
-      // might have thrown a Throwable that we wrapped instead, in which case, continuing to throw the
-      // RuntimeException is the best thing we can do.
-      Throwable t = re.getCause();
-      if (t instanceof Exception){
-        throw (Exception) t;
-      } else {
-        throw re;
-      }
-    }
-  }
-
-  // If we do not need this format of accessor using ObjectNode, this is a candidate for removal as well
-  public static Iterable<? extends TBase> getTObjs(
-      ObjectNode jsonTree, String objRefListName, final Class<? extends TBase> objClass) throws Exception {
-    Iterable<JsonNode> jsonArrayIterator = jsonTree.get(objRefListName);
-    com.google.common.base.Function<JsonNode,String> textExtractor =
-        new com.google.common.base.Function<JsonNode, String>() {
-      @Nullable
-      @Override
-      public String apply(@Nullable JsonNode input) {
-        return input.asText();
-      }
-    };
-    return getTObjs(Iterables.transform(jsonArrayIterator, textExtractor), objClass);
-  }
-}

http://git-wip-us.apache.org/repos/asf/hive/blob/c5a9673a/metastore/src/test/org/apache/hadoop/hive/metastore/TestHiveAlterHandler.java
----------------------------------------------------------------------
diff --git a/metastore/src/test/org/apache/hadoop/hive/metastore/TestHiveAlterHandler.java b/metastore/src/test/org/apache/hadoop/hive/metastore/TestHiveAlterHandler.java
deleted file mode 100644
index 03ea7fc..0000000
--- a/metastore/src/test/org/apache/hadoop/hive/metastore/TestHiveAlterHandler.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/**
- * 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.hadoop.hive.metastore;
-
-import org.apache.hadoop.hive.metastore.api.*;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import java.util.Arrays;
-
-public class TestHiveAlterHandler {
-
-  @Test
-  public void testAlterTableAddColNotUpdateStats() throws MetaException, InvalidObjectException, NoSuchObjectException {
-    FieldSchema col1 = new FieldSchema("col1", "string", "col1 comment");
-    FieldSchema col2 = new FieldSchema("col2", "string", "col2 comment");
-    FieldSchema col3 = new FieldSchema("col3", "string", "col3 comment");
-    FieldSchema col4 = new FieldSchema("col4", "string", "col4 comment");
-
-    StorageDescriptor oldSd = new StorageDescriptor();
-    oldSd.setCols(Arrays.asList(col1, col2, col3));
-    Table oldTable = new Table();
-    oldTable.setDbName("default");
-    oldTable.setTableName("test_table");
-    oldTable.setSd(oldSd);
-
-    StorageDescriptor newSd = new StorageDescriptor(oldSd);
-    newSd.setCols(Arrays.asList(col1, col2, col3, col4));
-    Table newTable = new Table(oldTable);
-    newTable.setSd(newSd);
-
-    RawStore msdb = Mockito.mock(RawStore.class);
-    Mockito.doThrow(new RuntimeException("shouldn't be called")).when(msdb).getTableColumnStatistics(
-        oldTable.getDbName(), oldTable.getTableName(), Arrays.asList("col1", "col2", "col3"));
-    HiveAlterHandler handler = new HiveAlterHandler();
-    handler.alterTableUpdateTableColumnStats(msdb, oldTable, newTable);
-  }
-
-  @Test
-  public void testAlterTableDelColUpdateStats() throws MetaException, InvalidObjectException, NoSuchObjectException {
-    FieldSchema col1 = new FieldSchema("col1", "string", "col1 comment");
-    FieldSchema col2 = new FieldSchema("col2", "string", "col2 comment");
-    FieldSchema col3 = new FieldSchema("col3", "string", "col3 comment");
-    FieldSchema col4 = new FieldSchema("col4", "string", "col4 comment");
-
-    StorageDescriptor oldSd = new StorageDescriptor();
-    oldSd.setCols(Arrays.asList(col1, col2, col3, col4));
-    Table oldTable = new Table();
-    oldTable.setDbName("default");
-    oldTable.setTableName("test_table");
-    oldTable.setSd(oldSd);
-
-    StorageDescriptor newSd = new StorageDescriptor(oldSd);
-    newSd.setCols(Arrays.asList(col1, col2, col3));
-    Table newTable = new Table(oldTable);
-    newTable.setSd(newSd);
-
-    RawStore msdb = Mockito.mock(RawStore.class);
-    HiveAlterHandler handler = new HiveAlterHandler();
-    handler.alterTableUpdateTableColumnStats(msdb, oldTable, newTable);
-    Mockito.verify(msdb, Mockito.times(1)).getTableColumnStatistics(
-        oldTable.getDbName(), oldTable.getTableName(), Arrays.asList("col1", "col2", "col3", "col4")
-    );
-  }
-
-  @Test
-  public void testAlterTableChangePosNotUpdateStats() throws MetaException, InvalidObjectException, NoSuchObjectException {
-    FieldSchema col1 = new FieldSchema("col1", "string", "col1 comment");
-    FieldSchema col2 = new FieldSchema("col2", "string", "col2 comment");
-    FieldSchema col3 = new FieldSchema("col3", "string", "col3 comment");
-    FieldSchema col4 = new FieldSchema("col4", "string", "col4 comment");
-
-    StorageDescriptor oldSd = new StorageDescriptor();
-    oldSd.setCols(Arrays.asList(col1, col2, col3, col4));
-    Table oldTable = new Table();
-    oldTable.setDbName("default");
-    oldTable.setTableName("test_table");
-    oldTable.setSd(oldSd);
-
-    StorageDescriptor newSd = new StorageDescriptor(oldSd);
-    newSd.setCols(Arrays.asList(col1, col4, col2, col3));
-    Table newTable = new Table(oldTable);
-    newTable.setSd(newSd);
-
-    RawStore msdb = Mockito.mock(RawStore.class);
-    Mockito.doThrow(new RuntimeException("shouldn't be called")).when(msdb).getTableColumnStatistics(
-        oldTable.getDbName(), oldTable.getTableName(), Arrays.asList("col1", "col2", "col3", "col4"));
-    HiveAlterHandler handler = new HiveAlterHandler();
-    handler.alterTableUpdateTableColumnStats(msdb, oldTable, newTable);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/hive/blob/c5a9673a/metastore/src/test/org/apache/hadoop/hive/metastore/TestMetaStoreUtils.java
----------------------------------------------------------------------
diff --git a/metastore/src/test/org/apache/hadoop/hive/metastore/TestMetaStoreUtils.java b/metastore/src/test/org/apache/hadoop/hive/metastore/TestMetaStoreUtils.java
deleted file mode 100644
index e5c8a40..0000000
--- a/metastore/src/test/org/apache/hadoop/hive/metastore/TestMetaStoreUtils.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * 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.hadoop.hive.metastore;
-
-import org.apache.hadoop.hive.metastore.api.FieldSchema;
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.util.Arrays;
-
-public class TestMetaStoreUtils {
-
-  @Test
-  public void testcolumnsIncludedByNameType() {
-    FieldSchema col1 = new FieldSchema("col1", "string", "col1 comment");
-    FieldSchema col1a = new FieldSchema("col1", "string", "col1 but with a different comment");
-    FieldSchema col2 = new FieldSchema("col2", "string", "col2 comment");
-    FieldSchema col3 = new FieldSchema("col3", "string", "col3 comment");
-    Assert.assertTrue(MetaStoreUtils.columnsIncludedByNameType(Arrays.asList(col1), Arrays.asList(col1)));
-    Assert.assertTrue(MetaStoreUtils.columnsIncludedByNameType(Arrays.asList(col1), Arrays.asList(col1a)));
-    Assert.assertTrue(MetaStoreUtils.columnsIncludedByNameType(Arrays.asList(col1, col2), Arrays.asList(col1, col2)));
-    Assert.assertTrue(MetaStoreUtils.columnsIncludedByNameType(Arrays.asList(col1, col2), Arrays.asList(col2, col1)));
-    Assert.assertTrue(MetaStoreUtils.columnsIncludedByNameType(Arrays.asList(col1, col2), Arrays.asList(col1, col2, col3)));
-    Assert.assertTrue(MetaStoreUtils.columnsIncludedByNameType(Arrays.asList(col1, col2), Arrays.asList(col3, col2, col1)));
-    Assert.assertFalse(MetaStoreUtils.columnsIncludedByNameType(Arrays.asList(col1, col2), Arrays.asList(col1)));
-  }
-}

http://git-wip-us.apache.org/repos/asf/hive/blob/c5a9673a/metastore/src/test/org/apache/hadoop/hive/metastore/TestRetriesInRetryingHMSHandler.java
----------------------------------------------------------------------
diff --git a/metastore/src/test/org/apache/hadoop/hive/metastore/TestRetriesInRetryingHMSHandler.java b/metastore/src/test/org/apache/hadoop/hive/metastore/TestRetriesInRetryingHMSHandler.java
deleted file mode 100644
index 0d2a9cb..0000000
--- a/metastore/src/test/org/apache/hadoop/hive/metastore/TestRetriesInRetryingHMSHandler.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/**
- * 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.hadoop.hive.metastore;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.util.concurrent.TimeUnit;
-
-import javax.jdo.JDOException;
-
-import org.apache.hadoop.hive.conf.HiveConf;
-import org.apache.hadoop.hive.metastore.api.MetaException;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-public class TestRetriesInRetryingHMSHandler {
-
-  private static HiveConf hiveConf;
-  private static final int RETRY_ATTEMPTS = 3;
-
-  @BeforeClass
-  public static void setup() throws IOException {
-    hiveConf = new HiveConf();
-    int port = MetaStoreTestUtils.findFreePort();
-    hiveConf.setVar(HiveConf.ConfVars.METASTOREURIS, "thrift://localhost:" + port);
-    hiveConf.setIntVar(HiveConf.ConfVars.METASTORETHRIFTCONNECTIONRETRIES, 3);
-    hiveConf.setIntVar(HiveConf.ConfVars.HMSHANDLERATTEMPTS, RETRY_ATTEMPTS);
-    hiveConf.setTimeVar(HiveConf.ConfVars.HMSHANDLERINTERVAL, 10, TimeUnit.MILLISECONDS);
-    hiveConf.setBoolVar(HiveConf.ConfVars.HMSHANDLERFORCERELOADCONF, false);
-  }
-
-  /*
-   * If the init method of HMSHandler throws exception for the first time
-   * while creating RetryingHMSHandler it should be retried
-   */
-  @Test
-  public void testRetryInit() throws MetaException {
-    IHMSHandler mockBaseHandler = Mockito.mock(HiveMetaStore.HMSHandler.class);
-    Mockito.when(mockBaseHandler.getConf()).thenReturn(hiveConf);
-    Mockito
-    .doThrow(JDOException.class)
-    .doNothing()
-    .when(mockBaseHandler).init();
-    RetryingHMSHandler.getProxy(hiveConf, mockBaseHandler, false);
-    Mockito.verify(mockBaseHandler, Mockito.times(2)).init();
-  }
-
-  /*
-   * init method in HMSHandler should not be retried if there are no exceptions
-   */
-  @Test
-  public void testNoRetryInit() throws MetaException {
-    IHMSHandler mockBaseHandler = Mockito.mock(HiveMetaStore.HMSHandler.class);
-    Mockito.when(mockBaseHandler.getConf()).thenReturn(hiveConf);
-    Mockito.doNothing().when(mockBaseHandler).init();
-    RetryingHMSHandler.getProxy(hiveConf, mockBaseHandler, false);
-    Mockito.verify(mockBaseHandler, Mockito.times(1)).init();
-  }
-
-  /*
-   * If the init method in HMSHandler throws exception all the times it should be retried until
-   * HiveConf.ConfVars.HMSHANDLERATTEMPTS is reached before giving up
-   */
-  @Test(expected = MetaException.class)
-  public void testRetriesLimit() throws MetaException {
-    IHMSHandler mockBaseHandler = Mockito.mock(HiveMetaStore.HMSHandler.class);
-    Mockito.when(mockBaseHandler.getConf()).thenReturn(hiveConf);
-    Mockito.doThrow(JDOException.class).when(mockBaseHandler).init();
-    RetryingHMSHandler.getProxy(hiveConf, mockBaseHandler, false);
-    Mockito.verify(mockBaseHandler, Mockito.times(RETRY_ATTEMPTS)).init();
-  }
-
-  /*
-   * Test retries when InvocationException wrapped in MetaException wrapped in JDOException
-   * is thrown
-   */
-  @Test
-  public void testWrappedMetaExceptionRetry() throws MetaException {
-    IHMSHandler mockBaseHandler = Mockito.mock(HiveMetaStore.HMSHandler.class);
-    Mockito.when(mockBaseHandler.getConf()).thenReturn(hiveConf);
-    //JDOException wrapped in MetaException wrapped in InvocationException
-    MetaException me = new MetaException("Dummy exception");
-    me.initCause(new JDOException());
-    InvocationTargetException ex = new InvocationTargetException(me);
-    Mockito
-    .doThrow(me)
-    .doNothing()
-    .when(mockBaseHandler).init();
-    RetryingHMSHandler.getProxy(hiveConf, mockBaseHandler, false);
-    Mockito.verify(mockBaseHandler, Mockito.times(2)).init();
-  }
-}

http://git-wip-us.apache.org/repos/asf/hive/blob/c5a9673a/metastore/src/test/org/apache/hadoop/hive/metastore/messaging/json/TestJSONMessageDeserializer.java
----------------------------------------------------------------------
diff --git a/metastore/src/test/org/apache/hadoop/hive/metastore/messaging/json/TestJSONMessageDeserializer.java b/metastore/src/test/org/apache/hadoop/hive/metastore/messaging/json/TestJSONMessageDeserializer.java
deleted file mode 100644
index 9e22d8f..0000000
--- a/metastore/src/test/org/apache/hadoop/hive/metastore/messaging/json/TestJSONMessageDeserializer.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/**
- * 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.hadoop.hive.metastore.messaging.json;
-
-import org.codehaus.jackson.annotate.JsonProperty;
-import org.json.JSONException;
-import org.junit.Test;
-import org.skyscreamer.jsonassert.JSONAssert;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-import static org.junit.Assert.assertEquals;
-
-public class TestJSONMessageDeserializer {
-
-  public static class MyClass {
-    @JsonProperty
-    private int a;
-    @JsonProperty
-    private Map<String, String> map;
-    private long l;
-    private String shouldNotSerialize = "shouldNotSerialize";
-
-    //for jackson to instantiate
-    MyClass() {
-    }
-
-    MyClass(int a, Map<String, String> map, long l) {
-      this.a = a;
-      this.map = map;
-      this.l = l;
-    }
-
-    @JsonProperty
-    long getL() {
-      return l;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-      if (this == o)
-        return true;
-      if (o == null || getClass() != o.getClass())
-        return false;
-
-      MyClass myClass = (MyClass) o;
-
-      if (a != myClass.a)
-        return false;
-      if (l != myClass.l)
-        return false;
-      if (!map.equals(myClass.map))
-        return false;
-      return shouldNotSerialize.equals(myClass.shouldNotSerialize);
-    }
-
-    @Override
-    public int hashCode() {
-      int result = a;
-      result = 31 * result + map.hashCode();
-      result = 31 * result + (int) (l ^ (l >>> 32));
-      result = 31 * result + shouldNotSerialize.hashCode();
-      return result;
-    }
-  }
-
-  @Test
-  public void shouldNotSerializePropertiesNotAnnotated() throws IOException, JSONException {
-    MyClass obj = new MyClass(Integer.MAX_VALUE, new HashMap<String, String>() {{
-      put("a", "a");
-      put("b", "b");
-    }}, Long.MAX_VALUE);
-    String json = JSONMessageDeserializer.mapper.writeValueAsString(obj);
-    JSONAssert.assertEquals(
-        "{\"a\":2147483647,\"map\":{\"b\":\"b\",\"a\":\"a\"},\"l\":9223372036854775807}", json,
-        false);
-  }
-
-  @Test
-  public void shouldDeserializeJsonStringToObject() throws IOException {
-    String json = "{\"a\":47,\"map\":{\"a\":\"a\",\"b\":\"a value for b\"},\"l\":98}";
-    MyClass actual = JSONMessageDeserializer.mapper.readValue(json, MyClass.class);
-    MyClass expected = new MyClass(47, new HashMap<String, String>() {{
-      put("a", "a");
-      put("b", "a value for b");
-    }}, 98L);
-    assertEquals(expected, actual);
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hive/blob/c5a9673a/ql/src/java/org/apache/hadoop/hive/ql/parse/MetaDataExportListener.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/MetaDataExportListener.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/MetaDataExportListener.java
index db624c0..7a28b43 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/MetaDataExportListener.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/MetaDataExportListener.java
@@ -21,15 +21,15 @@ import java.io.IOException;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 
+import org.apache.hadoop.hive.metastore.IHMSHandler;
+import org.apache.hadoop.hive.metastore.conf.MetastoreConf;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.hive.conf.HiveConf;
 import org.apache.hadoop.hive.metastore.MetaStorePreEventListener;
 import org.apache.hadoop.hive.metastore.Warehouse;
-import org.apache.hadoop.hive.metastore.HiveMetaStore.HMSHandler;
 import org.apache.hadoop.hive.metastore.api.InvalidOperationException;
 import org.apache.hadoop.hive.metastore.api.MetaException;
 import org.apache.hadoop.hive.metastore.api.NoSuchObjectException;
@@ -58,17 +58,17 @@ public class MetaDataExportListener extends MetaStorePreEventListener {
     String name = tbl.getTableName();
     org.apache.hadoop.hive.ql.metadata.Table mTbl = new org.apache.hadoop.hive.ql.metadata.Table(
         tbl);
-    HMSHandler handler = tableEvent.getHandler();
-    HiveConf hiveconf = handler.getHiveConf();
-    Warehouse wh = new Warehouse(hiveconf);
+    IHMSHandler handler = tableEvent.getHandler();
+    Configuration conf = handler.getConf();
+    Warehouse wh = new Warehouse(conf);
     Path tblPath = new Path(tbl.getSd().getLocation());
     fs = wh.getFs(tblPath);
     Date now = new Date();
     SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
     String dateString = sdf.format(now);
-    String exportPathString = hiveconf.getVar(HiveConf.ConfVars.METADATA_EXPORT_LOCATION);
-    boolean moveMetadataToTrash = hiveconf
-        .getBoolVar(HiveConf.ConfVars.MOVE_EXPORTED_METADATA_TO_TRASH);
+    String exportPathString = MetastoreConf.getVar(conf, MetastoreConf.ConfVars.METADATA_EXPORT_LOCATION);
+    boolean moveMetadataToTrash = MetastoreConf
+        .getBoolVar(conf, MetastoreConf.ConfVars.MOVE_EXPORTED_METADATA_TO_TRASH);
     Path exportPath = null;
     if (exportPathString != null && exportPathString.length() == 0) {
       exportPath = fs.getHomeDirectory();

http://git-wip-us.apache.org/repos/asf/hive/blob/c5a9673a/ql/src/java/org/apache/hadoop/hive/ql/security/HadoopDefaultMetastoreAuthenticator.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/security/HadoopDefaultMetastoreAuthenticator.java b/ql/src/java/org/apache/hadoop/hive/ql/security/HadoopDefaultMetastoreAuthenticator.java
index c372027..07b506e 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/security/HadoopDefaultMetastoreAuthenticator.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/security/HadoopDefaultMetastoreAuthenticator.java
@@ -18,13 +18,13 @@
 
 package org.apache.hadoop.hive.ql.security;
 
-import org.apache.hadoop.hive.metastore.HiveMetaStore.HMSHandler;
+import org.apache.hadoop.hive.metastore.IHMSHandler;
 
 public class HadoopDefaultMetastoreAuthenticator extends HadoopDefaultAuthenticator
   implements HiveMetastoreAuthenticationProvider {
 
   @Override
-  public void setMetaStoreHandler(HMSHandler handler) {
+  public void setMetaStoreHandler(IHMSHandler handler) {
     setConf(handler.getConf());
   }
 

http://git-wip-us.apache.org/repos/asf/hive/blob/c5a9673a/ql/src/java/org/apache/hadoop/hive/ql/security/HiveMetastoreAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/security/HiveMetastoreAuthenticationProvider.java b/ql/src/java/org/apache/hadoop/hive/ql/security/HiveMetastoreAuthenticationProvider.java
index 73e9bfb..9b83c23 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/security/HiveMetastoreAuthenticationProvider.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/security/HiveMetastoreAuthenticationProvider.java
@@ -18,7 +18,7 @@
 
 package org.apache.hadoop.hive.ql.security;
 
-import org.apache.hadoop.hive.metastore.HiveMetaStore.HMSHandler;
+import org.apache.hadoop.hive.metastore.IHMSHandler;
 
 
 /**
@@ -36,6 +36,6 @@ public interface HiveMetastoreAuthenticationProvider extends HiveAuthenticationP
    * authentication that needs to be done.
    * @param handler
    */
-  void setMetaStoreHandler(HMSHandler handler);
+  void setMetaStoreHandler(IHMSHandler handler);
 
 }

http://git-wip-us.apache.org/repos/asf/hive/blob/c5a9673a/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/DefaultHiveMetastoreAuthorizationProvider.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/DefaultHiveMetastoreAuthorizationProvider.java b/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/DefaultHiveMetastoreAuthorizationProvider.java
index 4120298..d3242e3 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/DefaultHiveMetastoreAuthorizationProvider.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/DefaultHiveMetastoreAuthorizationProvider.java
@@ -19,7 +19,7 @@
 package org.apache.hadoop.hive.ql.security.authorization;
 
 import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hive.metastore.HiveMetaStore.HMSHandler;
+import org.apache.hadoop.hive.metastore.IHMSHandler;
 import org.apache.hadoop.hive.ql.metadata.AuthorizationException;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
 
@@ -32,7 +32,7 @@ public class DefaultHiveMetastoreAuthorizationProvider extends BitSetCheckedAuth
   }
 
   @Override
-  public void setMetaStoreHandler(HMSHandler handler) {
+  public void setMetaStoreHandler(IHMSHandler handler) {
     hive_db.setHandler(handler);
   }
 

http://git-wip-us.apache.org/repos/asf/hive/blob/c5a9673a/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/HiveAuthorizationProviderBase.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/HiveAuthorizationProviderBase.java b/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/HiveAuthorizationProviderBase.java
index 191426c..fa66a21 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/HiveAuthorizationProviderBase.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/HiveAuthorizationProviderBase.java
@@ -20,11 +20,11 @@ package org.apache.hadoop.hive.ql.security.authorization;
 
 import java.util.List;
 
+import org.apache.hadoop.hive.metastore.IHMSHandler;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hive.conf.HiveConf;
-import org.apache.hadoop.hive.metastore.HiveMetaStore.HMSHandler;
 import org.apache.hadoop.hive.metastore.api.Database;
 import org.apache.hadoop.hive.metastore.api.HiveObjectRef;
 import org.apache.hadoop.hive.metastore.api.HiveObjectType;
@@ -43,7 +43,7 @@ public abstract class HiveAuthorizationProviderBase implements
 
     private final boolean hasHiveClient;
     private final HiveConf conf;
-    private HMSHandler handler;
+    private IHMSHandler handler;
 
     public HiveProxy(Hive hive) {
       this.hasHiveClient = hive != null;
@@ -57,7 +57,7 @@ public abstract class HiveAuthorizationProviderBase implements
       this.handler = null;
     }
 
-    public void setHandler(HMSHandler handler){
+    public void setHandler(IHMSHandler handler){
       this.handler = handler;
     }
 

http://git-wip-us.apache.org/repos/asf/hive/blob/c5a9673a/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/HiveMetastoreAuthorizationProvider.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/HiveMetastoreAuthorizationProvider.java b/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/HiveMetastoreAuthorizationProvider.java
index 23161e3..bf21de7 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/HiveMetastoreAuthorizationProvider.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/HiveMetastoreAuthorizationProvider.java
@@ -18,7 +18,7 @@
 
 package org.apache.hadoop.hive.ql.security.authorization;
 
-import org.apache.hadoop.hive.metastore.HiveMetaStore.HMSHandler;
+import org.apache.hadoop.hive.metastore.IHMSHandler;
 import org.apache.hadoop.hive.ql.metadata.AuthorizationException;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
 
@@ -37,7 +37,7 @@ public interface HiveMetastoreAuthorizationProvider extends HiveAuthorizationPro
    * before any of the authorize methods are called.
    * @param handler
    */
-  void setMetaStoreHandler(HMSHandler handler);
+  void setMetaStoreHandler(IHMSHandler handler);
 
   /**
    * Authorize metastore authorization api call.

http://git-wip-us.apache.org/repos/asf/hive/blob/c5a9673a/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/MetaStoreAuthzAPIAuthorizerEmbedOnly.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/MetaStoreAuthzAPIAuthorizerEmbedOnly.java b/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/MetaStoreAuthzAPIAuthorizerEmbedOnly.java
index 5f1725c..00d95ef 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/MetaStoreAuthzAPIAuthorizerEmbedOnly.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/MetaStoreAuthzAPIAuthorizerEmbedOnly.java
@@ -22,7 +22,7 @@ import java.util.List;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hive.metastore.HiveMetaStore;
-import org.apache.hadoop.hive.metastore.HiveMetaStore.HMSHandler;
+import org.apache.hadoop.hive.metastore.IHMSHandler;
 import org.apache.hadoop.hive.metastore.api.Database;
 import org.apache.hadoop.hive.ql.metadata.AuthorizationException;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
@@ -76,7 +76,7 @@ public class MetaStoreAuthzAPIAuthorizerEmbedOnly extends HiveAuthorizationProvi
   }
 
   @Override
-  public void setMetaStoreHandler(HMSHandler handler) {
+  public void setMetaStoreHandler(IHMSHandler handler) {
     // no-op - HMSHander not needed by this impl
   }
 

http://git-wip-us.apache.org/repos/asf/hive/blob/c5a9673a/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/StorageBasedAuthorizationProvider.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/StorageBasedAuthorizationProvider.java b/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/StorageBasedAuthorizationProvider.java
index 32d8b3e..56fc9e4 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/StorageBasedAuthorizationProvider.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/StorageBasedAuthorizationProvider.java
@@ -27,6 +27,7 @@ import java.util.List;
 
 import javax.security.auth.login.LoginException;
 
+import org.apache.hadoop.hive.metastore.IHMSHandler;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.hadoop.conf.Configuration;
@@ -36,7 +37,6 @@ import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.permission.FsAction;
 import org.apache.hadoop.hive.common.FileUtils;
 import org.apache.hadoop.hive.conf.HiveConf;
-import org.apache.hadoop.hive.metastore.HiveMetaStore.HMSHandler;
 import org.apache.hadoop.hive.metastore.TableType;
 import org.apache.hadoop.hive.metastore.Warehouse;
 import org.apache.hadoop.hive.metastore.api.Database;
@@ -271,7 +271,7 @@ public class StorageBasedAuthorizationProvider extends HiveAuthorizationProvider
   }
 
   @Override
-  public void setMetaStoreHandler(HMSHandler handler) {
+  public void setMetaStoreHandler(IHMSHandler handler) {
     hive_db.setHandler(handler);
     this.wh = handler.getWh();
     this.isRunFromMetaStore = true;

http://git-wip-us.apache.org/repos/asf/hive/blob/c5a9673a/ql/src/java/org/apache/hadoop/hive/ql/txn/AcidCompactionHistoryService.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/txn/AcidCompactionHistoryService.java b/ql/src/java/org/apache/hadoop/hive/ql/txn/AcidCompactionHistoryService.java
deleted file mode 100644
index 5d9e7be..0000000
--- a/ql/src/java/org/apache/hadoop/hive/ql/txn/AcidCompactionHistoryService.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/**
- * 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.hadoop.hive.ql.txn;
-
-import org.apache.hadoop.hive.conf.HiveConf;
-import org.apache.hadoop.hive.metastore.txn.TxnStore;
-import org.apache.hadoop.hive.metastore.txn.TxnUtils;
-import org.apache.hadoop.hive.ql.txn.compactor.HouseKeeperServiceBase;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-
-/**
- * Purges obsolete items from compaction history data
- */
-public class AcidCompactionHistoryService extends HouseKeeperServiceBase {
-  private static final Logger LOG = LoggerFactory.getLogger(AcidCompactionHistoryService.class);
-
-  @Override
-  protected long getStartDelayMs() {
-    return 0;
-  }
-  @Override
-  protected long getIntervalMs() {
-    return hiveConf.getTimeVar(HiveConf.ConfVars.COMPACTOR_HISTORY_REAPER_INTERVAL, TimeUnit.MILLISECONDS);
-  }
-  @Override
-  protected Runnable getScheduedAction(HiveConf hiveConf, AtomicInteger isAliveCounter) {
-    return new ObsoleteEntryReaper(hiveConf, isAliveCounter);
-  }
-
-  @Override
-  public String getServiceDescription() {
-    return "Removes obsolete entries from Compaction History";
-  }
-  
-  private static final class ObsoleteEntryReaper implements Runnable {
-    private final TxnStore txnHandler;
-    private final AtomicInteger isAliveCounter;
-    private ObsoleteEntryReaper(HiveConf hiveConf, AtomicInteger isAliveCounter) {
-      txnHandler = TxnUtils.getTxnStore(hiveConf);
-      this.isAliveCounter = isAliveCounter;
-    }
-    
-    @Override
-    public void run() {
-      TxnStore.MutexAPI.LockHandle handle = null;
-      try {
-        handle = txnHandler.getMutexAPI().acquireLock(TxnStore.MUTEX_KEY.CompactionHistory.name());
-        long startTime = System.currentTimeMillis();
-        txnHandler.purgeCompactionHistory();
-        int count = isAliveCounter.incrementAndGet(); 
-        LOG.info("History reaper reaper ran for " + (System.currentTimeMillis() - startTime)/1000 + "seconds.  isAliveCounter=" + count);
-      }
-      catch(Throwable t) {
-        LOG.error("Serious error in {}", Thread.currentThread().getName(), ": {}" + t.getMessage(), t);
-      }
-      finally {
-        if(handle != null) {
-          handle.releaseLocks();
-        }
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/hive/blob/c5a9673a/ql/src/java/org/apache/hadoop/hive/ql/txn/AcidHouseKeeperService.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/txn/AcidHouseKeeperService.java b/ql/src/java/org/apache/hadoop/hive/ql/txn/AcidHouseKeeperService.java
deleted file mode 100644
index 13b10de..0000000
--- a/ql/src/java/org/apache/hadoop/hive/ql/txn/AcidHouseKeeperService.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/**
- * 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.hadoop.hive.ql.txn;
-
-import org.apache.hadoop.hive.conf.HiveConf;
-import org.apache.hadoop.hive.metastore.txn.TxnStore;
-import org.apache.hadoop.hive.metastore.txn.TxnUtils;
-import org.apache.hadoop.hive.ql.txn.compactor.HouseKeeperServiceBase;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-
-/**
- * Performs background tasks for Transaction management in Hive.
- * Runs inside Hive Metastore Service.
- */
-public class AcidHouseKeeperService extends HouseKeeperServiceBase {
-  private static final Logger LOG = LoggerFactory.getLogger(AcidHouseKeeperService.class);
-
-  @Override
-  protected long getStartDelayMs() {
-    return hiveConf.getTimeVar(HiveConf.ConfVars.HIVE_TIMEDOUT_TXN_REAPER_START, TimeUnit.MILLISECONDS);
-  }
-  @Override
-  protected long getIntervalMs() {
-    return hiveConf.getTimeVar(HiveConf.ConfVars.HIVE_TIMEDOUT_TXN_REAPER_INTERVAL, TimeUnit.MILLISECONDS);
-  }
-  @Override
-  protected Runnable getScheduedAction(HiveConf hiveConf, AtomicInteger isAliveCounter) {
-    return new TimedoutTxnReaper(hiveConf, isAliveCounter);
-  }
-
-  @Override
-  public String getServiceDescription() {
-    return "Abort expired transactions";
-  }
-
-  private static final class TimedoutTxnReaper implements Runnable {
-    private final TxnStore txnHandler;
-    private final AtomicInteger isAliveCounter;
-    private TimedoutTxnReaper(HiveConf hiveConf, AtomicInteger isAliveCounter) {
-      txnHandler = TxnUtils.getTxnStore(hiveConf);
-      this.isAliveCounter = isAliveCounter;
-    }
-    @Override
-    public void run() {
-      TxnStore.MutexAPI.LockHandle handle = null;
-      try {
-        handle = txnHandler.getMutexAPI().acquireLock(TxnStore.MUTEX_KEY.HouseKeeper.name());
-        long startTime = System.currentTimeMillis();
-        txnHandler.performTimeOuts();
-        int count = isAliveCounter.incrementAndGet();
-        LOG.info("timeout reaper ran for " + (System.currentTimeMillis() - startTime)/1000 + "seconds.  isAliveCounter=" + count);
-      }
-      catch(Throwable t) {
-        LOG.error("Serious error in {}", Thread.currentThread().getName(), ": {}" + t.getMessage(), t);
-      }
-      finally {
-        if(handle != null) {
-          handle.releaseLocks();
-        }
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/hive/blob/c5a9673a/ql/src/java/org/apache/hadoop/hive/ql/txn/AcidWriteSetService.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/txn/AcidWriteSetService.java b/ql/src/java/org/apache/hadoop/hive/ql/txn/AcidWriteSetService.java
deleted file mode 100644
index 2b8f815..0000000
--- a/ql/src/java/org/apache/hadoop/hive/ql/txn/AcidWriteSetService.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- * 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.hadoop.hive.ql.txn;
-
-import org.apache.hadoop.hive.conf.HiveConf;
-import org.apache.hadoop.hive.metastore.txn.TxnStore;
-import org.apache.hadoop.hive.metastore.txn.TxnUtils;
-import org.apache.hadoop.hive.ql.txn.compactor.HouseKeeperServiceBase;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-
-/**
- * Periodically cleans WriteSet tracking information used in Transaction management
- */
-public class AcidWriteSetService extends HouseKeeperServiceBase {
-  private static final Logger LOG = LoggerFactory.getLogger(AcidWriteSetService.class);
-  @Override
-  protected long getStartDelayMs() {
-    return 0;
-  }
-  @Override
-  protected long getIntervalMs() {
-    return hiveConf.getTimeVar(HiveConf.ConfVars.WRITE_SET_REAPER_INTERVAL, TimeUnit.MILLISECONDS);
-  }
-  @Override
-  protected Runnable getScheduedAction(HiveConf hiveConf, AtomicInteger isAliveCounter) {
-    return new WriteSetReaper(hiveConf, isAliveCounter);
-  }
-  @Override
-  public String getServiceDescription() {
-    return "Periodically cleans obsolete WriteSet tracking information used in Transaction management";
-  }
-  private static final class WriteSetReaper implements Runnable {
-    private final TxnStore txnHandler;
-    private final AtomicInteger isAliveCounter;
-    private WriteSetReaper(HiveConf hiveConf, AtomicInteger isAliveCounter) {
-      txnHandler = TxnUtils.getTxnStore(hiveConf);
-      this.isAliveCounter = isAliveCounter;
-    }
-    @Override
-    public void run() {
-      TxnStore.MutexAPI.LockHandle handle = null;
-      try {
-        handle = txnHandler.getMutexAPI().acquireLock(TxnStore.MUTEX_KEY.WriteSetCleaner.name());
-        long startTime = System.currentTimeMillis();
-        txnHandler.performWriteSetGC();
-        int count = isAliveCounter.incrementAndGet();
-        LOG.info("cleaner ran for " + (System.currentTimeMillis() - startTime)/1000 + "seconds.  isAliveCounter=" + count);
-      }
-      catch(Throwable t) {
-        LOG.error("Serious error in {}", Thread.currentThread().getName(), ": {}" + t.getMessage(), t);
-      }
-      finally {
-        if(handle != null) {
-          handle.releaseLocks();
-        }
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/hive/blob/c5a9673a/ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/HouseKeeperServiceBase.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/HouseKeeperServiceBase.java b/ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/HouseKeeperServiceBase.java
deleted file mode 100644
index 0aa160c..0000000
--- a/ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/HouseKeeperServiceBase.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- * 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.hadoop.hive.ql.txn.compactor;
-
-import org.apache.hadoop.hive.conf.HiveConf;
-import org.apache.hadoop.hive.metastore.HouseKeeperService;
-import org.apache.hadoop.hive.ql.lockmgr.HiveTxnManager;
-import org.apache.hadoop.hive.ql.lockmgr.TxnManagerFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-
-public abstract class HouseKeeperServiceBase implements HouseKeeperService {
-  private static final Logger LOG = LoggerFactory.getLogger(HouseKeeperServiceBase.class);
-  private ScheduledExecutorService pool = null;
-  protected final AtomicInteger isAliveCounter = new AtomicInteger(Integer.MIN_VALUE);
-  protected HiveConf hiveConf;
-
-  @Override
-  public void start(HiveConf hiveConf) throws Exception {
-    this.hiveConf = hiveConf;
-    HiveTxnManager mgr = TxnManagerFactory.getTxnManagerFactory().getTxnManager(hiveConf);
-    if(!mgr.supportsAcid()) {
-      LOG.info(this.getClass().getName() + " not started since " +
-        mgr.getClass().getName()  + " does not support Acid.");
-      return;//there are no transactions in this case
-    }
-    pool = Executors.newScheduledThreadPool(1, new ThreadFactory() {
-      private final AtomicInteger threadCounter = new AtomicInteger();
-      @Override
-      public Thread newThread(Runnable r) {
-        Thread t =
-            new Thread(r, HouseKeeperServiceBase.this.getClass().getName() + "-"
-                + threadCounter.getAndIncrement());
-        t.setDaemon(true);
-        return t;
-      }
-    });
-
-    TimeUnit tu = TimeUnit.MILLISECONDS;
-    pool.scheduleAtFixedRate(getScheduedAction(hiveConf, isAliveCounter), getStartDelayMs(),
-      getIntervalMs(), tu);
-    LOG.info("Started " + this.getClass().getName() + " with delay/interval = " + getStartDelayMs() + "/" +
-      getIntervalMs() + " " + tu);
-  }
-
-  @Override
-  public void stop() {
-    if(pool != null && !pool.isShutdown()) {
-      pool.shutdown();
-    }
-    pool = null;
-  }
-
-  /**
-   * This is used for testing only.  Each time the housekeeper runs, counter is incremented by 1.
-   * Starts with {@link java.lang.Integer#MIN_VALUE}
-   */
-  @Override
-  public int getIsAliveCounter() {
-    return isAliveCounter.get();
-  }
-
-  /**
-   * Delay in millis before first run of the task of this service.
-   */
-  protected abstract long getStartDelayMs();
-  /**
-   * Determines how frequently the service is running its task.
-   */
-  protected abstract long getIntervalMs();
-
-  /**
-   * The actual task implementation.  Must increment the counter on each iteration.
-   */
-  protected abstract Runnable getScheduedAction(HiveConf hiveConf, AtomicInteger isAliveCounter);
-}