为什么 FileSystem.get() returns com.pepperdata.supervisor.agent.resource.DistributedFileSystemWrapperClassic

Why FileSystem.get() returns com.pepperdata.supervisor.agent.resource.DistributedFileSystemWrapperClassic

以下代码是我们生产系统的一部分。

import com.turn.util.hadoop.ConfigurationFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;

FileSystem fs = FileSystem.get(ConfigurationFactory.newInstance().getConfiguration());
if (fs instanceof DistributedFileSystem) { ACTION }

oozie 启动作业的时间。代码的 ACTION 部分未执行。并且 fs.getClass().getCanonicalName() returns com.pepperdata.supervisor.agent.resource.DistributedFileSystemWrapperClassic.

我尝试通过 bin/java 手动 运行 上面的代码,提供相同的类路径和 java 我从 oozie syslog 获得的属性。结果是 org.apache.hadoop.hdfs.DistributedFileSystem.

我正在使用 hadoop-common-2.0.0-cdh4.7.1.jar 类路径有 CDH-4.7.1-1.cdh4.7.1.p0.47/lib/hadoop-0.20-mapreduce/lib/PepperdataSupervisor.jar。和 /opt/pepperdata/lib/PepperdataSupervisor.jar

我是 java 生态系统的新手。什么是什么com.pepperdata.supervisor.agent.resource.DistributedFileSystemWrapperClassic?为什么手动 运行 和 oozie 启动的结果不同?

非常感谢。

"Pepperdata Supervisor runs on the Resource Manager (or JobTracker) node and communicates with agents that run on every data node in the cluster."

com.pepperdata.supervisor.agent.resource.DistributedFileSystemWrapperClassic
延伸
org.apache.hadoop.fs.FilterFileSystem
延伸
org.apache.hadoop.fs.FileSystem

所以在使用pepperdata时,我们不应该将返回的fs作为子类进行测试或者手动类型转换为org.apache.hadoop.fs.DistributedFileSystem。相反,我们应该直接使用返回的 fs 作为 org.apache.hadoop.fs.FileSystem。例如

FileSystem fs = FileSystem.get(ConfigurationFactory.newInstance().getConfiguration());
fs.exists(inputPath);