msck repair table for custom partition names

msck repair table is used to add partitions that exist in HDFS but not in the hive metastore.

However, it expects the partitioned field name to be included in the folder structure:
year=2015
|
|_month=3
|
|_day=5

Notice the partition name prefixed with the partition. This is necessary. msck repair table wont work if you have data in the following directory structure:
2015
|
|_3
|
|_5

This is kind of a pain. The only solution is to use alter table add partition with location.

ALTER TABLE test ADD PARTITION (year=2015,month=03,day=05) location ‘hdfs:///cool/folder/with/data’;

 
36
Kudos
 
36
Kudos

Now read this

Basic Monitoring for Hadoop Data Nodes

Here’s a basic monitoring script to monitor the HDFS cluster disk space, Temp Dir space and number of data nodes up. This was plenty useful before we switched to Cloudera Manager. #!/usr/bin/env ruby # Checks Hadoop and alerts if there... Continue →