Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

Patch a bug introduced by Hadoop 0.4.0, which requires specified input directories to exist.

Douglass Cutting3367ea7f2602
diff --git a/src/java/org/apache/nutch/crawl/CrawlDb.java b/src/java/org/apache/nutch/crawl/CrawlDb.java
index 704227425..20482f1a6 100644
--- a/src/java/org/apache/nutch/crawl/CrawlDb.java
+++ b/src/java/org/apache/nutch/crawl/CrawlDb.java
@@ -65,7 +65,8 @@ public class CrawlDb extends Configured {
if (LOG.isInfoEnabled()) { LOG.info("CrawlDb update: done"); }
}
- public static JobConf createJob(Configuration config, Path crawlDb) {
+ public static JobConf createJob(Configuration config, Path crawlDb)
+ throws IOException {
Path newCrawlDb =
new Path(crawlDb,
Integer.toString(new Random().nextInt(Integer.MAX_VALUE)));
@@ -73,7 +74,11 @@ public class CrawlDb extends Configured {
JobConf job = new NutchJob(config);
job.setJobName("crawldb " + crawlDb);
- job.addInputPath(new Path(crawlDb, CrawlDatum.DB_DIR_NAME));
+
+ Path current = new Path(crawlDb, CrawlDatum.DB_DIR_NAME);
+ if (FileSystem.get(job).exists(current)) {
+ job.addInputPath(current);
+ }
job.setInputFormat(SequenceFileInputFormat.class);
job.setInputKeyClass(UTF8.class);
job.setInputValueClass(CrawlDatum.class);