public class NamespaceUpgrade extends Object implements org.apache.hadoop.util.Tool
The pre-0.96 paths and dir names are hardcoded in here.
Modifier and Type | Field and Description |
---|---|
private org.apache.hadoop.fs.Path |
backupDir |
private org.apache.hadoop.fs.Path[] |
baseDirs |
private org.apache.hadoop.conf.Configuration |
conf |
private org.apache.hadoop.fs.Path |
defNsDir |
private static String |
DOT_ARCHIVE |
private static String |
DOT_CORRUPT |
private static String |
DOT_LIB_DIR |
private static String |
DOT_LOGS |
private static String |
DOT_OLD_LOGS |
private static String |
DOT_SPLITLOG |
private org.apache.hadoop.fs.FileSystem |
fs |
private static org.apache.commons.logging.Log |
LOG |
(package private) static List<String> |
NON_USER_TABLE_DIRS
Directories that are not HBase table directories
|
private static String |
OLD_ACL |
private org.apache.hadoop.fs.Path |
rootDir |
private org.apache.hadoop.fs.Path |
sysNsDir |
(package private) static Comparator<org.apache.hadoop.fs.FileStatus> |
TABLEINFO_FILESTATUS_COMPARATOR |
private static org.apache.hadoop.fs.PathFilter |
TABLEINFO_PATHFILTER |
private static String |
TMP_DATA_DIR |
Constructor and Description |
---|
NamespaceUpgrade() |
Modifier and Type | Method and Description |
---|---|
void |
deleteRoot()
Remove the -ROOT- dir.
|
org.apache.hadoop.conf.Configuration |
getConf() |
(package private) static org.apache.hadoop.fs.FileStatus |
getCurrentTableInfoStatus(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path dir) |
void |
init() |
void |
makeNamespaceDirs()
Create the system and default namespaces dirs
|
void |
migrateACL() |
void |
migrateDotDirs()
Rename all the dot dirs -- .data, .archive, etc.
|
void |
migrateMeta() |
void |
migrateSnapshots() |
void |
migrateTables()
Migrate all tables into respective namespaces, either default or system.
|
private void |
mkdirs(org.apache.hadoop.fs.Path p) |
private static HTableDescriptor |
readTableDescriptor(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.FileStatus status) |
private void |
removeTableInfoInPre96Format(TableName tableName)
Removes .tableinfo files that are laid in pre-96 format (i.e., the tableinfo files are under
table directory).
|
private void |
rename(org.apache.hadoop.fs.Path src,
org.apache.hadoop.fs.Path tgt) |
int |
run(String[] args) |
void |
setConf(org.apache.hadoop.conf.Configuration conf) |
(package private) void |
updateAcls(HRegion region)
Deletes the old _acl_ entry, and inserts a new one using namespace.
|
void |
upgradeTableDirs() |
static boolean |
verifyNSUpgrade(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path rootDir) |
private static final org.apache.commons.logging.Log LOG
private org.apache.hadoop.conf.Configuration conf
private org.apache.hadoop.fs.FileSystem fs
private org.apache.hadoop.fs.Path rootDir
private org.apache.hadoop.fs.Path sysNsDir
private org.apache.hadoop.fs.Path defNsDir
private org.apache.hadoop.fs.Path[] baseDirs
private org.apache.hadoop.fs.Path backupDir
private static final String TMP_DATA_DIR
private static final String DOT_LOGS
private static final String DOT_OLD_LOGS
private static final String DOT_CORRUPT
private static final String DOT_SPLITLOG
private static final String DOT_ARCHIVE
private static final String DOT_LIB_DIR
private static final String OLD_ACL
static final List<String> NON_USER_TABLE_DIRS
private static final org.apache.hadoop.fs.PathFilter TABLEINFO_PATHFILTER
static final Comparator<org.apache.hadoop.fs.FileStatus> TABLEINFO_FILESTATUS_COMPARATOR
public NamespaceUpgrade() throws IOException
IOException
public void init() throws IOException
IOException
public void upgradeTableDirs() throws IOException, DeserializationException
IOException
DeserializationException
public void deleteRoot() throws IOException
IOException
public void migrateDotDirs() throws IOException
IOException
private void mkdirs(org.apache.hadoop.fs.Path p) throws IOException
IOException
private void rename(org.apache.hadoop.fs.Path src, org.apache.hadoop.fs.Path tgt) throws IOException
IOException
public void makeNamespaceDirs() throws IOException
IOException
public void migrateTables() throws IOException
IOException
public void migrateSnapshots() throws IOException
IOException
public void migrateMeta() throws IOException
IOException
private void removeTableInfoInPre96Format(TableName tableName) throws IOException
tableName
- IOException
public void migrateACL() throws IOException
IOException
void updateAcls(HRegion region) throws IOException
region
- IOException
private static HTableDescriptor readTableDescriptor(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.FileStatus status) throws IOException
IOException
static org.apache.hadoop.fs.FileStatus getCurrentTableInfoStatus(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path dir) throws IOException
IOException
public static boolean verifyNSUpgrade(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path rootDir) throws IOException
IOException
public int run(String[] args) throws Exception
run
in interface org.apache.hadoop.util.Tool
Exception
public void setConf(org.apache.hadoop.conf.Configuration conf)
setConf
in interface org.apache.hadoop.conf.Configurable
public org.apache.hadoop.conf.Configuration getConf()
getConf
in interface org.apache.hadoop.conf.Configurable
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.