Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

HIVE-3231 : msck repair should find partitions already containing dat…

…a files (Keegan Mosley via Ashutosh Chauhan)

git-svn-id: https://svn.apache.org/repos/asf/hive/trunk@1418863 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
commit 523f47c3b6e7cb7b6b7b7801c66406e116af6dbc 1 parent 0539db1
@ashutoshc ashutoshc authored
View
10 ql/src/java/org/apache/hadoop/hive/ql/metadata/HiveMetaStoreChecker.java
@@ -363,16 +363,18 @@ private void getAllLeafDirs(Path basePath, Set<Path> allDirs, FileSystem fs)
throws IOException {
FileStatus[] statuses = fs.listStatus(basePath);
-
- if (statuses.length == 0) {
- allDirs.add(basePath);
- }
+ boolean directoryFound=false;
for (FileStatus status : statuses) {
if (status.isDir()) {
+ directoryFound = true;
getAllLeafDirs(status.getPath(), allDirs, fs);
}
}
+
+ if(!directoryFound){
+ allDirs.add(basePath);
+ }
}
}
View
1  ql/src/test/queries/clientpositive/repair.q
@@ -19,6 +19,7 @@ MSCK TABLE repairtable;
dfs -mkdir -p ../build/ql/test/data/warehouse/repairtable/p1=a/p2=a;
dfs -mkdir -p ../build/ql/test/data/warehouse/repairtable/p1=b/p2=a;
+dfs -touchz ../build/ql/test/data/warehouse/repairtable/p1=b/p2=a/datafile;
MSCK TABLE repairtable;
View
1  ql/src/test/queries/clientpositive/repair_hadoop23.q
@@ -18,6 +18,7 @@ MSCK TABLE repairtable;
dfs -mkdir ../build/ql/test/data/warehouse/repairtable/p1=a/p2=a;
dfs -mkdir ../build/ql/test/data/warehouse/repairtable/p1=b/p2=a;
+dfs -touchz ../build/ql/test/data/warehouse/repairtable/p1=b/p2=a/datafile;
MSCK TABLE repairtable;
Please sign in to comment.
Something went wrong with that request. Please try again.