public class MetaStoreSchemaInfo extends Object implements IMetaStoreSchemaInfo
Modifier and Type | Field and Description |
---|---|
protected static String |
CREATE_USER_PREFIX |
protected String |
dbType |
protected static String |
INIT_FILE_PREFIX |
protected static String |
PRE_UPGRADE_PREFIX |
protected static String |
UPGRADE_FILE_PREFIX |
protected static String |
VERSION_UPGRADE_LIST |
SQL_FILE_EXTENSION
Constructor and Description |
---|
MetaStoreSchemaInfo(String metastoreHome,
String dbType) |
Modifier and Type | Method and Description |
---|---|
String |
generateInitFileName(String toVersion)
Get the name of the script to initialize the schema for given version
|
String |
getCreateUserScript()
Get SQL script that will create the user and database for Metastore to use.
|
String |
getHiveSchemaVersion()
Get hive distribution schema version.
|
String |
getMetaStoreSchemaVersion(HiveSchemaHelper.MetaStoreConnectionInfo connectionInfo)
Get the schema version from the backend database.
|
String |
getMetaStoreScriptDir()
Find the directory of metastore scripts
|
String |
getPreUpgradeScriptName(int index,
String upgradeScriptName)
Get the pre-upgrade script for a given script name.
|
List<String> |
getUpgradeScripts(String fromVersion)
Get the list of sql scripts required to upgrade from the give version to current
|
boolean |
isVersionCompatible(String hiveVersion,
String dbVersion)
A dbVersion is compatible with hive version if it is greater or equal to the hive version.
|
protected static final String UPGRADE_FILE_PREFIX
protected static final String INIT_FILE_PREFIX
protected static final String VERSION_UPGRADE_LIST
protected static final String PRE_UPGRADE_PREFIX
protected static final String CREATE_USER_PREFIX
protected final String dbType
public MetaStoreSchemaInfo(String metastoreHome, String dbType) throws HiveMetaException
HiveMetaException
public List<String> getUpgradeScripts(String fromVersion) throws HiveMetaException
getUpgradeScripts
in interface IMetaStoreSchemaInfo
fromVersion
- HiveMetaException
public String generateInitFileName(String toVersion) throws HiveMetaException
generateInitFileName
in interface IMetaStoreSchemaInfo
toVersion
- Target version. If it's null, then the current server version is usedHiveMetaException
public String getCreateUserScript() throws HiveMetaException
IMetaStoreSchemaInfo
getCreateUserScript
in interface IMetaStoreSchemaInfo
HiveMetaException
- if something goes wrong.public String getMetaStoreScriptDir()
getMetaStoreScriptDir
in interface IMetaStoreSchemaInfo
public String getPreUpgradeScriptName(int index, String upgradeScriptName)
IMetaStoreSchemaInfo
getPreUpgradeScriptName
in interface IMetaStoreSchemaInfo
index
- - index number of the file. The preupgrade script name is derived using the given
indexupgradeScriptName
- - upgrade script namepublic String getHiveSchemaVersion()
IMetaStoreSchemaInfo
getHiveSchemaVersion
in interface IMetaStoreSchemaInfo
public boolean isVersionCompatible(String hiveVersion, String dbVersion)
IMetaStoreSchemaInfo
isVersionCompatible
in interface IMetaStoreSchemaInfo
hiveVersion
- version of hive softwaredbVersion
- version of metastore rdbms schemapublic String getMetaStoreSchemaVersion(HiveSchemaHelper.MetaStoreConnectionInfo connectionInfo) throws HiveMetaException
IMetaStoreSchemaInfo
getMetaStoreSchemaVersion
in interface IMetaStoreSchemaInfo
connectionInfo
- Connection information needed to connect to the backend
databaseHiveMetaException
- when unable to fetch the schema versionCopyright © 2022 The Apache Software Foundation. All rights reserved.