You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by na...@apache.org on 2014/08/13 07:53:39 UTC
svn commit: r1617662 [3/3] - in /hive/trunk:
common/src/java/org/apache/hadoop/hive/conf/
itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/
metastore/if/ metastore/src/gen/thrift/gen-cpp/
metastore/src/gen/thrift/gen-javabean/org/apache/...
Modified: hive/trunk/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py
URL: http://svn.apache.org/viewvc/hive/trunk/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py?rev=1617662&r1=1617661&r2=1617662&view=diff
==============================================================================
--- hive/trunk/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py (original)
+++ hive/trunk/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py Wed Aug 13 05:53:38 2014
@@ -22,6 +22,21 @@ class Iface(fb303.FacebookService.Iface)
"""
This interface is live.
"""
+ def getMetaConf(self, key):
+ """
+ Parameters:
+ - key
+ """
+ pass
+
+ def setMetaConf(self, key, value):
+ """
+ Parameters:
+ - key
+ - value
+ """
+ pass
+
def create_database(self, database):
"""
Parameters:
@@ -926,6 +941,70 @@ class Client(fb303.FacebookService.Clien
def __init__(self, iprot, oprot=None):
fb303.FacebookService.Client.__init__(self, iprot, oprot)
+ def getMetaConf(self, key):
+ """
+ Parameters:
+ - key
+ """
+ self.send_getMetaConf(key)
+ return self.recv_getMetaConf()
+
+ def send_getMetaConf(self, key):
+ self._oprot.writeMessageBegin('getMetaConf', TMessageType.CALL, self._seqid)
+ args = getMetaConf_args()
+ args.key = key
+ args.write(self._oprot)
+ self._oprot.writeMessageEnd()
+ self._oprot.trans.flush()
+
+ def recv_getMetaConf(self, ):
+ (fname, mtype, rseqid) = self._iprot.readMessageBegin()
+ if mtype == TMessageType.EXCEPTION:
+ x = TApplicationException()
+ x.read(self._iprot)
+ self._iprot.readMessageEnd()
+ raise x
+ result = getMetaConf_result()
+ result.read(self._iprot)
+ self._iprot.readMessageEnd()
+ if result.success is not None:
+ return result.success
+ if result.o1 is not None:
+ raise result.o1
+ raise TApplicationException(TApplicationException.MISSING_RESULT, "getMetaConf failed: unknown result");
+
+ def setMetaConf(self, key, value):
+ """
+ Parameters:
+ - key
+ - value
+ """
+ self.send_setMetaConf(key, value)
+ self.recv_setMetaConf()
+
+ def send_setMetaConf(self, key, value):
+ self._oprot.writeMessageBegin('setMetaConf', TMessageType.CALL, self._seqid)
+ args = setMetaConf_args()
+ args.key = key
+ args.value = value
+ args.write(self._oprot)
+ self._oprot.writeMessageEnd()
+ self._oprot.trans.flush()
+
+ def recv_setMetaConf(self, ):
+ (fname, mtype, rseqid) = self._iprot.readMessageBegin()
+ if mtype == TMessageType.EXCEPTION:
+ x = TApplicationException()
+ x.read(self._iprot)
+ self._iprot.readMessageEnd()
+ raise x
+ result = setMetaConf_result()
+ result.read(self._iprot)
+ self._iprot.readMessageEnd()
+ if result.o1 is not None:
+ raise result.o1
+ return
+
def create_database(self, database):
"""
Parameters:
@@ -4888,6 +4967,8 @@ class Client(fb303.FacebookService.Clien
class Processor(fb303.FacebookService.Processor, Iface, TProcessor):
def __init__(self, handler):
fb303.FacebookService.Processor.__init__(self, handler)
+ self._processMap["getMetaConf"] = Processor.process_getMetaConf
+ self._processMap["setMetaConf"] = Processor.process_setMetaConf
self._processMap["create_database"] = Processor.process_create_database
self._processMap["get_database"] = Processor.process_get_database
self._processMap["drop_database"] = Processor.process_drop_database
@@ -5014,6 +5095,34 @@ class Processor(fb303.FacebookService.Pr
self._processMap[name](self, seqid, iprot, oprot)
return True
+ def process_getMetaConf(self, seqid, iprot, oprot):
+ args = getMetaConf_args()
+ args.read(iprot)
+ iprot.readMessageEnd()
+ result = getMetaConf_result()
+ try:
+ result.success = self._handler.getMetaConf(args.key)
+ except MetaException as o1:
+ result.o1 = o1
+ oprot.writeMessageBegin("getMetaConf", TMessageType.REPLY, seqid)
+ result.write(oprot)
+ oprot.writeMessageEnd()
+ oprot.trans.flush()
+
+ def process_setMetaConf(self, seqid, iprot, oprot):
+ args = setMetaConf_args()
+ args.read(iprot)
+ iprot.readMessageEnd()
+ result = setMetaConf_result()
+ try:
+ self._handler.setMetaConf(args.key, args.value)
+ except MetaException as o1:
+ result.o1 = o1
+ oprot.writeMessageBegin("setMetaConf", TMessageType.REPLY, seqid)
+ result.write(oprot)
+ oprot.writeMessageEnd()
+ oprot.trans.flush()
+
def process_create_database(self, seqid, iprot, oprot):
args = create_database_args()
args.read(iprot)
@@ -6772,6 +6881,271 @@ class Processor(fb303.FacebookService.Pr
# HELPER FUNCTIONS AND STRUCTURES
+class getMetaConf_args:
+ """
+ Attributes:
+ - key
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'key', None, None, ), # 1
+ )
+
+ def __init__(self, key=None,):
+ self.key = key
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+ return
+ iprot.readStructBegin()
+ while True:
+ (fname, ftype, fid) = iprot.readFieldBegin()
+ if ftype == TType.STOP:
+ break
+ if fid == 1:
+ if ftype == TType.STRING:
+ self.key = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('getMetaConf_args')
+ if self.key is not None:
+ oprot.writeFieldBegin('key', TType.STRING, 1)
+ oprot.writeString(self.key)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ return
+
+
+ def __repr__(self):
+ L = ['%s=%r' % (key, value)
+ for key, value in self.__dict__.iteritems()]
+ return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class getMetaConf_result:
+ """
+ Attributes:
+ - success
+ - o1
+ """
+
+ thrift_spec = (
+ (0, TType.STRING, 'success', None, None, ), # 0
+ (1, TType.STRUCT, 'o1', (MetaException, MetaException.thrift_spec), None, ), # 1
+ )
+
+ def __init__(self, success=None, o1=None,):
+ self.success = success
+ self.o1 = o1
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+ return
+ iprot.readStructBegin()
+ while True:
+ (fname, ftype, fid) = iprot.readFieldBegin()
+ if ftype == TType.STOP:
+ break
+ if fid == 0:
+ if ftype == TType.STRING:
+ self.success = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ elif fid == 1:
+ if ftype == TType.STRUCT:
+ self.o1 = MetaException()
+ self.o1.read(iprot)
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('getMetaConf_result')
+ if self.success is not None:
+ oprot.writeFieldBegin('success', TType.STRING, 0)
+ oprot.writeString(self.success)
+ oprot.writeFieldEnd()
+ if self.o1 is not None:
+ oprot.writeFieldBegin('o1', TType.STRUCT, 1)
+ self.o1.write(oprot)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ return
+
+
+ def __repr__(self):
+ L = ['%s=%r' % (key, value)
+ for key, value in self.__dict__.iteritems()]
+ return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class setMetaConf_args:
+ """
+ Attributes:
+ - key
+ - value
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'key', None, None, ), # 1
+ (2, TType.STRING, 'value', None, None, ), # 2
+ )
+
+ def __init__(self, key=None, value=None,):
+ self.key = key
+ self.value = value
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+ return
+ iprot.readStructBegin()
+ while True:
+ (fname, ftype, fid) = iprot.readFieldBegin()
+ if ftype == TType.STOP:
+ break
+ if fid == 1:
+ if ftype == TType.STRING:
+ self.key = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.STRING:
+ self.value = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('setMetaConf_args')
+ if self.key is not None:
+ oprot.writeFieldBegin('key', TType.STRING, 1)
+ oprot.writeString(self.key)
+ oprot.writeFieldEnd()
+ if self.value is not None:
+ oprot.writeFieldBegin('value', TType.STRING, 2)
+ oprot.writeString(self.value)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ return
+
+
+ def __repr__(self):
+ L = ['%s=%r' % (key, value)
+ for key, value in self.__dict__.iteritems()]
+ return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class setMetaConf_result:
+ """
+ Attributes:
+ - o1
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRUCT, 'o1', (MetaException, MetaException.thrift_spec), None, ), # 1
+ )
+
+ def __init__(self, o1=None,):
+ self.o1 = o1
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+ return
+ iprot.readStructBegin()
+ while True:
+ (fname, ftype, fid) = iprot.readFieldBegin()
+ if ftype == TType.STOP:
+ break
+ if fid == 1:
+ if ftype == TType.STRUCT:
+ self.o1 = MetaException()
+ self.o1.read(iprot)
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('setMetaConf_result')
+ if self.o1 is not None:
+ oprot.writeFieldBegin('o1', TType.STRUCT, 1)
+ self.o1.write(oprot)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ return
+
+
+ def __repr__(self):
+ L = ['%s=%r' % (key, value)
+ for key, value in self.__dict__.iteritems()]
+ return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
class create_database_args:
"""
Attributes:
Modified: hive/trunk/metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb
URL: http://svn.apache.org/viewvc/hive/trunk/metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb?rev=1617662&r1=1617661&r2=1617662&view=diff
==============================================================================
--- hive/trunk/metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb (original)
+++ hive/trunk/metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb Wed Aug 13 05:53:38 2014
@@ -12,6 +12,37 @@ module ThriftHiveMetastore
class Client < ::FacebookService::Client
include ::Thrift::Client
+ def getMetaConf(key)
+ send_getMetaConf(key)
+ return recv_getMetaConf()
+ end
+
+ def send_getMetaConf(key)
+ send_message('getMetaConf', GetMetaConf_args, :key => key)
+ end
+
+ def recv_getMetaConf()
+ result = receive_message(GetMetaConf_result)
+ return result.success unless result.success.nil?
+ raise result.o1 unless result.o1.nil?
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getMetaConf failed: unknown result')
+ end
+
+ def setMetaConf(key, value)
+ send_setMetaConf(key, value)
+ recv_setMetaConf()
+ end
+
+ def send_setMetaConf(key, value)
+ send_message('setMetaConf', SetMetaConf_args, :key => key, :value => value)
+ end
+
+ def recv_setMetaConf()
+ result = receive_message(SetMetaConf_result)
+ raise result.o1 unless result.o1.nil?
+ return
+ end
+
def create_database(database)
send_create_database(database)
recv_create_database()
@@ -1864,6 +1895,28 @@ module ThriftHiveMetastore
class Processor < ::FacebookService::Processor
include ::Thrift::Processor
+ def process_getMetaConf(seqid, iprot, oprot)
+ args = read_args(iprot, GetMetaConf_args)
+ result = GetMetaConf_result.new()
+ begin
+ result.success = @handler.getMetaConf(args.key)
+ rescue ::MetaException => o1
+ result.o1 = o1
+ end
+ write_result(result, oprot, 'getMetaConf', seqid)
+ end
+
+ def process_setMetaConf(seqid, iprot, oprot)
+ args = read_args(iprot, SetMetaConf_args)
+ result = SetMetaConf_result.new()
+ begin
+ @handler.setMetaConf(args.key, args.value)
+ rescue ::MetaException => o1
+ result.o1 = o1
+ end
+ write_result(result, oprot, 'setMetaConf', seqid)
+ end
+
def process_create_database(seqid, iprot, oprot)
args = read_args(iprot, Create_database_args)
result = Create_database_result.new()
@@ -3286,6 +3339,74 @@ module ThriftHiveMetastore
# HELPER FUNCTIONS AND STRUCTURES
+ class GetMetaConf_args
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ KEY = 1
+
+ FIELDS = {
+ KEY => {:type => ::Thrift::Types::STRING, :name => 'key'}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+ end
+
+ class GetMetaConf_result
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ SUCCESS = 0
+ O1 = 1
+
+ FIELDS = {
+ SUCCESS => {:type => ::Thrift::Types::STRING, :name => 'success'},
+ O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => ::MetaException}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+ end
+
+ class SetMetaConf_args
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ KEY = 1
+ VALUE = 2
+
+ FIELDS = {
+ KEY => {:type => ::Thrift::Types::STRING, :name => 'key'},
+ VALUE => {:type => ::Thrift::Types::STRING, :name => 'value'}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+ end
+
+ class SetMetaConf_result
+ include ::Thrift::Struct, ::Thrift::Struct_Union
+ O1 = 1
+
+ FIELDS = {
+ O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => ::MetaException}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ ::Thrift::Struct.generate_accessors self
+ end
+
class Create_database_args
include ::Thrift::Struct, ::Thrift::Struct_Union
DATABASE = 1
Modified: hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
URL: http://svn.apache.org/viewvc/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java?rev=1617662&r1=1617661&r2=1617662&view=diff
==============================================================================
--- hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java (original)
+++ hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java Wed Aug 13 05:53:38 2014
@@ -142,6 +142,7 @@ import org.apache.hadoop.hive.metastore.
import org.apache.hadoop.hive.metastore.events.AddPartitionEvent;
import org.apache.hadoop.hive.metastore.events.AlterPartitionEvent;
import org.apache.hadoop.hive.metastore.events.AlterTableEvent;
+import org.apache.hadoop.hive.metastore.events.ConfigChangeEvent;
import org.apache.hadoop.hive.metastore.events.CreateDatabaseEvent;
import org.apache.hadoop.hive.metastore.events.CreateTableEvent;
import org.apache.hadoop.hive.metastore.events.DropDatabaseEvent;
@@ -348,15 +349,19 @@ public class HiveMetaStore extends Thrif
}
public HMSHandler(String name) throws MetaException {
- super(name);
- hiveConf = new HiveConf(this.getClass());
- init();
+ this(name, new HiveConf(HMSHandler.class), true);
}
public HMSHandler(String name, HiveConf conf) throws MetaException {
+ this(name, conf, true);
+ }
+
+ public HMSHandler(String name, HiveConf conf, boolean init) throws MetaException {
super(name);
hiveConf = conf;
- init();
+ if (init) {
+ init();
+ }
}
public HiveConf getHiveConf() {
@@ -378,7 +383,7 @@ public class HiveMetaStore extends Thrif
}
}
- private boolean init() throws MetaException {
+ public void init() throws MetaException {
rawStoreClassName = hiveConf.getVar(HiveConf.ConfVars.METASTORE_RAW_STORE_IMPL);
initListeners = MetaStoreUtils.getMetaStoreListeners(
MetaStoreInitListener.class, hiveConf,
@@ -436,7 +441,6 @@ public class HiveMetaStore extends Thrif
Timer cleaner = new Timer("Metastore Events Cleaner Thread", true);
cleaner.schedule(new EventCleanerTask(this), cleanFreq, cleanFreq);
}
- return true;
}
private String addPrefix(String s) {
@@ -448,10 +452,11 @@ public class HiveMetaStore extends Thrif
threadLocalConf.set(conf);
RawStore ms = threadLocalMS.get();
if (ms != null) {
- ms.setConf(conf);
+ ms.setConf(conf); // reload if DS related configuration is changed
}
}
+ @Override
public Configuration getConf() {
Configuration conf = threadLocalConf.get();
if (conf == null) {
@@ -465,6 +470,35 @@ public class HiveMetaStore extends Thrif
return wh;
}
+ @Override
+ public void setMetaConf(String key, String value) throws MetaException {
+ ConfVars confVar = HiveConf.getMetaConf(key);
+ if (confVar == null) {
+ throw new MetaException("Invalid configuration key " + key);
+ }
+ String validate = confVar.validate(value);
+ if (validate != null) {
+ throw new MetaException("Invalid configuration value " + value + " for key " + key +
+ " by " + validate);
+ }
+ Configuration configuration = getConf();
+ String oldValue = configuration.get(key);
+ configuration.set(key, value);
+
+ for (MetaStoreEventListener listener : listeners) {
+ listener.onConfigChange(new ConfigChangeEvent(this, key, oldValue, value));
+ }
+ }
+
+ @Override
+ public String getMetaConf(String key) throws MetaException {
+ ConfVars confVar = HiveConf.getMetaConf(key);
+ if (confVar == null) {
+ throw new MetaException("Invalid configuration key " + key);
+ }
+ return getConf().get(key);
+ }
+
/**
* Get a cached RawStore.
*
@@ -676,8 +710,11 @@ public class HiveMetaStore extends Thrif
logInfo("Shutting down the object store...");
RawStore ms = threadLocalMS.get();
if (ms != null) {
- ms.shutdown();
- threadLocalMS.remove();
+ try {
+ ms.shutdown();
+ } finally {
+ threadLocalMS.remove();
+ }
}
logInfo("Metastore shutdown complete.");
}
@@ -5002,9 +5039,13 @@ public class HiveMetaStore extends Thrif
}
public static IHMSHandler newHMSHandler(String name, HiveConf hiveConf) throws MetaException {
- return RetryingHMSHandler.getProxy(hiveConf, name);
+ return newHMSHandler(name, hiveConf, false);
}
+ public static IHMSHandler newHMSHandler(String name, HiveConf hiveConf, boolean local)
+ throws MetaException {
+ return RetryingHMSHandler.getProxy(hiveConf, name, local);
+ }
/**
* Discard a current delegation token.
Modified: hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
URL: http://svn.apache.org/viewvc/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java?rev=1617662&r1=1617661&r2=1617662&view=diff
==============================================================================
--- hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java (original)
+++ hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java Wed Aug 13 05:53:38 2014
@@ -173,7 +173,7 @@ public class HiveMetaStoreClient impleme
if (localMetaStore) {
// instantiate the metastore server handler directly instead of connecting
// through the network
- client = HiveMetaStore.newHMSHandler("hive client", conf);
+ client = HiveMetaStore.newHMSHandler("hive client", conf, true);
isConnected = true;
snapshotActiveConf();
return;
@@ -443,6 +443,16 @@ public class HiveMetaStoreClient impleme
}
}
+ @Override
+ public void setMetaConf(String key, String value) throws TException {
+ client.setMetaConf(key, value);
+ }
+
+ @Override
+ public String getMetaConf(String key) throws TException {
+ return client.getMetaConf(key);
+ }
+
/**
* @param new_part
* @return the added partition
Modified: hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/IHMSHandler.java
URL: http://svn.apache.org/viewvc/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/IHMSHandler.java?rev=1617662&r1=1617661&r2=1617662&view=diff
==============================================================================
--- hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/IHMSHandler.java (original)
+++ hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/IHMSHandler.java Wed Aug 13 05:53:38 2014
@@ -18,10 +18,11 @@
package org.apache.hadoop.hive.metastore;
-import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.conf.Configurable;
+import org.apache.hadoop.hive.metastore.api.MetaException;
import org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore;
-public interface IHMSHandler extends ThriftHiveMetastore.Iface {
+public interface IHMSHandler extends ThriftHiveMetastore.Iface, Configurable {
- public abstract void setConf(Configuration conf);
+ void init() throws MetaException;
}
Modified: hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java
URL: http://svn.apache.org/viewvc/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java?rev=1617662&r1=1617661&r2=1617662&view=diff
==============================================================================
--- hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java (original)
+++ hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java Wed Aug 13 05:53:38 2014
@@ -77,17 +77,30 @@ import org.apache.hadoop.hive.metastore.
public interface IMetaStoreClient {
/**
- * Returns whether current client is convertible with conf or not
+ * Returns whether current client is compatible with conf argument or not
* @return
*/
- public boolean isCompatibleWith(HiveConf conf);
+ boolean isCompatibleWith(HiveConf conf);
/**
* Tries to reconnect this MetaStoreClient to the MetaStore.
*/
- public void reconnect() throws MetaException;
+ void reconnect() throws MetaException;
- public void close();
+ /**
+ * close connection to meta store
+ */
+ void close();
+
+ /**
+ * set meta variable which is open to end users
+ */
+ void setMetaConf(String key, String value) throws MetaException, TException;
+
+ /**
+ * get current meta variable
+ */
+ String getMetaConf(String key) throws MetaException, TException;
/**
* Get the names of all databases in the MetaStore that match the given pattern.
@@ -96,8 +109,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public List<String> getDatabases(String databasePattern)
- throws MetaException, TException;
+ List<String> getDatabases(String databasePattern) throws MetaException, TException;
/**
* Get the names of all databases in the MetaStore.
@@ -105,8 +117,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public List<String> getAllDatabases()
- throws MetaException, TException;
+ List<String> getAllDatabases() throws MetaException, TException;
/**
* Get the names of all tables in the specified database that satisfy the supplied
@@ -118,7 +129,7 @@ public interface IMetaStoreClient {
* @throws TException
* @throws UnknownDBException
*/
- public List<String> getTables(String dbName, String tablePattern)
+ List<String> getTables(String dbName, String tablePattern)
throws MetaException, TException, UnknownDBException;
/**
@@ -129,8 +140,7 @@ public interface IMetaStoreClient {
* @throws TException
* @throws UnknownDBException
*/
- public List<String> getAllTables(String dbName)
- throws MetaException, TException, UnknownDBException;
+ List<String> getAllTables(String dbName) throws MetaException, TException, UnknownDBException;
/**
* Get a list of table names that match a filter.
@@ -168,7 +178,7 @@ public interface IMetaStoreClient {
* The maximum number of tables returned
* @return A list of table names that match the desired filter
*/
- public List<String> listTableNamesByFilter(String dbName, String filter, short maxTables)
+ List<String> listTableNamesByFilter(String dbName, String filter, short maxTables)
throws MetaException, TException, InvalidOperationException, UnknownDBException;
@@ -186,7 +196,7 @@ public interface IMetaStoreClient {
* @throws TException
* A thrift communication error occurred
*/
- public void dropTable(String dbname, String tableName, boolean deleteData,
+ void dropTable(String dbname, String tableName, boolean deleteData,
boolean ignoreUknownTab) throws MetaException, TException,
NoSuchObjectException;
@@ -210,14 +220,13 @@ public interface IMetaStoreClient {
* This method will be removed in release 0.7.0.
*/
@Deprecated
- public void dropTable(String tableName, boolean deleteData)
- throws MetaException, UnknownTableException, TException,
- NoSuchObjectException;
+ void dropTable(String tableName, boolean deleteData)
+ throws MetaException, UnknownTableException, TException, NoSuchObjectException;
- public void dropTable(String dbname, String tableName)
+ void dropTable(String dbname, String tableName)
throws MetaException, TException, NoSuchObjectException;
- public boolean tableExists(String databaseName, String tableName) throws MetaException,
+ boolean tableExists(String databaseName, String tableName) throws MetaException,
TException, UnknownDBException;
/**
@@ -231,7 +240,7 @@ public interface IMetaStoreClient {
* This method will be removed in release 0.7.0.
*/
@Deprecated
- public boolean tableExists(String tableName) throws MetaException,
+ boolean tableExists(String tableName) throws MetaException,
TException, UnknownDBException;
/**
@@ -250,8 +259,7 @@ public interface IMetaStoreClient {
* This method will be removed in release 0.7.0.
*/
@Deprecated
- public Table getTable(String tableName) throws MetaException, TException,
- NoSuchObjectException;
+ Table getTable(String tableName) throws MetaException, TException, NoSuchObjectException;
/**
* Get a Database Object
@@ -261,8 +269,8 @@ public interface IMetaStoreClient {
* @throws MetaException Could not fetch the database
* @throws TException A thrift communication error occurred
*/
- public Database getDatabase(String databaseName)
- throws NoSuchObjectException, MetaException, TException;
+ Database getDatabase(String databaseName)
+ throws NoSuchObjectException, MetaException, TException;
/**
@@ -280,7 +288,7 @@ public interface IMetaStoreClient {
* @throws NoSuchObjectException
* In case the table wasn't found.
*/
- public Table getTable(String dbName, String tableName) throws MetaException,
+ Table getTable(String dbName, String tableName) throws MetaException,
TException, NoSuchObjectException;
/**
@@ -302,7 +310,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* Any other errors
*/
- public List<Table> getTableObjectsByName(String dbName, List<String> tableNames)
+ List<Table> getTableObjectsByName(String dbName, List<String> tableNames)
throws MetaException, InvalidOperationException, UnknownDBException, TException;
/**
@@ -317,11 +325,11 @@ public interface IMetaStoreClient {
* @see org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore.Iface#append_partition(java.lang.String,
* java.lang.String, java.util.List)
*/
- public Partition appendPartition(String tableName, String dbName,
+ Partition appendPartition(String tableName, String dbName,
List<String> partVals) throws InvalidObjectException,
AlreadyExistsException, MetaException, TException;
- public Partition appendPartition(String tableName, String dbName, String name)
+ Partition appendPartition(String tableName, String dbName, String name)
throws InvalidObjectException, AlreadyExistsException, MetaException, TException;
/**
@@ -339,9 +347,8 @@ public interface IMetaStoreClient {
* @throws TException
* Thrift exception
*/
- public Partition add_partition(Partition partition)
- throws InvalidObjectException, AlreadyExistsException, MetaException,
- TException;
+ Partition add_partition(Partition partition)
+ throws InvalidObjectException, AlreadyExistsException, MetaException, TException;
/**
* Add partitions to the table.
@@ -357,7 +364,7 @@ public interface IMetaStoreClient {
* @throws TException
* Thrift exception
*/
- public int add_partitions(List<Partition> partitions)
+ int add_partitions(List<Partition> partitions)
throws InvalidObjectException, AlreadyExistsException, MetaException, TException;
/**
@@ -368,7 +375,7 @@ public interface IMetaStoreClient {
* @param needResults Whether the results are needed
* @return the partitions that were added, or null if !needResults
*/
- public List<Partition> add_partitions(
+ List<Partition> add_partitions(
List<Partition> partitions, boolean ifNotExists, boolean needResults)
throws InvalidObjectException, AlreadyExistsException, MetaException, TException;
@@ -382,7 +389,7 @@ public interface IMetaStoreClient {
* @see org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore.Iface#get_partition(java.lang.String,
* java.lang.String, java.util.List)
*/
- public Partition getPartition(String tblName, String dbName,
+ Partition getPartition(String tblName, String dbName,
List<String> partVals) throws NoSuchObjectException, MetaException, TException;
/**
@@ -393,7 +400,7 @@ public interface IMetaStoreClient {
* @param destTableName
* @return partition object
*/
- public Partition exchange_partition(Map<String, String> partitionSpecs,
+ Partition exchange_partition(Map<String, String> partitionSpecs,
String sourceDb, String sourceTable, String destdb,
String destTableName) throws MetaException, NoSuchObjectException,
InvalidObjectException, TException;
@@ -408,7 +415,7 @@ public interface IMetaStoreClient {
* @see org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore.Iface#get_partition(java.lang.String,
* java.lang.String, java.util.List)
*/
- public Partition getPartition(String dbName, String tblName,
+ Partition getPartition(String dbName, String tblName,
String name) throws MetaException, UnknownTableException, NoSuchObjectException, TException;
@@ -424,7 +431,7 @@ public interface IMetaStoreClient {
* @throws NoSuchObjectException
* @throws TException
*/
- public Partition getPartitionWithAuthInfo(String dbName, String tableName,
+ Partition getPartitionWithAuthInfo(String dbName, String tableName,
List<String> pvals, String userName, List<String> groupNames)
throws MetaException, UnknownTableException, NoSuchObjectException, TException;
@@ -437,16 +444,16 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public List<Partition> listPartitions(String db_name, String tbl_name,
+ List<Partition> listPartitions(String db_name, String tbl_name,
short max_parts) throws NoSuchObjectException, MetaException, TException;
- public List<Partition> listPartitions(String db_name, String tbl_name,
+ List<Partition> listPartitions(String db_name, String tbl_name,
List<String> part_vals, short max_parts) throws NoSuchObjectException, MetaException, TException;
- public List<String> listPartitionNames(String db_name, String tbl_name,
+ List<String> listPartitionNames(String db_name, String tbl_name,
short max_parts) throws MetaException, TException;
- public List<String> listPartitionNames(String db_name, String tbl_name,
+ List<String> listPartitionNames(String db_name, String tbl_name,
List<String> part_vals, short max_parts)
throws MetaException, TException, NoSuchObjectException;
@@ -464,7 +471,7 @@ public interface IMetaStoreClient {
* @throws NoSuchObjectException
* @throws TException
*/
- public List<Partition> listPartitionsByFilter(String db_name, String tbl_name,
+ List<Partition> listPartitionsByFilter(String db_name, String tbl_name,
String filter, short max_parts) throws MetaException,
NoSuchObjectException, TException;
@@ -481,7 +488,7 @@ public interface IMetaStoreClient {
* @param result the resulting list of partitions
* @return whether the resulting list contains partitions which may or may not match the expr
*/
- public boolean listPartitionsByExpr(String db_name, String tbl_name,
+ boolean listPartitionsByExpr(String db_name, String tbl_name,
byte[] expr, String default_partition_name, short max_parts, List<Partition> result)
throws TException;
@@ -494,7 +501,7 @@ public interface IMetaStoreClient {
* @return the list of partitions
* @throws NoSuchObjectException
*/
- public List<Partition> listPartitionsWithAuthInfo(String dbName,
+ List<Partition> listPartitionsWithAuthInfo(String dbName,
String tableName, short s, String userName, List<String> groupNames)
throws MetaException, TException, NoSuchObjectException;
@@ -508,7 +515,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public List<Partition> getPartitionsByNames(String db_name, String tbl_name,
+ List<Partition> getPartitionsByNames(String db_name, String tbl_name,
List<String> part_names) throws NoSuchObjectException, MetaException, TException;
/**
@@ -521,7 +528,7 @@ public interface IMetaStoreClient {
* @return the list of paritions
* @throws NoSuchObjectException
*/
- public List<Partition> listPartitionsWithAuthInfo(String dbName,
+ List<Partition> listPartitionsWithAuthInfo(String dbName,
String tableName, List<String> partialPvals, short s, String userName,
List<String> groupNames) throws MetaException, TException, NoSuchObjectException;
@@ -538,7 +545,7 @@ public interface IMetaStoreClient {
* @throws UnknownPartitionException
* @throws InvalidPartitionException
*/
- public void markPartitionForEvent(String db_name, String tbl_name, Map<String,String> partKVs,
+ void markPartitionForEvent(String db_name, String tbl_name, Map<String,String> partKVs,
PartitionEventType eventType) throws MetaException, NoSuchObjectException, TException,
UnknownTableException, UnknownDBException, UnknownPartitionException, InvalidPartitionException;
@@ -555,7 +562,7 @@ public interface IMetaStoreClient {
* @throws UnknownPartitionException
* @throws InvalidPartitionException
*/
- public boolean isPartitionMarkedForEvent(String db_name, String tbl_name, Map<String,String> partKVs,
+ boolean isPartitionMarkedForEvent(String db_name, String tbl_name, Map<String,String> partKVs,
PartitionEventType eventType) throws MetaException, NoSuchObjectException, TException,
UnknownTableException, UnknownDBException, UnknownPartitionException, InvalidPartitionException;
@@ -564,9 +571,7 @@ public interface IMetaStoreClient {
* @throws TException
* @throws MetaException
*/
- public void validatePartitionNameCharacters(List<String> partVals)
- throws TException, MetaException;
-
+ void validatePartitionNameCharacters(List<String> partVals) throws TException, MetaException;
/**
* @param tbl
@@ -578,25 +583,25 @@ public interface IMetaStoreClient {
* @see org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore.Iface#create_table(org.apache.hadoop.hive.metastore.api.Table)
*/
- public void createTable(Table tbl) throws AlreadyExistsException,
+ void createTable(Table tbl) throws AlreadyExistsException,
InvalidObjectException, MetaException, NoSuchObjectException, TException;
- public void alter_table(String defaultDatabaseName, String tblName,
+ void alter_table(String defaultDatabaseName, String tblName,
Table table) throws InvalidOperationException, MetaException, TException;
- public void createDatabase(Database db)
+ void createDatabase(Database db)
throws InvalidObjectException, AlreadyExistsException, MetaException, TException;
- public void dropDatabase(String name)
+ void dropDatabase(String name)
throws NoSuchObjectException, InvalidOperationException, MetaException, TException;
- public void dropDatabase(String name, boolean deleteData, boolean ignoreUnknownDb)
+ void dropDatabase(String name, boolean deleteData, boolean ignoreUnknownDb)
throws NoSuchObjectException, InvalidOperationException, MetaException, TException;
- public void dropDatabase(String name, boolean deleteData, boolean ignoreUnknownDb, boolean cascade)
+ void dropDatabase(String name, boolean deleteData, boolean ignoreUnknownDb, boolean cascade)
throws NoSuchObjectException, InvalidOperationException, MetaException, TException;
- public void alterDatabase(String name, Database db)
+ void alterDatabase(String name, Database db)
throws NoSuchObjectException, MetaException, TException;
/**
@@ -612,7 +617,7 @@ public interface IMetaStoreClient {
* @see org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore.Iface#drop_partition(java.lang.String,
* java.lang.String, java.util.List, boolean)
*/
- public boolean dropPartition(String db_name, String tbl_name,
+ boolean dropPartition(String db_name, String tbl_name,
List<String> part_vals, boolean deleteData) throws NoSuchObjectException,
MetaException, TException;
@@ -620,7 +625,7 @@ public interface IMetaStoreClient {
List<ObjectPair<Integer, byte[]>> partExprs, boolean deleteData, boolean ignoreProtection,
boolean ifExists) throws NoSuchObjectException, MetaException, TException;
- public boolean dropPartition(String db_name, String tbl_name,
+ boolean dropPartition(String db_name, String tbl_name,
String name, boolean deleteData) throws NoSuchObjectException,
MetaException, TException;
/**
@@ -639,7 +644,7 @@ public interface IMetaStoreClient {
* @throws TException
* if error in communicating with metastore server
*/
- public void alter_partition(String dbName, String tblName, Partition newPart)
+ void alter_partition(String dbName, String tblName, Partition newPart)
throws InvalidOperationException, MetaException, TException;
/**
@@ -658,7 +663,7 @@ public interface IMetaStoreClient {
* @throws TException
* if error in communicating with metastore server
*/
- public void alter_partitions(String dbName, String tblName, List<Partition> newParts)
+ void alter_partitions(String dbName, String tblName, List<Partition> newParts)
throws InvalidOperationException, MetaException, TException;
/**
@@ -679,7 +684,7 @@ public interface IMetaStoreClient {
* @throws TException
* if error in communicating with metastore server
*/
- public void renamePartition(final String dbname, final String name, final List<String> part_vals, final Partition newPart)
+ void renamePartition(final String dbname, final String name, final List<String> part_vals, final Partition newPart)
throws InvalidOperationException, MetaException, TException;
/**
@@ -692,7 +697,7 @@ public interface IMetaStoreClient {
* @see org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore.Iface#get_fields(java.lang.String,
* java.lang.String)
*/
- public List<FieldSchema> getFields(String db, String tableName)
+ List<FieldSchema> getFields(String db, String tableName)
throws MetaException, TException, UnknownTableException,
UnknownDBException;
@@ -706,7 +711,7 @@ public interface IMetaStoreClient {
* @see org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore.Iface#get_schema(java.lang.String,
* java.lang.String)
*/
- public List<FieldSchema> getSchema(String db, String tableName)
+ List<FieldSchema> getSchema(String db, String tableName)
throws MetaException, TException, UnknownTableException,
UnknownDBException;
@@ -719,7 +724,7 @@ public interface IMetaStoreClient {
* @throws TException
* @throws ConfigValSecurityException
*/
- public String getConfigValue(String name, String defaultValue)
+ String getConfigValue(String name, String defaultValue)
throws TException, ConfigValSecurityException;
/**
@@ -730,7 +735,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public List<String> partitionNameToVals(String name)
+ List<String> partitionNameToVals(String name)
throws MetaException, TException;
/**
*
@@ -740,7 +745,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public Map<String, String> partitionNameToSpec(String name)
+ Map<String, String> partitionNameToSpec(String name)
throws MetaException, TException;
/**
@@ -752,10 +757,10 @@ public interface IMetaStoreClient {
* @throws TException
* @throws AlreadyExistsException
*/
- public void createIndex(Index index, Table indexTable) throws InvalidObjectException,
+ void createIndex(Index index, Table indexTable) throws InvalidObjectException,
MetaException, NoSuchObjectException, TException, AlreadyExistsException;
- public void alter_index(String dbName, String tblName, String indexName,
+ void alter_index(String dbName, String tblName, String indexName,
Index index) throws InvalidOperationException, MetaException, TException;
/**
@@ -769,7 +774,7 @@ public interface IMetaStoreClient {
* @throws NoSuchObjectException
* @throws TException
*/
- public Index getIndex(String dbName, String tblName, String indexName)
+ Index getIndex(String dbName, String tblName, String indexName)
throws MetaException, UnknownTableException, NoSuchObjectException,
TException;
@@ -784,7 +789,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public List<Index> listIndexes(String db_name, String tbl_name,
+ List<Index> listIndexes(String db_name, String tbl_name,
short max) throws NoSuchObjectException, MetaException, TException;
/**
@@ -797,7 +802,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public List<String> listIndexNames(String db_name, String tbl_name,
+ List<String> listIndexNames(String db_name, String tbl_name,
short max) throws MetaException, TException;
/**
@@ -810,7 +815,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public boolean dropIndex(String db_name, String tbl_name,
+ boolean dropIndex(String db_name, String tbl_name,
String name, boolean deleteData) throws NoSuchObjectException,
MetaException, TException;
@@ -825,7 +830,7 @@ public interface IMetaStoreClient {
* @throws InvalidInputException
*/
- public boolean updateTableColumnStatistics(ColumnStatistics statsObj)
+ boolean updateTableColumnStatistics(ColumnStatistics statsObj)
throws NoSuchObjectException, InvalidObjectException, MetaException, TException,
InvalidInputException;
@@ -840,7 +845,7 @@ public interface IMetaStoreClient {
* @throws InvalidInputException
*/
- public boolean updatePartitionColumnStatistics(ColumnStatistics statsObj)
+ boolean updatePartitionColumnStatistics(ColumnStatistics statsObj)
throws NoSuchObjectException, InvalidObjectException, MetaException, TException,
InvalidInputException;
@@ -848,14 +853,14 @@ public interface IMetaStoreClient {
* Get table column statistics given dbName, tableName and multiple colName-s
* @return ColumnStatistics struct for a given db, table and columns
*/
- public List<ColumnStatisticsObj> getTableColumnStatistics(String dbName, String tableName,
+ List<ColumnStatisticsObj> getTableColumnStatistics(String dbName, String tableName,
List<String> colNames) throws NoSuchObjectException, MetaException, TException;
/**
* Get partitions column statistics given dbName, tableName, multiple partitions and colName-s
* @return ColumnStatistics struct for a given db, table and columns
*/
- public Map<String, List<ColumnStatisticsObj>> getPartitionColumnStatistics(String dbName,
+ Map<String, List<ColumnStatisticsObj>> getPartitionColumnStatistics(String dbName,
String tableName, List<String> partNames, List<String> colNames)
throws NoSuchObjectException, MetaException, TException;
@@ -873,24 +878,23 @@ public interface IMetaStoreClient {
* @throws InvalidInputException
*/
- public boolean deletePartitionColumnStatistics(String dbName, String tableName,
+ boolean deletePartitionColumnStatistics(String dbName, String tableName,
String partName, String colName) throws NoSuchObjectException, MetaException,
InvalidObjectException, TException, InvalidInputException;
- /**
- * Delete table level column statistics given dbName, tableName and colName
- * @param dbName
- * @param tableName
- * @param colName
- * @return boolean indicating the outcome of the operation
- * @throws NoSuchObjectException
- * @throws MetaException
- * @throws InvalidObjectException
- * @throws TException
- * @throws InvalidInputException
- */
-
- public boolean deleteTableColumnStatistics(String dbName, String tableName, String colName) throws
+ /**
+ * Delete table level column statistics given dbName, tableName and colName
+ * @param dbName
+ * @param tableName
+ * @param colName
+ * @return boolean indicating the outcome of the operation
+ * @throws NoSuchObjectException
+ * @throws MetaException
+ * @throws InvalidObjectException
+ * @throws TException
+ * @throws InvalidInputException
+ */
+ boolean deleteTableColumnStatistics(String dbName, String tableName, String colName) throws
NoSuchObjectException, MetaException, InvalidObjectException, TException, InvalidInputException;
/**
@@ -900,7 +904,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public boolean create_role(Role role)
+ boolean create_role(Role role)
throws MetaException, TException;
/**
@@ -911,7 +915,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public boolean drop_role(String role_name) throws MetaException, TException;
+ boolean drop_role(String role_name) throws MetaException, TException;
/**
* list all role names
@@ -919,7 +923,7 @@ public interface IMetaStoreClient {
* @throws TException
* @throws MetaException
*/
- public List<String> listRoleNames() throws MetaException, TException;
+ List<String> listRoleNames() throws MetaException, TException;
/**
*
@@ -933,7 +937,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public boolean grant_role(String role_name, String user_name,
+ boolean grant_role(String role_name, String user_name,
PrincipalType principalType, String grantor, PrincipalType grantorType,
boolean grantOption) throws MetaException, TException;
@@ -948,7 +952,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public boolean revoke_role(String role_name, String user_name,
+ boolean revoke_role(String role_name, String user_name,
PrincipalType principalType, boolean grantOption) throws MetaException, TException;
/**
@@ -959,7 +963,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public List<Role> list_roles(String principalName, PrincipalType principalType)
+ List<Role> list_roles(String principalName, PrincipalType principalType)
throws MetaException, TException;
/**
@@ -972,7 +976,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public PrincipalPrivilegeSet get_privilege_set(HiveObjectRef hiveObject,
+ PrincipalPrivilegeSet get_privilege_set(HiveObjectRef hiveObject,
String user_name, List<String> group_names) throws MetaException,
TException;
@@ -985,7 +989,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public List<HiveObjectPrivilege> list_privileges(String principal_name,
+ List<HiveObjectPrivilege> list_privileges(String principal_name,
PrincipalType principal_type, HiveObjectRef hiveObject)
throws MetaException, TException;
@@ -995,7 +999,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public boolean grant_privileges(PrivilegeBag privileges)
+ boolean grant_privileges(PrivilegeBag privileges)
throws MetaException, TException;
/**
@@ -1004,7 +1008,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public boolean revoke_privileges(PrivilegeBag privileges, boolean grantOption)
+ boolean revoke_privileges(PrivilegeBag privileges, boolean grantOption)
throws MetaException, TException;
/**
@@ -1014,7 +1018,7 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public String getDelegationToken(String owner, String renewerKerberosPrincipalName)
+ String getDelegationToken(String owner, String renewerKerberosPrincipalName)
throws MetaException, TException;
/**
@@ -1023,28 +1027,28 @@ public interface IMetaStoreClient {
* @throws MetaException
* @throws TException
*/
- public long renewDelegationToken(String tokenStrForm) throws MetaException, TException;
+ long renewDelegationToken(String tokenStrForm) throws MetaException, TException;
/**
* @param tokenStrForm
* @throws MetaException
* @throws TException
*/
- public void cancelDelegationToken(String tokenStrForm) throws MetaException, TException;
+ void cancelDelegationToken(String tokenStrForm) throws MetaException, TException;
- public void createFunction(Function func)
+ void createFunction(Function func)
throws InvalidObjectException, MetaException, TException;
- public void alterFunction(String dbName, String funcName, Function newFunction)
+ void alterFunction(String dbName, String funcName, Function newFunction)
throws InvalidObjectException, MetaException, TException;
- public void dropFunction(String dbName, String funcName) throws MetaException,
+ void dropFunction(String dbName, String funcName) throws MetaException,
NoSuchObjectException, InvalidObjectException, InvalidInputException, TException;
- public Function getFunction(String dbName, String funcName)
+ Function getFunction(String dbName, String funcName)
throws MetaException, TException;
- public List<String> getFunctions(String dbName, String pattern)
+ List<String> getFunctions(String dbName, String pattern)
throws MetaException, TException;
/**
@@ -1052,7 +1056,7 @@ public interface IMetaStoreClient {
* @return list of valid transactions
* @throws TException
*/
- public ValidTxnList getValidTxns() throws TException;
+ ValidTxnList getValidTxns() throws TException;
/**
* Initiate a transaction.
@@ -1062,7 +1066,7 @@ public interface IMetaStoreClient {
* @return transaction identifier
* @throws TException
*/
- public long openTxn(String user) throws TException;
+ long openTxn(String user) throws TException;
/**
* Initiate a batch of transactions. It is not guaranteed that the
@@ -1089,7 +1093,7 @@ public interface IMetaStoreClient {
* optimistically assuming that the result matches the request.
* @throws TException
*/
- public OpenTxnsResponse openTxns(String user, int numTxns) throws TException;
+ OpenTxnsResponse openTxns(String user, int numTxns) throws TException;
/**
* Rollback a transaction. This will also unlock any locks associated with
@@ -1100,7 +1104,7 @@ public interface IMetaStoreClient {
* deleted.
* @throws TException
*/
- public void rollbackTxn(long txnid) throws NoSuchTxnException, TException;
+ void rollbackTxn(long txnid) throws NoSuchTxnException, TException;
/**
* Commit a transaction. This will also unlock any locks associated with
@@ -1113,7 +1117,7 @@ public interface IMetaStoreClient {
* aborted. This can result from the transaction timing out.
* @throws TException
*/
- public void commitTxn(long txnid)
+ void commitTxn(long txnid)
throws NoSuchTxnException, TxnAbortedException, TException;
/**
@@ -1123,7 +1127,7 @@ public interface IMetaStoreClient {
* @return List of currently opened transactions, included aborted ones.
* @throws TException
*/
- public GetOpenTxnsInfoResponse showTxns() throws TException;
+ GetOpenTxnsInfoResponse showTxns() throws TException;
/**
* Request a set of locks. All locks needed for a particular query, DML,
@@ -1153,7 +1157,7 @@ public interface IMetaStoreClient {
* aborted. This can result from the transaction timing out.
* @throws TException
*/
- public LockResponse lock(LockRequest request)
+ LockResponse lock(LockRequest request)
throws NoSuchTxnException, TxnAbortedException, TException;
/**
@@ -1177,7 +1181,7 @@ public interface IMetaStoreClient {
* This can result from the lock timing out and being unlocked by the system.
* @throws TException
*/
- public LockResponse checkLock(long lockid)
+ LockResponse checkLock(long lockid)
throws NoSuchTxnException, TxnAbortedException, NoSuchLockException,
TException;
@@ -1192,7 +1196,7 @@ public interface IMetaStoreClient {
* transaction.
* @throws TException
*/
- public void unlock(long lockid)
+ void unlock(long lockid)
throws NoSuchLockException, TxnOpenException, TException;
/**
@@ -1200,7 +1204,7 @@ public interface IMetaStoreClient {
* @return List of currently held and waiting locks.
* @throws TException
*/
- public ShowLocksResponse showLocks() throws TException;
+ ShowLocksResponse showLocks() throws TException;
/**
* Send a heartbeat to indicate that the client holding these locks (if
@@ -1222,7 +1226,7 @@ public interface IMetaStoreClient {
* This can result from the lock timing out and being unlocked by the system.
* @throws TException
*/
- public void heartbeat(long txnid, long lockid)
+ void heartbeat(long txnid, long lockid)
throws NoSuchLockException, NoSuchTxnException, TxnAbortedException,
TException;
@@ -1236,7 +1240,7 @@ public interface IMetaStoreClient {
* have already been closed) and which were aborted.
* @throws TException
*/
- public HeartbeatTxnRangeResponse heartbeatTxnRange(long min, long max) throws TException;
+ HeartbeatTxnRangeResponse heartbeatTxnRange(long min, long max) throws TException;
/**
* Send a request to compact a table or partition. This will not block until the compaction is
@@ -1251,7 +1255,7 @@ public interface IMetaStoreClient {
* @param type Whether this is a major or minor compaction.
* @throws TException
*/
- public void compact(String dbname, String tableName, String partitionName, CompactionType type)
+ void compact(String dbname, String tableName, String partitionName, CompactionType type)
throws TException;
/**
@@ -1260,10 +1264,10 @@ public interface IMetaStoreClient {
* in progress, and finished but waiting to clean the existing files.
* @throws TException
*/
- public ShowCompactResponse showCompactions() throws TException;
+ ShowCompactResponse showCompactions() throws TException;
- public class IncompatibleMetastoreException extends MetaException {
- public IncompatibleMetastoreException(String message) {
+ class IncompatibleMetastoreException extends MetaException {
+ IncompatibleMetastoreException(String message) {
super(message);
}
}
Modified: hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreEventListener.java
URL: http://svn.apache.org/viewvc/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreEventListener.java?rev=1617662&r1=1617661&r2=1617662&view=diff
==============================================================================
--- hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreEventListener.java (original)
+++ hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreEventListener.java Wed Aug 13 05:53:38 2014
@@ -24,6 +24,7 @@ import org.apache.hadoop.hive.metastore.
import org.apache.hadoop.hive.metastore.events.AddPartitionEvent;
import org.apache.hadoop.hive.metastore.events.AlterPartitionEvent;
import org.apache.hadoop.hive.metastore.events.AlterTableEvent;
+import org.apache.hadoop.hive.metastore.events.ConfigChangeEvent;
import org.apache.hadoop.hive.metastore.events.CreateDatabaseEvent;
import org.apache.hadoop.hive.metastore.events.CreateTableEvent;
import org.apache.hadoop.hive.metastore.events.DropDatabaseEvent;
@@ -50,6 +51,13 @@ public abstract class MetaStoreEventList
* @param tableEvent table event.
* @throws MetaException
*/
+ public void onConfigChange(ConfigChangeEvent tableEvent) throws MetaException {
+ }
+
+ /**
+ * @param tableEvent table event.
+ * @throws MetaException
+ */
public void onCreateTable (CreateTableEvent tableEvent) throws MetaException {
}
Modified: hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/RetryingHMSHandler.java
URL: http://svn.apache.org/viewvc/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/RetryingHMSHandler.java?rev=1617662&r1=1617661&r2=1617662&view=diff
==============================================================================
--- hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/RetryingHMSHandler.java (original)
+++ hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/RetryingHMSHandler.java Wed Aug 13 05:53:38 2014
@@ -43,44 +43,40 @@ public class RetryingHMSHandler implemen
private final IHMSHandler base;
private final MetaStoreInit.MetaStoreInitData metaStoreInitData =
new MetaStoreInit.MetaStoreInitData();
- private final HiveConf hiveConf;
- protected RetryingHMSHandler(final HiveConf hiveConf, final String name) throws MetaException {
+ private final HiveConf hiveConf; // base configuration
+ private final Configuration configuration; // active configuration
+
+ private RetryingHMSHandler(HiveConf hiveConf, String name, boolean local) throws MetaException {
this.hiveConf = hiveConf;
+ this.base = new HiveMetaStore.HMSHandler(name, hiveConf, false);
+ if (local) {
+ base.setConf(hiveConf); // tests expect configuration changes applied directly to metastore
+ }
+ configuration = base.getConf();
// This has to be called before initializing the instance of HMSHandler
- init();
+ // Using the hook on startup ensures that the hook always has priority
+ // over settings in *.xml. The thread local conf needs to be used because at this point
+ // it has already been initialized using hiveConf.
+ MetaStoreInit.updateConnectionURL(hiveConf, getConf(), null, metaStoreInitData);
- this.base = new HiveMetaStore.HMSHandler(name, hiveConf);
+ base.init();
}
- public static IHMSHandler getProxy(HiveConf hiveConf, String name) throws MetaException {
+ public static IHMSHandler getProxy(HiveConf hiveConf, String name, boolean local)
+ throws MetaException {
- RetryingHMSHandler handler = new RetryingHMSHandler(hiveConf, name);
+ RetryingHMSHandler handler = new RetryingHMSHandler(hiveConf, name, local);
return (IHMSHandler) Proxy.newProxyInstance(
RetryingHMSHandler.class.getClassLoader(),
new Class[] { IHMSHandler.class }, handler);
}
- private void init() throws MetaException {
- // Using the hook on startup ensures that the hook always has priority
- // over settings in *.xml. The thread local conf needs to be used because at this point
- // it has already been initialized using hiveConf.
- MetaStoreInit.updateConnectionURL(hiveConf, getConf(), null, metaStoreInitData);
-
- }
-
- private void initMS() {
- base.setConf(getConf());
- }
-
-
@Override
public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
- Object ret = null;
-
boolean gotNewConnectUrl = false;
boolean reloadConf = HiveConf.getBoolVar(hiveConf,
HiveConf.ConfVars.HMSHANDLERFORCERELOADCONF);
@@ -95,15 +91,14 @@ public class RetryingHMSHandler implemen
}
int retryCount = 0;
- // Exception caughtException = null;
Throwable caughtException = null;
while (true) {
try {
if (reloadConf || gotNewConnectUrl) {
- initMS();
+ base.setConf(getConf());
}
- ret = method.invoke(base, args);
- break;
+ return method.invoke(base, args);
+
} catch (javax.jdo.JDOException e) {
caughtException = e;
} catch (UndeclaredThrowableException e) {
@@ -166,10 +161,9 @@ public class RetryingHMSHandler implemen
gotNewConnectUrl = MetaStoreInit.updateConnectionURL(hiveConf, getConf(),
lastUrl, metaStoreInitData);
}
- return ret;
}
public Configuration getConf() {
- return hiveConf;
+ return configuration;
}
}
Added: hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/events/ConfigChangeEvent.java
URL: http://svn.apache.org/viewvc/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/events/ConfigChangeEvent.java?rev=1617662&view=auto
==============================================================================
--- hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/events/ConfigChangeEvent.java (added)
+++ hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/events/ConfigChangeEvent.java Wed Aug 13 05:53:38 2014
@@ -0,0 +1,48 @@
+/**
+ * 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.events;
+
+import org.apache.hadoop.hive.metastore.HiveMetaStore;
+
+public class ConfigChangeEvent extends ListenerEvent {
+
+ private final String key;
+ private final String oldValue;
+ private final String newValue;
+
+ public ConfigChangeEvent(HiveMetaStore.HMSHandler handler, String key,
+ String oldValue, String newValue) {
+ super(true, handler);
+ this.key = key;
+ this.oldValue = oldValue;
+ this.newValue = newValue;
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ public String getOldValue() {
+ return oldValue;
+ }
+
+ public String getNewValue() {
+ return newValue;
+ }
+}
Modified: hive/trunk/metastore/src/test/org/apache/hadoop/hive/metastore/DummyListener.java
URL: http://svn.apache.org/viewvc/hive/trunk/metastore/src/test/org/apache/hadoop/hive/metastore/DummyListener.java?rev=1617662&r1=1617661&r2=1617662&view=diff
==============================================================================
--- hive/trunk/metastore/src/test/org/apache/hadoop/hive/metastore/DummyListener.java (original)
+++ hive/trunk/metastore/src/test/org/apache/hadoop/hive/metastore/DummyListener.java Wed Aug 13 05:53:38 2014
@@ -26,6 +26,7 @@ import org.apache.hadoop.hive.metastore.
import org.apache.hadoop.hive.metastore.events.AddPartitionEvent;
import org.apache.hadoop.hive.metastore.events.AlterPartitionEvent;
import org.apache.hadoop.hive.metastore.events.AlterTableEvent;
+import org.apache.hadoop.hive.metastore.events.ConfigChangeEvent;
import org.apache.hadoop.hive.metastore.events.CreateDatabaseEvent;
import org.apache.hadoop.hive.metastore.events.CreateTableEvent;
import org.apache.hadoop.hive.metastore.events.DropDatabaseEvent;
@@ -58,6 +59,11 @@ public class DummyListener extends MetaS
}
@Override
+ public void onConfigChange(ConfigChangeEvent configChange) {
+ notifyList.add(configChange);
+ }
+
+ @Override
public void onAddPartition(AddPartitionEvent partition) throws MetaException {
notifyList.add(partition);
}
Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java?rev=1617662&r1=1617661&r2=1617662&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java Wed Aug 13 05:53:38 2014
@@ -2716,4 +2716,19 @@ private void constructOneLBLocationMap(F
}
}
+ public void setMetaConf(String propName, String propValue) throws HiveException {
+ try {
+ getMSC().setMetaConf(propName, propValue);
+ } catch (TException te) {
+ throw new HiveException(te);
+ }
+ }
+
+ public String getMetaConf(String propName) throws HiveException {
+ try {
+ return getMSC().getMetaConf(propName);
+ } catch (TException te) {
+ throw new HiveException(te);
+ }
+ }
};
Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/processors/SetProcessor.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/processors/SetProcessor.java?rev=1617662&r1=1617661&r2=1617662&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/processors/SetProcessor.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/processors/SetProcessor.java Wed Aug 13 05:53:38 2014
@@ -32,6 +32,7 @@ import java.util.TreeMap;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.hive.metastore.api.FieldSchema;
import org.apache.hadoop.hive.metastore.api.Schema;
+import org.apache.hadoop.hive.ql.metadata.Hive;
import org.apache.hadoop.hive.ql.parse.VariableSubstitution;
import org.apache.hadoop.hive.ql.session.SessionState;
@@ -104,11 +105,12 @@ public class SetProcessor implements Com
try {
return new CommandProcessorResponse(setVariable(varname, varvalue));
} catch (Exception e) {
- return new CommandProcessorResponse(1, e.getMessage(), "42000");
+ return new CommandProcessorResponse(1, e.getMessage(), "42000",
+ e instanceof IllegalArgumentException ? null : e);
}
}
- public static int setVariable(String varname, String varvalue) throws IllegalArgumentException {
+ public static int setVariable(String varname, String varvalue) throws Exception {
SessionState ss = SessionState.get();
if (varvalue.contains("\n")){
ss.err.println("Warning: Value had a \\n character in it.");
@@ -126,6 +128,10 @@ public class SetProcessor implements Com
} else if (varname.startsWith(HIVEVAR_PREFIX)) {
String propName = varname.substring(HIVEVAR_PREFIX.length());
ss.getHiveVariables().put(propName, new VariableSubstitution().substitute(ss.getConf(),varvalue));
+ } else if (varname.startsWith(METACONF_PREFIX)) {
+ String propName = varname.substring(METACONF_PREFIX.length());
+ Hive hive = Hive.get(ss.getConf());
+ hive.setMetaConf(propName, new VariableSubstitution().substitute(ss.getConf(), varvalue));
} else {
setConf(varname, varname, varvalue, true);
}
@@ -178,8 +184,7 @@ public class SetProcessor implements Com
return sortedEnvMap;
}
-
- private CommandProcessorResponse getVariable(String varname) {
+ private CommandProcessorResponse getVariable(String varname) throws Exception {
SessionState ss = SessionState.get();
if (varname.equals("silent")){
ss.out.println("silent" + "=" + ss.getIsSilent());
@@ -222,6 +227,17 @@ public class SetProcessor implements Com
ss.out.println(varname + " is undefined as a hive variable");
return new CommandProcessorResponse(1);
}
+ } else if (varname.indexOf(METACONF_PREFIX) == 0) {
+ String var = varname.substring(METACONF_PREFIX.length());
+ Hive hive = Hive.get(ss.getConf());
+ String value = hive.getMetaConf(var);
+ if (value != null) {
+ ss.out.println(METACONF_PREFIX + var + "=" + value);
+ return createProcessorSuccessResponse();
+ } else {
+ ss.out.println(varname + " is undefined as a hive meta variable");
+ return new CommandProcessorResponse(1);
+ }
} else {
dumpOption(varname);
return createProcessorSuccessResponse();
@@ -263,10 +279,12 @@ public class SetProcessor implements Com
return new CommandProcessorResponse(0);
}
return executeSetVariable(part[0],part[1]);
- } else {
+ }
+ try {
return getVariable(nwcmd);
+ } catch (Exception e) {
+ return new CommandProcessorResponse(1, e.getMessage(), "42000", e);
}
-
}
// create a Schema object containing the give column
Added: hive/trunk/ql/src/test/queries/clientpositive/set_metaconf.q
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/queries/clientpositive/set_metaconf.q?rev=1617662&view=auto
==============================================================================
--- hive/trunk/ql/src/test/queries/clientpositive/set_metaconf.q (added)
+++ hive/trunk/ql/src/test/queries/clientpositive/set_metaconf.q Wed Aug 13 05:53:38 2014
@@ -0,0 +1,5 @@
+set metaconf:hive.metastore.try.direct.sql;
+
+set metaconf:hive.metastore.try.direct.sql=false;
+set metaconf:hive.metastore.try.direct.sql;
+set hive.metastore.try.direct.sql;
Added: hive/trunk/ql/src/test/results/clientpositive/set_metaconf.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/set_metaconf.q.out?rev=1617662&view=auto
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/set_metaconf.q.out (added)
+++ hive/trunk/ql/src/test/results/clientpositive/set_metaconf.q.out Wed Aug 13 05:53:38 2014
@@ -0,0 +1,3 @@
+metaconf:hive.metastore.try.direct.sql=true
+metaconf:hive.metastore.try.direct.sql=false
+hive.metastore.try.direct.sql=true
Modified: hive/trunk/service/src/java/org/apache/hive/service/cli/session/HiveSessionBase.java
URL: http://svn.apache.org/viewvc/hive/trunk/service/src/java/org/apache/hive/service/cli/session/HiveSessionBase.java?rev=1617662&r1=1617661&r2=1617662&view=diff
==============================================================================
--- hive/trunk/service/src/java/org/apache/hive/service/cli/session/HiveSessionBase.java (original)
+++ hive/trunk/service/src/java/org/apache/hive/service/cli/session/HiveSessionBase.java Wed Aug 13 05:53:38 2014
@@ -55,7 +55,7 @@ public interface HiveSessionBase {
* Initialize the session
* @param sessionConfMap
*/
- public void initialize(Map<String, String> sessionConfMap);
+ public void initialize(Map<String, String> sessionConfMap) throws Exception;
public SessionHandle getSessionHandle();
Modified: hive/trunk/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java
URL: http://svn.apache.org/viewvc/hive/trunk/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java?rev=1617662&r1=1617661&r2=1617662&view=diff
==============================================================================
--- hive/trunk/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java (original)
+++ hive/trunk/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java Wed Aug 13 05:53:38 2014
@@ -110,7 +110,7 @@ public class HiveSessionImpl implements
}
@Override
- public void initialize(Map<String, String> sessionConfMap) {
+ public void initialize(Map<String, String> sessionConfMap) throws Exception {
//process global init file: .hiverc
processGlobalInitFile();
SessionState.setCurrentSessionState(sessionState);
@@ -168,7 +168,7 @@ public class HiveSessionImpl implements
}
}
- private void configureSession(Map<String, String> sessionConfMap) {
+ private void configureSession(Map<String, String> sessionConfMap) throws Exception {
for (Map.Entry<String, String> entry : sessionConfMap.entrySet()) {
String key = entry.getKey();
if (key.startsWith("set:")) {
Modified: hive/trunk/service/src/java/org/apache/hive/service/cli/session/SessionManager.java
URL: http://svn.apache.org/viewvc/hive/trunk/service/src/java/org/apache/hive/service/cli/session/SessionManager.java?rev=1617662&r1=1617661&r2=1617662&view=diff
==============================================================================
--- hive/trunk/service/src/java/org/apache/hive/service/cli/session/SessionManager.java (original)
+++ hive/trunk/service/src/java/org/apache/hive/service/cli/session/SessionManager.java Wed Aug 13 05:53:38 2014
@@ -34,7 +34,6 @@ import org.apache.hadoop.hive.ql.hooks.H
import org.apache.hadoop.hive.ql.metadata.HiveException;
import org.apache.hadoop.hive.ql.session.SessionState;
import org.apache.hive.service.CompositeService;
-import org.apache.hive.service.auth.TSetIpAddressProcessor;
import org.apache.hive.service.cli.HiveSQLException;
import org.apache.hive.service.cli.SessionHandle;
import org.apache.hive.service.cli.operation.OperationManager;
@@ -131,15 +130,20 @@ public class SessionManager extends Comp
}
session.setSessionManager(this);
session.setOperationManager(operationManager);
- session.initialize(sessionConf);
- session.open();
- handleToSession.put(session.getSessionHandle(), session);
-
+ try {
+ session.initialize(sessionConf);
+ session.open();
+ } catch (Exception e) {
+ throw new HiveSQLException("Failed to open new session", e);
+ }
try {
executeSessionHooks(session);
} catch (Exception e) {
throw new HiveSQLException("Failed to execute session hooks", e);
}
+
+ handleToSession.put(session.getSessionHandle(), session);
+
return session.getSessionHandle();
}