Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

Upgrade to Hadoop 0.10.1. HTTPClient is now a dependency - move it to lib/ and remove it as a plugin.

Andrzej Bialecki41de560b37ef
diff --git a/CHANGES.txt b/CHANGES.txt
index 577a4709e..47723cedc 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -126,6 +126,8 @@ Unreleased changes (0.9-dev)
40. When indexing pages with redirection, drop all intermediate pages and
index only the final page. (ab)
+41. Upgrade to Hadoop 0.10.1. (ab)
+
Release 0.8 - 2006-07-25
diff --git a/bin/nutch b/bin/nutch
index 434291a77..1d5df3837 100755
--- a/bin/nutch
+++ b/bin/nutch
@@ -123,6 +123,25 @@ for f in $NUTCH_HOME/lib/jetty-ext/*.jar; do
CLASSPATH=${CLASSPATH}:$f;
done
+
+# setup 'java.library.path' for native-hadoop code if necessary
+JAVA_LIBRARY_PATH=''
+if [ -d "${NUTCH_HOME}/build/native" -o -d "${NUTCH_HOME}/lib/native" ]; then
+ JAVA_PLATFORM=`CLASSPATH=${CLASSPATH} ${JAVA} org.apache.hadoop.util.PlatformName`
+
+ if [ -d "$NUTCH_HOME/build/native" ]; then
+ JAVA_LIBRARY_PATH=${HADOOP_HOME}/build/native/${JAVA_PLATFORM}/lib
+ fi
+
+ if [ -d "${NUTCH_HOME}/lib/native" ]; then
+ if [ "x$JAVA_LIBRARY_PATH" != "x" ]; then
+ JAVA_LIBRARY_PATH=${JAVA_LIBRARY_PATH}:${NUTCH_HOME}/lib/native/${JAVA_PLATFORM}
+ else
+ JAVA_LIBRARY_PATH=${NUTCH_HOME}/lib/native/${JAVA_PLATFORM}
+ fi
+ fi
+fi
+
# restore ordinary behaviour
unset IFS
@@ -142,6 +161,10 @@ fi
NUTCH_OPTS="$NUTCH_OPTS -Dhadoop.log.dir=$NUTCH_LOG_DIR"
NUTCH_OPTS="$NUTCH_OPTS -Dhadoop.log.file=$NUTCH_LOGFILE"
+if [ "x$JAVA_LIBRARY_PATH" != "x" ]; then
+ NUTCH_OPTS="$NUTCH_OPTS -Djava.library.path=$JAVA_LIBRARY_PATH"
+fi
+
# figure out which class to run
if [ "$COMMAND" = "crawl" ] ; then
CLASS=org.apache.nutch.crawl.Crawl
@@ -194,5 +217,6 @@ if $cygwin; then
fi
# run it
+echo "$JAVA" $JAVA_HEAP_MAX $NUTCH_OPTS -classpath "$CLASSPATH" $CLASS "$@"
exec "$JAVA" $JAVA_HEAP_MAX $NUTCH_OPTS -classpath "$CLASSPATH" $CLASS "$@"
diff --git a/build.xml b/build.xml
index e74f6b4a7..cfceca515 100644
--- a/build.xml
+++ b/build.xml
@@ -262,7 +262,7 @@
todir="${test.build.classes}"/>
<junit printsummary="yes" haltonfailure="no" fork="yes" dir="${basedir}"
- errorProperty="tests.failed" failureProperty="tests.failed">
+ errorProperty="tests.failed" failureProperty="tests.failed" maxmemory="1000m">
<sysproperty key="test.build.data" value="${test.build.data}"/>
<sysproperty key="test.src.dir" value="${test.src.dir}"/>
<classpath refid="test.classpath"/>
diff --git a/lib/commons-codec-1.3.jar b/lib/commons-codec-1.3.jar
new file mode 100644
index 000000000..957b6752a
Binary files /dev/null and b/lib/commons-codec-1.3.jar differ
diff --git a/src/plugin/lib-commons-httpclient/lib/commons-httpclient-3.0.jar b/lib/commons-httpclient-3.0.1.jar
similarity index 72%
rename from src/plugin/lib-commons-httpclient/lib/commons-httpclient-3.0.jar
rename to lib/commons-httpclient-3.0.1.jar
index 54a9300e6..cfc777c71 100644
Binary files a/src/plugin/lib-commons-httpclient/lib/commons-httpclient-3.0.jar and b/lib/commons-httpclient-3.0.1.jar differ
diff --git a/lib/hadoop-0.10.1-core.jar b/lib/hadoop-0.10.1-core.jar
new file mode 100644
index 000000000..2fb8e5fd3
Binary files /dev/null and b/lib/hadoop-0.10.1-core.jar differ
diff --git a/lib/hadoop-0.9.1.jar b/lib/hadoop-0.9.1.jar
deleted file mode 100644
index b8cf386d5..000000000
Binary files a/lib/hadoop-0.9.1.jar and /dev/null differ
diff --git a/lib/jets3t.jar b/lib/jets3t.jar
new file mode 100644
index 000000000..3cba841c4
Binary files /dev/null and b/lib/jets3t.jar differ
diff --git a/lib/native/Linux-i386-32/libhadoop.a b/lib/native/Linux-i386-32/libhadoop.a
new file mode 100644
index 000000000..8eb5a9359
Binary files /dev/null and b/lib/native/Linux-i386-32/libhadoop.a differ
diff --git a/lib/native/Linux-i386-32/libhadoop.so b/lib/native/Linux-i386-32/libhadoop.so
new file mode 100644
index 000000000..621af43b3
Binary files /dev/null and b/lib/native/Linux-i386-32/libhadoop.so differ
diff --git a/lib/native/Linux-i386-32/libhadoop.so.1 b/lib/native/Linux-i386-32/libhadoop.so.1
new file mode 100644
index 000000000..621af43b3
Binary files /dev/null and b/lib/native/Linux-i386-32/libhadoop.so.1 differ
diff --git a/lib/native/Linux-i386-32/libhadoop.so.1.0.0 b/lib/native/Linux-i386-32/libhadoop.so.1.0.0
new file mode 100644
index 000000000..621af43b3
Binary files /dev/null and b/lib/native/Linux-i386-32/libhadoop.so.1.0.0 differ
diff --git a/src/java/org/apache/nutch/crawl/CrawlDbMerger.java b/src/java/org/apache/nutch/crawl/CrawlDbMerger.java
index d95a29e5a..a33214f04 100644
--- a/src/java/org/apache/nutch/crawl/CrawlDbMerger.java
+++ b/src/java/org/apache/nutch/crawl/CrawlDbMerger.java
@@ -120,8 +120,6 @@ public class CrawlDbMerger extends ToolBase {
job.setJobName("crawldb merge " + output);
job.setInputFormat(SequenceFileInputFormat.class);
- job.setInputKeyClass(Text.class);
- job.setInputValueClass(CrawlDatum.class);
job.setMapperClass(CrawlDbFilter.class);
job.setBoolean(CrawlDbFilter.URL_FILTERING, filter);
diff --git a/src/java/org/apache/nutch/fetcher/Fetcher.java b/src/java/org/apache/nutch/fetcher/Fetcher.java
index 9e681bf8b..c3263a6b0 100644
--- a/src/java/org/apache/nutch/fetcher/Fetcher.java
+++ b/src/java/org/apache/nutch/fetcher/Fetcher.java
@@ -48,12 +48,12 @@ public class Fetcher extends ToolBase implements MapRunnable {
public static class InputFormat extends SequenceFileInputFormat {
/** Don't split inputs, to keep things polite. */
- public FileSplit[] getSplits(FileSystem fs, JobConf job, int nSplits)
+ public InputSplit[] getSplits(FileSystem fs, JobConf job, int nSplits)
throws IOException {
- Path[] files = listPaths(fs, job);
- FileSplit[] splits = new FileSplit[files.length];
+ Path[] files = listPaths(job);
+ InputSplit[] splits = new InputSplit[files.length];
for (int i = 0; i < files.length; i++) {
- splits[i] = new FileSplit(files[i], 0, fs.getLength(files[i]));
+ splits[i] = new FileSplit(files[i], 0, fs.getLength(files[i]), job);
}
return splits;
}
diff --git a/src/java/org/apache/nutch/indexer/DeleteDuplicates.java b/src/java/org/apache/nutch/indexer/DeleteDuplicates.java
index 7315d072f..4f01670e9 100644
--- a/src/java/org/apache/nutch/indexer/DeleteDuplicates.java
+++ b/src/java/org/apache/nutch/indexer/DeleteDuplicates.java
@@ -145,13 +145,12 @@ public class DeleteDuplicates extends ToolBase
private static final long INDEX_LENGTH = Integer.MAX_VALUE;
/** Return each index as a split. */
- public FileSplit[] getSplits(FileSystem fs, JobConf job,
- int numSplits)
+ public InputSplit[] getSplits(JobConf job, int numSplits)
throws IOException {
- Path[] files = listPaths(fs, job);
- FileSplit[] splits = new FileSplit[files.length];
+ Path[] files = listPaths(job);
+ InputSplit[] splits = new InputSplit[files.length];
for (int i = 0; i < files.length; i++) {
- splits[i] = new FileSplit(files[i], 0, INDEX_LENGTH);
+ splits[i] = new FileSplit(files[i], 0, INDEX_LENGTH, job);
}
return splits;
}
@@ -163,9 +162,9 @@ public class DeleteDuplicates extends ToolBase
private int doc;
private Text index;
- public DDRecordReader(FileSystem fs, FileSplit split, JobConf job,
+ public DDRecordReader(FileSplit split, JobConf job,
Text index) throws IOException {
- indexReader = IndexReader.open(new FsDirectory(fs, split.getPath(), false, job));
+ indexReader = IndexReader.open(new FsDirectory(FileSystem.get(job), split.getPath(), false, job));
maxDoc = indexReader.maxDoc();
this.index = index;
}
@@ -211,7 +210,7 @@ public class DeleteDuplicates extends ToolBase
}
public long getPos() throws IOException {
- return maxDoc==0 ? 0 : (doc*INDEX_LENGTH)/maxDoc;
+ return maxDoc == 0 ? 0 : (doc*INDEX_LENGTH)/maxDoc;
}
public void close() throws IOException {
@@ -225,16 +224,20 @@ public class DeleteDuplicates extends ToolBase
public Writable createValue() {
return new IndexDoc();
}
+
+ public float getProgress() throws IOException {
+ return maxDoc == 0 ? 0.0f : (float)doc / (float)maxDoc;
+ }
}
/** Return each index as a split. */
- public RecordReader getRecordReader(final FileSystem fs,
- final FileSplit split,
- final JobConf job,
+ public RecordReader getRecordReader(InputSplit split,
+ JobConf job,
Reporter reporter) throws IOException {
- final Text index = new Text(split.getPath().toString());
+ FileSplit fsplit = (FileSplit)split;
+ Text index = new Text(fsplit.getPath().toString());
reporter.setStatus(index.toString());
- return new DDRecordReader(fs, split, job, index);
+ return new DDRecordReader(fsplit, job, index);
}
}
diff --git a/src/plugin/build.xml b/src/plugin/build.xml
index 79698b28b..255d58fd6 100755
--- a/src/plugin/build.xml
+++ b/src/plugin/build.xml
@@ -16,7 +16,6 @@
<ant dir="index-basic" target="deploy"/>
<ant dir="index-more" target="deploy"/>
<ant dir="languageidentifier" target="deploy"/>
- <ant dir="lib-commons-httpclient" target="deploy"/>
<ant dir="lib-http" target="deploy"/>
<ant dir="lib-jakarta-poi" target="deploy"/>
<ant dir="lib-log4j" target="deploy"/>
diff --git a/src/plugin/lib-commons-httpclient/build.xml b/src/plugin/lib-commons-httpclient/build.xml
deleted file mode 100644
index 2f97ef441..000000000
--- a/src/plugin/lib-commons-httpclient/build.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0"?>
-
-<project name="lib-commons-httpclient" default="jar">
-
- <import file="../build-plugin.xml"/>
-
- <!--
- ! Override the compile and jar targets,
- ! since there is nothing to compile here.
- ! -->
- <target name="compile" depends="init"/>
-
- <target name="jar">
- <copy todir="${build.dir}" verbose="true">
- <fileset dir="./lib" includes="**/*.jar"/>
- </copy>
- </target>
-
-</project>
diff --git a/src/plugin/lib-commons-httpclient/plugin.xml b/src/plugin/lib-commons-httpclient/plugin.xml
deleted file mode 100644
index 0f4acfe59..000000000
--- a/src/plugin/lib-commons-httpclient/plugin.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- ! Jakarta Commons HTTP Client
- ! (http://jakarta.apache.org/commons/httpclient/)
- !
- ! Dowload : http://jakarta.apache.org/commons/httpclient/downloads.html
- ! License : http://jakarta.apache.org/commons/license.html
- !-->
-<plugin
- id="lib-commons-httpclient"
- name="Jakarta Commons HTTP Client"
- version="3.0"
- provider-name="jakarta.apache.org">
-
- <runtime>
- <library name="commons-httpclient-3.0.jar">
- <export name="*"/>
- </library>
- </runtime>
-
-</plugin>
diff --git a/src/plugin/parse-rss/build.xml b/src/plugin/parse-rss/build.xml
index db95cfd31..94d173ffc 100644
--- a/src/plugin/parse-rss/build.xml
+++ b/src/plugin/parse-rss/build.xml
@@ -23,7 +23,6 @@
<ant target="deploy" inheritall="false" dir="../lib-xml"/>
<ant target="deploy" inheritall="false" dir="../lib-log4j"/>
<ant target="deploy" inheritall="false" dir="../nutch-extensionpoints"/>
- <ant target="deploy" inheritall="false" dir="../lib-commons-httpclient"/>
<ant target="deploy" inheritall="false" dir="../protocol-file"/>
</target>
diff --git a/src/plugin/parse-rss/plugin.xml b/src/plugin/parse-rss/plugin.xml
index 96a6e64d0..fcf32a7bf 100644
--- a/src/plugin/parse-rss/plugin.xml
+++ b/src/plugin/parse-rss/plugin.xml
@@ -19,7 +19,6 @@
<import plugin="nutch-extensionpoints"/>
<import plugin="lib-xml"/>
<import plugin="lib-log4j"/>
- <import plugin="lib-commons-httpclient"/>
</requires>
<extension id="org.apache.nutch.parse.rss"
diff --git a/src/plugin/protocol-httpclient/build.xml b/src/plugin/protocol-httpclient/build.xml
index 0885464ee..59ef925c1 100644
--- a/src/plugin/protocol-httpclient/build.xml
+++ b/src/plugin/protocol-httpclient/build.xml
@@ -5,14 +5,12 @@
<import file="../build-plugin.xml"/>
<target name="deps-jar">
- <ant target="jar" inheritall="false" dir="../lib-commons-httpclient"/>
<ant target="jar" inheritall="false" dir="../lib-http"/>
</target>
<path id="plugin.deps">
<fileset dir="${nutch.root}/build">
<include name="**/lib-http/*.jar" />
- <include name="**/lib-commons-httpclient/*.jar" />
</fileset>
</path>
diff --git a/src/plugin/protocol-httpclient/lib/commons-codec.jar b/src/plugin/protocol-httpclient/lib/commons-codec.jar
deleted file mode 100644
index cce1e07c7..000000000
Binary files a/src/plugin/protocol-httpclient/lib/commons-codec.jar and /dev/null differ
diff --git a/src/plugin/protocol-httpclient/plugin.xml b/src/plugin/protocol-httpclient/plugin.xml
index 57649705b..25bfa8ffd 100644
--- a/src/plugin/protocol-httpclient/plugin.xml
+++ b/src/plugin/protocol-httpclient/plugin.xml
@@ -10,13 +10,11 @@
<library name="protocol-httpclient.jar">
<export name="*"/>
</library>
- <library name="commons-codec.jar" />
</runtime>
<requires>
<import plugin="nutch-extensionpoints"/>
<import plugin="lib-http"/>
- <import plugin="lib-commons-httpclient"/>
</requires>
<extension id="org.apache.nutch.protocol.httpclient"