Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

Upgrade to Hadoop 0.9.1 .

Andrzej Bialecki0590fd93b00f
diff --git a/lib/hadoop-0.7.1.jar b/lib/hadoop-0.7.1.jar
deleted file mode 100644
index ab79c66f7..000000000
Binary files a/lib/hadoop-0.7.1.jar and /dev/null differ
diff --git a/lib/hadoop-0.9.1.jar b/lib/hadoop-0.9.1.jar
new file mode 100644
index 000000000..b8cf386d5
Binary files /dev/null and b/lib/hadoop-0.9.1.jar differ
diff --git a/src/java/org/apache/nutch/crawl/CrawlDb.java b/src/java/org/apache/nutch/crawl/CrawlDb.java
index 0dd9b1064..e60654e14 100644
--- a/src/java/org/apache/nutch/crawl/CrawlDb.java
+++ b/src/java/org/apache/nutch/crawl/CrawlDb.java
@@ -115,11 +115,13 @@ public class CrawlDb extends ToolBase {
FileSystem fs = new JobClient(job).getFs();
Path old = new Path(crawlDb, "old");
Path current = new Path(crawlDb, CrawlDatum.DB_DIR_NAME);
- fs.delete(old);
- fs.rename(current, old);
+ if (fs.exists(current)) {
+ if (fs.exists(old)) fs.delete(old);
+ fs.rename(current, old);
+ }
fs.mkdirs(crawlDb);
fs.rename(newCrawlDb, current);
- fs.delete(old);
+ if (fs.exists(old)) fs.delete(old);
}
public static void main(String[] args) throws Exception {
diff --git a/src/java/org/apache/nutch/parse/ParseOutputFormat.java b/src/java/org/apache/nutch/parse/ParseOutputFormat.java
index 3a562f21b..14533c393 100644
--- a/src/java/org/apache/nutch/parse/ParseOutputFormat.java
+++ b/src/java/org/apache/nutch/parse/ParseOutputFormat.java
@@ -22,6 +22,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.io.*;
+import org.apache.hadoop.io.SequenceFile.CompressionType;
import org.apache.nutch.crawl.CrawlDatum;
import org.apache.nutch.fetcher.Fetcher;
import org.apache.hadoop.fs.*;
@@ -68,13 +69,13 @@ public class ParseOutputFormat implements OutputFormat {
new Path(new Path(job.getOutputPath(), CrawlDatum.PARSE_DIR_NAME), name);
final MapFile.Writer textOut =
- new MapFile.Writer(fs, text.toString(), Text.class, ParseText.class);
+ new MapFile.Writer(job, fs, text.toString(), Text.class, ParseText.class, CompressionType.RECORD);
final MapFile.Writer dataOut =
- new MapFile.Writer(fs, data.toString(), Text.class,ParseData.class,true);
+ new MapFile.Writer(job, fs, data.toString(), Text.class,ParseData.class);
final SequenceFile.Writer crawlOut =
- new SequenceFile.Writer(fs, crawl, Text.class, CrawlDatum.class);
+ SequenceFile.createWriter(fs, job, crawl, Text.class, CrawlDatum.class);
return new RecordWriter() {
diff --git a/src/test/org/apache/nutch/crawl/TestMapWritable.java b/src/test/org/apache/nutch/crawl/TestMapWritable.java
index ba45c4804..71a46040b 100644
--- a/src/test/org/apache/nutch/crawl/TestMapWritable.java
+++ b/src/test/org/apache/nutch/crawl/TestMapWritable.java
@@ -106,8 +106,8 @@ public class TestMapWritable extends TestCase {
FileSystem fs = FileSystem.get(configuration);
Path file = new Path(System.getProperty("java.io.tmpdir"), "mapTestFile");
fs.delete(file);
- org.apache.hadoop.io.SequenceFile.Writer writer = new SequenceFile.Writer(
- fs, file, IntWritable.class, MapWritable.class);
+ org.apache.hadoop.io.SequenceFile.Writer writer = SequenceFile.createWriter(
+ fs, configuration, file, IntWritable.class, MapWritable.class);
// write map
System.out.println("start writing map's");
long start = System.currentTimeMillis();
@@ -139,8 +139,8 @@ public class TestMapWritable extends TestCase {
fs.delete(file);
// Text
- System.out.println("start writing utf8's");
- writer = new SequenceFile.Writer(fs, file, IntWritable.class, Text.class);
+ System.out.println("start writing Text's");
+ writer = SequenceFile.createWriter(fs, configuration, file, IntWritable.class, Text.class);
// write map
start = System.currentTimeMillis();
key = new IntWritable();
@@ -153,17 +153,17 @@ public class TestMapWritable extends TestCase {
}
needed = System.currentTimeMillis() - start;
writer.close();
- System.out.println("needed time for writing utf8's: " + needed);
+ System.out.println("needed time for writing Text's: " + needed);
// read map
- System.out.println("start reading utf8's");
+ System.out.println("start reading Text's");
reader = new SequenceFile.Reader(fs, file, configuration);
start = System.currentTimeMillis();
while (reader.next(key, value)) {
}
needed = System.currentTimeMillis() - start;
- System.out.println("needed time for reading utf8: " + needed);
+ System.out.println("needed time for reading Text: " + needed);
fs.delete(file);
}