Permalink
Browse files

Porting code from infochimps-piggybank into airlifted fork

  • Loading branch information...
1 parent f4c45f8 commit 4318e2c49da3449873b929e47fc272dc13247a7a @temujin9 temujin9 committed Sep 7, 2011
Showing with 5 additions and 4 deletions.
  1. +5 −4 src/main/java/com/infochimps/elasticsearch/hadoop/util/HadoopUtils.java
@@ -1,5 +1,7 @@
package com.infochimps.elasticsearch.hadoop.util;
+import java.io.File;
+
import java.io.IOException;
import java.io.FileNotFoundException;
@@ -27,11 +29,10 @@ public static void uploadLocalFile(Path localsrc, Path hdfsdest, Configuration c
Upload a local file to the cluster, if it's newer or nonexistent
*/
public static void uploadLocalFileIfChanged(Path localsrc, Path hdfsdest, Configuration conf) throws IOException {
- FileSystem fs = FileSystem.get(conf);
- FileStatus l_stat = fs.getFileStatus(localsrc);
+ long l_time = new File(localsrc.toUri()).lastModified();
try {
- FileStatus h_stat = fs.getFileStatus(hdfsdest);
- if ( l_stat.getModificationTime() > h_stat.getModificationTime() ) {
+ long h_time = FileSystem.get(conf).getFileStatus(hdfsdest).getModificationTime();
+ if ( l_time > h_time ) {
uploadLocalFile(localsrc, hdfsdest, conf);
}
}

0 comments on commit 4318e2c

Please sign in to comment.