You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ac...@apache.org on 2012/02/18 03:21:39 UTC
svn commit: r1245841 - in
/hadoop/common/branches/branch-0.23.1/hadoop-common-project: ./
hadoop-auth/ hadoop-common/ hadoop-common/src/main/docs/
hadoop-common/src/main/java/
hadoop-common/src/main/java/org/apache/hadoop/fs/
hadoop-common/src/test/cor...
Author: acmurthy
Date: Sat Feb 18 02:21:38 2012
New Revision: 1245841
URL: http://svn.apache.org/viewvc?rev=1245841&view=rev
Log:
Merge -c 1245637 from trunk to branch-0.23.1 to fix HADOOP-8054. NPE with FilterFileSystem.
Modified:
hadoop/common/branches/branch-0.23.1/hadoop-common-project/ (props changed)
hadoop/common/branches/branch-0.23.1/hadoop-common-project/hadoop-auth/ (props changed)
hadoop/common/branches/branch-0.23.1/hadoop-common-project/hadoop-common/ (props changed)
hadoop/common/branches/branch-0.23.1/hadoop-common-project/hadoop-common/CHANGES.txt (contents, props changed)
hadoop/common/branches/branch-0.23.1/hadoop-common-project/hadoop-common/src/main/docs/ (props changed)
hadoop/common/branches/branch-0.23.1/hadoop-common-project/hadoop-common/src/main/java/ (props changed)
hadoop/common/branches/branch-0.23.1/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FilterFileSystem.java
hadoop/common/branches/branch-0.23.1/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/LocalFileSystem.java
hadoop/common/branches/branch-0.23.1/hadoop-common-project/hadoop-common/src/test/core/ (props changed)
hadoop/common/branches/branch-0.23.1/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFilterFileSystem.java
Propchange: hadoop/common/branches/branch-0.23.1/hadoop-common-project/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Feb 18 02:21:38 2012
@@ -1 +1 @@
-/hadoop/common/trunk/hadoop-common-project:1161777,1161781,1162188,1162421,1162491,1162499,1162613,1162928,1162954,1162979,1163050,1163069,1163456,1163465,1163490,1163768,1163852,1163858,1163981,1164255,1164301,1164339,1166009,1166402,1167383,1170379,1170459,1171297,1172916,1173402,1176550,1177487,1177531,1177859,1177864,1182189,1182205,1182214,1189613,1189932,1189982,1195575,1196113,1196129,1204114,1204117,1204122,1204124,1204129,1204131,1204177,1204370,1204376,1204388,1205260,1205697,1206786,1206830,1207694,1208153,1208313,1212021,1212062,1212073,1212084,1213537,1213586,1213592-1213593,1213954,1214046,1220510,1221348,1225114,1225192,1225456,1225489,1225591,1226211,1226239,1226350,1227091,1227165,1227423,1227964,1229347,1230398,1231569,1231572,1231627,1231640,1233605,1234555,1235135,1235137,1235956,1236456,1239752,1240897,1240928
+/hadoop/common/trunk/hadoop-common-project:1161777,1161781,1162188,1162421,1162491,1162499,1162613,1162928,1162954,1162979,1163050,1163069,1163456,1163465,1163490,1163768,1163852,1163858,1163981,1164255,1164301,1164339,1166009,1166402,1167383,1170379,1170459,1171297,1172916,1173402,1176550,1177487,1177531,1177859,1177864,1182189,1182205,1182214,1189613,1189932,1189982,1195575,1196113,1196129,1204114,1204117,1204122,1204124,1204129,1204131,1204177,1204370,1204376,1204388,1205260,1205697,1206786,1206830,1207694,1208153,1208313,1212021,1212062,1212073,1212084,1213537,1213586,1213592-1213593,1213954,1214046,1220510,1221348,1225114,1225192,1225456,1225489,1225591,1226211,1226239,1226350,1227091,1227165,1227423,1227964,1229347,1230398,1231569,1231572,1231627,1231640,1233605,1234555,1235135,1235137,1235956,1236456,1239752,1240897,1240928,1245637
Propchange: hadoop/common/branches/branch-0.23.1/hadoop-common-project/hadoop-auth/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Feb 18 02:21:38 2012
@@ -1 +1 @@
-/hadoop/common/trunk/hadoop-common-project/hadoop-auth:1161777,1161781,1162188,1162421,1162491,1162499,1162613,1162928,1162954,1162979,1163050,1163069,1163456,1163465,1163490,1163768,1163852,1163858,1163981,1164255,1164301,1164339,1166402,1167383,1170379,1170459,1171297,1172916,1173402,1176550,1177487,1177531,1177859,1177864,1179869,1182189,1182205,1182214,1189357,1189613,1189932,1189982,1195575,1196113,1196129,1204114,1204117,1204122,1204124,1204129,1204131,1204177,1204370,1204376,1204388,1205260,1205697,1206786,1206830,1207694,1208153,1208313,1212021,1212062,1212073,1212084,1213537,1213586,1213592-1213593,1213954,1214046,1220510,1221348,1225114,1225192,1225456,1225489,1225591,1226211,1226239,1226350,1227091,1227165,1227423,1227964,1229347,1230398,1231569,1231572,1231627,1231640,1233605,1234555,1235135,1235137,1235956,1236456,1239752,1240897,1240928
+/hadoop/common/trunk/hadoop-common-project/hadoop-auth:1161777,1161781,1162188,1162421,1162491,1162499,1162613,1162928,1162954,1162979,1163050,1163069,1163456,1163465,1163490,1163768,1163852,1163858,1163981,1164255,1164301,1164339,1166402,1167383,1170379,1170459,1171297,1172916,1173402,1176550,1177487,1177531,1177859,1177864,1179869,1182189,1182205,1182214,1189357,1189613,1189932,1189982,1195575,1196113,1196129,1204114,1204117,1204122,1204124,1204129,1204131,1204177,1204370,1204376,1204388,1205260,1205697,1206786,1206830,1207694,1208153,1208313,1212021,1212062,1212073,1212084,1213537,1213586,1213592-1213593,1213954,1214046,1220510,1221348,1225114,1225192,1225456,1225489,1225591,1226211,1226239,1226350,1227091,1227165,1227423,1227964,1229347,1230398,1231569,1231572,1231627,1231640,1233605,1234555,1235135,1235137,1235956,1236456,1239752,1240897,1240928,1245637
Propchange: hadoop/common/branches/branch-0.23.1/hadoop-common-project/hadoop-common/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Feb 18 02:21:38 2012
@@ -1 +1 @@
-/hadoop/common/trunk/hadoop-common-project/hadoop-common:1161777,1161781,1162008,1162188,1162421,1162491,1162499,1162613,1162928,1162954,1162979,1163050,1163069,1163456,1163465,1163490,1163768,1163852,1163858,1164255,1164301,1164339,1166009,1166402,1167383,1170379,1170459,1171297,1172916,1173402,1176550,1176986,1177035,1177487,1177531,1177859,1177864,1179869,1182189,1182205,1182214,1182641,1183132,1189357,1189613,1189932,1189982,1190109,1195575,1195760,1196113,1196129,1204114,1204117,1204122,1204124,1204129,1204131,1204177,1204370,1204376,1204388,1205260,1205697,1206786,1206830,1207694,1208153,1208313,1209246,1212021,1212062,1212073,1212084,1213537,1213586,1213592-1213593,1213598,1213954,1214046,1220510,1221348,1225114,1225192,1225456,1225489,1225591,1226211,1226239,1226350,1227091,1227165,1227423,1227964,1229347,1230398,1231569,1231572,1231627,1231640,1233605,1234555,1235135,1235137,1235956,1236456,1239386,1239752,1240897,1240928
+/hadoop/common/trunk/hadoop-common-project/hadoop-common:1161777,1161781,1162008,1162188,1162421,1162491,1162499,1162613,1162928,1162954,1162979,1163050,1163069,1163456,1163465,1163490,1163768,1163852,1163858,1164255,1164301,1164339,1166009,1166402,1167383,1170379,1170459,1171297,1172916,1173402,1176550,1176986,1177035,1177487,1177531,1177859,1177864,1179869,1182189,1182205,1182214,1182641,1183132,1189357,1189613,1189932,1189982,1190109,1195575,1195760,1196113,1196129,1204114,1204117,1204122,1204124,1204129,1204131,1204177,1204370,1204376,1204388,1205260,1205697,1206786,1206830,1207694,1208153,1208313,1209246,1212021,1212062,1212073,1212084,1213537,1213586,1213592-1213593,1213598,1213954,1214046,1220510,1221348,1225114,1225192,1225456,1225489,1225591,1226211,1226239,1226350,1227091,1227165,1227423,1227964,1229347,1230398,1231569,1231572,1231627,1231640,1233605,1234555,1235135,1235137,1235956,1236456,1239386,1239752,1240897,1240928,1245637
Modified: hadoop/common/branches/branch-0.23.1/hadoop-common-project/hadoop-common/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23.1/hadoop-common-project/hadoop-common/CHANGES.txt?rev=1245841&r1=1245840&r2=1245841&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23.1/hadoop-common-project/hadoop-common/CHANGES.txt (original)
+++ hadoop/common/branches/branch-0.23.1/hadoop-common-project/hadoop-common/CHANGES.txt Sat Feb 18 02:21:38 2012
@@ -1,6 +1,6 @@
Hadoop Change Log
-Release 0.23.1 - 2012-02-08
+Release 0.23.1 - 2012-02-17
INCOMPATIBLE CHANGES
@@ -229,6 +229,8 @@ Release 0.23.1 - 2012-02-08
(instead of Double.MAX_VALUE) to avoid making Ganglia's gmetad core.
(Varun Kapoor via Matt)
+ HADOOP-8054 NPE with FilterFileSystem (Daryn Sharp via bobby)
+
Release 0.23.0 - 2011-11-01
INCOMPATIBLE CHANGES
Propchange: hadoop/common/branches/branch-0.23.1/hadoop-common-project/hadoop-common/CHANGES.txt
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Feb 18 02:21:38 2012
@@ -1,6 +1,6 @@
/hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/CHANGES.txt:1243206
/hadoop/common/branches/yahoo-merge/CHANGES.txt:1079157,1079163-1079164,1079167
-/hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt:1161777,1161781,1162008,1162188,1162421,1162491,1162499,1162613,1162928,1162954,1162979,1163050,1163069,1163456,1163465,1163490,1163768,1163852,1163858,1164255,1164301,1166009,1166402,1167383,1169986,1170046,1170379,1170459,1171297,1171894,1171909,1172186,1172916,1173402,1176550,1176986,1177035,1177487,1177531,1177859,1177864,1179869,1182189,1182205,1182214,1182641,1183132,1189357,1189613,1189932,1189982,1190109,1195575,1195760,1196113,1196129,1204114,1204117,1204122,1204124,1204129,1204131,1204177,1204376,1204388,1205260,1206830,1207694,1208153,1208313,1209246,1212062,1212073,1212084,1213537,1213586,1213592-1213593,1213598,1214046,1220510,1221348,1225114,1225192,1225456,1225489,1225591,1226211,1226239,1226350-1226351,1227091,1227165,1227423,1227964,1229347,1230398,1231569,1231572,1231627,1231640,1233605,1234555,1235135,1235137,1235956,1236456,1239386,1239752,1240897,1240928
+/hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt:1161777,1161781,1162008,1162188,1162421,1162491,1162499,1162613,1162928,1162954,1162979,1163050,1163069,1163456,1163465,1163490,1163768,1163852,1163858,1164255,1164301,1166009,1166402,1167383,1169986,1170046,1170379,1170459,1171297,1171894,1171909,1172186,1172916,1173402,1176550,1176986,1177035,1177487,1177531,1177859,1177864,1179869,1182189,1182205,1182214,1182641,1183132,1189357,1189613,1189932,1189982,1190109,1195575,1195760,1196113,1196129,1204114,1204117,1204122,1204124,1204129,1204131,1204177,1204376,1204388,1205260,1206830,1207694,1208153,1208313,1209246,1212062,1212073,1212084,1213537,1213586,1213592-1213593,1213598,1214046,1220510,1221348,1225114,1225192,1225456,1225489,1225591,1226211,1226239,1226350-1226351,1227091,1227165,1227423,1227964,1229347,1230398,1231569,1231572,1231627,1231640,1233605,1234555,1235135,1235137,1235956,1236456,1239386,1239752,1240897,1240928,1245637
/hadoop/core/branches/branch-0.18/CHANGES.txt:727226
/hadoop/core/branches/branch-0.19/CHANGES.txt:713112
/hadoop/core/trunk/CHANGES.txt:776175-785643,785929-786278
Propchange: hadoop/common/branches/branch-0.23.1/hadoop-common-project/hadoop-common/src/main/docs/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Feb 18 02:21:38 2012
@@ -1,2 +1,2 @@
-/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/docs:1161777,1161781,1162008,1162188,1162421,1162491,1162499,1162613,1162928,1162954,1162979,1163050,1163069,1163456,1163465,1163490,1163768,1163852,1163858,1164255,1164301,1164339,1166402,1167383,1170379,1170459,1171297,1172916,1173402,1176550,1177487,1177531,1177859,1177864,1182189,1182205,1182214,1183132,1189613,1189932,1189982,1195575,1196113,1196129,1204114,1204117,1204122,1204124,1204129,1204131,1204177,1204370,1204376,1204388,1205260,1205697,1206786,1206830,1207694,1208153,1208313,1209246,1212021,1212062,1212073,1212084,1213537,1213586,1213592-1213593,1213954,1214046,1220510,1221348,1225114,1225192,1225456,1225489,1225591,1226211,1226239,1226350,1227091,1227165,1227423,1227964,1229347,1230398,1231569,1231572,1231627,1231640,1233605,1234555,1235135,1235137,1235956,1236456,1239752,1240897,1240928
+/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/docs:1161777,1161781,1162008,1162188,1162421,1162491,1162499,1162613,1162928,1162954,1162979,1163050,1163069,1163456,1163465,1163490,1163768,1163852,1163858,1164255,1164301,1164339,1166402,1167383,1170379,1170459,1171297,1172916,1173402,1176550,1177487,1177531,1177859,1177864,1182189,1182205,1182214,1183132,1189613,1189932,1189982,1195575,1196113,1196129,1204114,1204117,1204122,1204124,1204129,1204131,1204177,1204370,1204376,1204388,1205260,1205697,1206786,1206830,1207694,1208153,1208313,1209246,1212021,1212062,1212073,1212084,1213537,1213586,1213592-1213593,1213954,1214046,1220510,1221348,1225114,1225192,1225456,1225489,1225591,1226211,1226239,1226350,1227091,1227165,1227423,1227964,1229347,1230398,1231569,1231572,1231627,1231640,1233605,1234555,1235135,1235137,1235956,1236456,1239752,1240897,1240928,1245637
/hadoop/core/branches/branch-0.19/src/docs:713112
Propchange: hadoop/common/branches/branch-0.23.1/hadoop-common-project/hadoop-common/src/main/java/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Feb 18 02:21:38 2012
@@ -1,3 +1,3 @@
-/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java:1161777,1161781,1162008,1162188,1162421,1162491,1162499,1162613,1162928,1162954,1162979,1163050,1163069,1163456,1163465,1163490,1163768,1163852,1163858,1164255,1164301,1164339,1166402,1167383,1170379,1170459,1171297,1172916,1173402,1176550,1176986,1177035,1177487,1177531,1177859,1177864,1182189,1182205,1182214,1182641,1183132,1189613,1189932,1189982,1190109,1195575,1195760,1196113,1196129,1204114,1204117,1204122,1204124,1204129,1204131,1204177,1204370,1204376,1204388,1205260,1205697,1206786,1206830,1207694,1208153,1208313,1212021,1212062,1212073,1212084,1213537,1213586,1213592-1213593,1213954,1214046,1220510,1221348,1225114,1225192,1225456,1225489,1225591,1226211,1226239,1226350,1227091,1227165,1227423,1227964,1229347,1230398,1231569,1231572,1231627,1231640,1233605,1234555,1235135,1235137,1235956,1236456,1239752,1240897,1240928
+/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java:1161777,1161781,1162008,1162188,1162421,1162491,1162499,1162613,1162928,1162954,1162979,1163050,1163069,1163456,1163465,1163490,1163768,1163852,1163858,1164255,1164301,1164339,1166402,1167383,1170379,1170459,1171297,1172916,1173402,1176550,1176986,1177035,1177487,1177531,1177859,1177864,1182189,1182205,1182214,1182641,1183132,1189613,1189932,1189982,1190109,1195575,1195760,1196113,1196129,1204114,1204117,1204122,1204124,1204129,1204131,1204177,1204370,1204376,1204388,1205260,1205697,1206786,1206830,1207694,1208153,1208313,1212021,1212062,1212073,1212084,1213537,1213586,1213592-1213593,1213954,1214046,1220510,1221348,1225114,1225192,1225456,1225489,1225591,1226211,1226239,1226350,1227091,1227165,1227423,1227964,1229347,1230398,1231569,1231572,1231627,1231640,1233605,1234555,1235135,1235137,1235956,1236456,1239752,1240897,1240928,1245637
/hadoop/core/branches/branch-0.19/core/src/java:713112
/hadoop/core/trunk/src/core:776175-785643,785929-786278
Modified: hadoop/common/branches/branch-0.23.1/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FilterFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23.1/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FilterFileSystem.java?rev=1245841&r1=1245840&r2=1245841&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23.1/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FilterFileSystem.java (original)
+++ hadoop/common/branches/branch-0.23.1/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FilterFileSystem.java Sat Feb 18 02:21:38 2012
@@ -80,6 +80,11 @@ public class FilterFileSystem extends Fi
*/
public void initialize(URI name, Configuration conf) throws IOException {
super.initialize(name, conf);
+ // this is less than ideal, but existing filesystems sometimes neglect
+ // to initialize the embedded filesystem
+ if (fs.getConf() == null) {
+ fs.initialize(name, conf);
+ }
String scheme = name.getScheme();
if (!scheme.equals(fs.getUri().getScheme())) {
swapScheme = scheme;
Modified: hadoop/common/branches/branch-0.23.1/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/LocalFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23.1/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/LocalFileSystem.java?rev=1245841&r1=1245840&r2=1245841&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23.1/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/LocalFileSystem.java (original)
+++ hadoop/common/branches/branch-0.23.1/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/LocalFileSystem.java Sat Feb 18 02:21:38 2012
@@ -48,13 +48,6 @@ public class LocalFileSystem extends Che
super(rawLocalFileSystem);
}
- @Override
- public void initialize(URI uri, Configuration conf) throws IOException {
- super.initialize(uri, conf);
- // ctor didn't initialize the filtered fs
- getRawFileSystem().initialize(uri, conf);
- }
-
/** Convert a path to a File. */
public File pathToFile(Path path) {
return ((RawLocalFileSystem)fs).pathToFile(path);
Propchange: hadoop/common/branches/branch-0.23.1/hadoop-common-project/hadoop-common/src/test/core/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Feb 18 02:21:38 2012
@@ -1,3 +1,3 @@
-/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/core:1161777,1161781,1162008,1162188,1162421,1162491,1162499,1162613,1162928,1162954,1162979,1163050,1163069,1163456,1163465,1163490,1163768,1163852,1163858,1164255,1164301,1164339,1166009,1166402,1167383,1170379,1170459,1171297,1172916,1173402,1176550,1177487,1177531,1177859,1177864,1182189,1182205,1182214,1183132,1189613,1189932,1189982,1195575,1196113,1196129,1204114,1204117,1204122,1204124,1204129,1204131,1204177,1204370,1204376,1204388,1205260,1205697,1206786,1206830,1207694,1208153,1208313,1212021,1212062,1212073,1212084,1213537,1213586,1213592-1213593,1213954,1214046,1220510,1221348,1225114,1225192,1225456,1225489,1225591,1226211,1226239,1226350,1227091,1227165,1227423,1227964,1229347,1230398,1231569,1231572,1231627,1231640,1233605,1234555,1235135,1235137,1235956,1236456,1239752,1240897,1240928
+/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/core:1161777,1161781,1162008,1162188,1162421,1162491,1162499,1162613,1162928,1162954,1162979,1163050,1163069,1163456,1163465,1163490,1163768,1163852,1163858,1164255,1164301,1164339,1166009,1166402,1167383,1170379,1170459,1171297,1172916,1173402,1176550,1177487,1177531,1177859,1177864,1182189,1182205,1182214,1183132,1189613,1189932,1189982,1195575,1196113,1196129,1204114,1204117,1204122,1204124,1204129,1204131,1204177,1204370,1204376,1204388,1205260,1205697,1206786,1206830,1207694,1208153,1208313,1212021,1212062,1212073,1212084,1213537,1213586,1213592-1213593,1213954,1214046,1220510,1221348,1225114,1225192,1225456,1225489,1225591,1226211,1226239,1226350,1227091,1227165,1227423,1227964,1229347,1230398,1231569,1231572,1231627,1231640,1233605,1234555,1235135,1235137,1235956,1236456,1239752,1240897,1240928,1245637
/hadoop/core/branches/branch-0.19/core/src/test/core:713112
/hadoop/core/trunk/src/test/core:776175-785643,785929-786278
Modified: hadoop/common/branches/branch-0.23.1/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFilterFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23.1/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFilterFileSystem.java?rev=1245841&r1=1245840&r2=1245841&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23.1/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFilterFileSystem.java (original)
+++ hadoop/common/branches/branch-0.23.1/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFilterFileSystem.java Sat Feb 18 02:21:38 2012
@@ -18,24 +18,39 @@
package org.apache.hadoop.fs;
+import static org.junit.Assert.*;
+import static org.mockito.Matchers.*;
+import static org.mockito.Mockito.*;
+
import java.io.IOException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
+import java.net.URI;
import java.util.EnumSet;
import java.util.Iterator;
-import junit.framework.TestCase;
import org.apache.commons.logging.Log;
+import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.fs.Options.CreateOpts;
import org.apache.hadoop.fs.Options.Rename;
import org.apache.hadoop.security.token.Token;
import org.apache.hadoop.util.Progressable;
+import org.junit.BeforeClass;
+import org.junit.Test;
-public class TestFilterFileSystem extends TestCase {
+public class TestFilterFileSystem {
private static final Log LOG = FileSystem.LOG;
+ private static final Configuration conf = new Configuration();
+ @BeforeClass
+ public static void setup() {
+ conf.set("fs.flfs.impl", FilterLocalFileSystem.class.getName());
+ conf.setBoolean("fs.flfs.impl.disable.cache", true);
+ conf.setBoolean("fs.file.impl.disable.cache", true);
+ }
+
public static class DontCheck {
public BlockLocation[] getFileBlockLocations(Path p,
long start, long len) { return null; }
@@ -153,6 +168,7 @@ public class TestFilterFileSystem extend
}
+ @Test
public void testFilterFileSystem() throws Exception {
for (Method m : FileSystem.class.getDeclaredMethods()) {
if (Modifier.isStatic(m.getModifiers()))
@@ -176,4 +192,109 @@ public class TestFilterFileSystem extend
}
}
+ @Test
+ public void testFilterEmbedInit() throws Exception {
+ FileSystem mockFs = createMockFs(false); // no conf = need init
+ checkInit(new FilterFileSystem(mockFs), true);
+ }
+
+ @Test
+ public void testFilterEmbedNoInit() throws Exception {
+ FileSystem mockFs = createMockFs(true); // has conf = skip init
+ checkInit(new FilterFileSystem(mockFs), false);
+ }
+
+ @Test
+ public void testLocalEmbedInit() throws Exception {
+ FileSystem mockFs = createMockFs(false); // no conf = need init
+ checkInit(new LocalFileSystem(mockFs), true);
+ }
+
+ @Test
+ public void testLocalEmbedNoInit() throws Exception {
+ FileSystem mockFs = createMockFs(true); // has conf = skip init
+ checkInit(new LocalFileSystem(mockFs), false);
+ }
+
+ private FileSystem createMockFs(boolean useConf) {
+ FileSystem mockFs = mock(FileSystem.class);
+ when(mockFs.getUri()).thenReturn(URI.create("mock:/"));
+ when(mockFs.getConf()).thenReturn(useConf ? conf : null);
+ return mockFs;
+ }
+
+ @Test
+ public void testGetLocalFsSetsConfs() throws Exception {
+ LocalFileSystem lfs = FileSystem.getLocal(conf);
+ checkFsConf(lfs, conf, 2);
+ }
+
+ @Test
+ public void testGetFilterLocalFsSetsConfs() throws Exception {
+ FilterFileSystem flfs =
+ (FilterFileSystem) FileSystem.get(URI.create("flfs:/"), conf);
+ checkFsConf(flfs, conf, 3);
+ }
+
+ @Test
+ public void testInitLocalFsSetsConfs() throws Exception {
+ LocalFileSystem lfs = new LocalFileSystem();
+ checkFsConf(lfs, null, 2);
+ lfs.initialize(lfs.getUri(), conf);
+ checkFsConf(lfs, conf, 2);
+ }
+
+ @Test
+ public void testInitFilterFsSetsEmbedConf() throws Exception {
+ LocalFileSystem lfs = new LocalFileSystem();
+ checkFsConf(lfs, null, 2);
+ FilterFileSystem ffs = new FilterFileSystem(lfs);
+ assertEquals(lfs, ffs.getRawFileSystem());
+ checkFsConf(ffs, null, 3);
+ ffs.initialize(URI.create("filter:/"), conf);
+ checkFsConf(ffs, conf, 3);
+ }
+
+ @Test
+ public void testInitFilterLocalFsSetsEmbedConf() throws Exception {
+ FilterFileSystem flfs = new FilterLocalFileSystem();
+ assertEquals(LocalFileSystem.class, flfs.getRawFileSystem().getClass());
+ checkFsConf(flfs, null, 3);
+ flfs.initialize(URI.create("flfs:/"), conf);
+ checkFsConf(flfs, conf, 3);
+ }
+
+ private void checkInit(FilterFileSystem fs, boolean expectInit)
+ throws Exception {
+ URI uri = URI.create("filter:/");
+ fs.initialize(uri, conf);
+
+ FileSystem embedFs = fs.getRawFileSystem();
+ if (expectInit) {
+ verify(embedFs, times(1)).initialize(eq(uri), eq(conf));
+ } else {
+ verify(embedFs, times(0)).initialize(any(URI.class), any(Configuration.class));
+ }
+ }
+
+ // check the given fs's conf, and all its filtered filesystems
+ private void checkFsConf(FileSystem fs, Configuration conf, int expectDepth) {
+ int depth = 0;
+ while (true) {
+ depth++;
+ assertFalse("depth "+depth+">"+expectDepth, depth > expectDepth);
+ assertEquals(conf, fs.getConf());
+ if (!(fs instanceof FilterFileSystem)) {
+ break;
+ }
+ fs = ((FilterFileSystem) fs).getRawFileSystem();
+ }
+ assertEquals(expectDepth, depth);
+ }
+
+ private static class FilterLocalFileSystem extends FilterFileSystem {
+ FilterLocalFileSystem() {
+ super(new LocalFileSystem());
+ }
+ }
}