-
Notifications
You must be signed in to change notification settings - Fork 1.3k
NUTCH-1446 Port NUTCH-1444 to trunk (Indexing should not create tempo… #905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -1,37 +1,30 @@ | ||||||||
| /* | ||||||||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||||||||
| * contributor license agreements. See the NOTICE file distributed with | ||||||||
| * contributor license agreements. See the NOTICE file distributed with | ||||||||
| * this work for additional information regarding copyright ownership. | ||||||||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||||||||
| * (the "License"); you may not use this file except in compliance with | ||||||||
| * the License. You may obtain a copy of the License at | ||||||||
| * | ||||||||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||||||||
| * | ||||||||
| * Unless required by applicable law or agreed to in writing, software | ||||||||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||||||||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||||
| * See the License for the specific language governing permissions and | ||||||||
| * limitations under the License. | ||||||||
| */ | ||||||||
|
|
||||||||
| package org.apache.nutch.indexer; | ||||||||
|
|
||||||||
| import java.io.IOException; | ||||||||
| import java.lang.invoke.MethodHandles; | ||||||||
|
|
||||||||
| import org.apache.hadoop.io.Text; | ||||||||
| import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; | ||||||||
| import org.apache.hadoop.mapreduce.RecordWriter; | ||||||||
| import org.apache.hadoop.conf.Configuration; | ||||||||
| import org.apache.hadoop.mapreduce.JobContext; | ||||||||
| import org.apache.hadoop.mapreduce.OutputCommitter; | ||||||||
| import org.apache.hadoop.mapreduce.OutputFormat; | ||||||||
| import org.apache.hadoop.mapreduce.RecordWriter; | ||||||||
| import org.apache.hadoop.mapreduce.TaskAttemptContext; | ||||||||
|
|
||||||||
| import org.slf4j.Logger; | ||||||||
| import org.slf4j.LoggerFactory; | ||||||||
|
|
||||||||
| public class IndexerOutputFormat | ||||||||
| extends FileOutputFormat<Text, NutchIndexAction> { | ||||||||
| public class IndexerOutputFormat extends OutputFormat<Text, NutchIndexAction> { | ||||||||
|
|
||||||||
| private static final Logger LOG = LoggerFactory | ||||||||
| .getLogger(MethodHandles.lookup().lookupClass()); | ||||||||
| private static final Logger LOG = | ||||||||
| LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); | ||||||||
|
|
||||||||
| @Override | ||||||||
| public RecordWriter<Text, NutchIndexAction> getRecordWriter( | ||||||||
|
|
@@ -40,32 +33,67 @@ public RecordWriter<Text, NutchIndexAction> getRecordWriter( | |||||||
| Configuration conf = context.getConfiguration(); | ||||||||
| final IndexWriters writers = IndexWriters.get(conf); | ||||||||
|
|
||||||||
| String name = getUniqueFile(context, "part", ""); | ||||||||
| writers.open(conf, name); | ||||||||
| // open writers (no temporary file output anymore) | ||||||||
| writers.open(conf, "index"); | ||||||||
|
||||||||
| writers.open(conf, "index"); | |
| String indexName = "index-" + context.getTaskAttemptID().toString(); | |
| writers.open(conf, indexName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method open(Configuration conf, String name) of the IndexWriter class is deprecated. Once it is finally removed, the indexName parameter is not used anymore. So, this is no real problem.
Copilot
AI
Mar 7, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The anonymous no-op OutputCommitter here largely duplicates Hadoop's built-in null output commit semantics (see NullOutputFormat usage elsewhere, e.g. CleaningJob). To reduce maintenance risk across Hadoop upgrades (API surface changes) and keep behavior consistent, consider extending org.apache.hadoop.mapreduce.lib.output.NullOutputFormat and only overriding getRecordWriter, or otherwise reuse a shared no-op committer implementation instead of defining a new anonymous one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shishir-kuet can you address this issue? Thank you.
Uh oh!
There was an error while loading. Please reload this page.