Author: szetszwo
Date: Tue Mar 18 18:37:59 2014
New Revision: 1579008

URL: http://svn.apache.org/r1579008
Log:
svn merge -c 1579007 from branch-2 for HDFS-6068. Disallow snapshot names that 
are also invalid directory names.

Added:
    
hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshotNameWithInvalidCharacters.java
      - copied unchanged from r1579007, 
hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshotNameWithInvalidCharacters.java
Modified:
    hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/   (props 
changed)
    
hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
    
hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/src/main/java/
   (props changed)
    
hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
    
hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/
   (props changed)
    
hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshot.java

Propchange: hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/
------------------------------------------------------------------------------
  Merged 
/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs:r1579007
  Merged /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs:r1579004

Modified: 
hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt?rev=1579008&r1=1579007&r2=1579008&view=diff
==============================================================================
--- 
hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt 
(original)
+++ 
hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt 
Tue Mar 18 18:37:59 2014
@@ -154,6 +154,9 @@ Release 2.4.0 - UNRELEASED
     HDFS-6090. Use MiniDFSCluster.Builder instead of deprecated constructors.
     (Akira AJISAKA via jing9)
 
+    HDFS-6068. Disallow snapshot names that are also invalid directory names.
+    (sathish via szetszwo)
+
   OPTIMIZATIONS
 
     HDFS-5790. LeaseManager.findPath is very slow when many leases need 
recovery

Propchange: 
hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/src/main/java/
------------------------------------------------------------------------------
  Merged 
/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java:r1579007
  Merged 
/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java:r1579004

Modified: 
hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
URL: 
http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java?rev=1579008&r1=1579007&r2=1579008&view=diff
==============================================================================
--- 
hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
 (original)
+++ 
hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
 Tue Mar 18 18:37:59 2014
@@ -6913,6 +6913,12 @@ public class FSNamesystem implements Nam
       if (snapshotName == null || snapshotName.isEmpty()) {
         snapshotName = Snapshot.generateDefaultSnapshotName();
       }
+      if(snapshotName != null){
+        if (!DFSUtil.isValidNameForComponent(snapshotName)) {
+            throw new InvalidPathException("Invalid snapshot name: "
+                + snapshotName);
+        }
+      }
       dir.verifySnapshotName(snapshotName, snapshotRoot);
       dir.writeLock();
       try {

Propchange: 
hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Tue Mar 18 18:37:59 2014
@@ -0,0 +1,11 @@
+/hadoop/common/branches/HDFS-2802/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot:1360400-1480829
+/hadoop/common/branches/HDFS-3042/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot:1306184-1342109
+/hadoop/common/branches/HDFS-4685/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot:1547224-1569863
+/hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot:1550130-1574256
+/hadoop/common/branches/branch-0.23-PB/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot:1227776-1294021
+/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot:1572489,1575449,1576128,1576149,1576151,1576157,1576980,1578515,1579007
+/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot:1161777,1161781,1161992,1162188,1162421,1162491,1162499,1162613,1162928,1162954,1162979,1163050,1163069,1163081,1163490,1163768,1164255,1164301,1164339,1165826,1166402,1166466,1167383,1167662,1170085,1170379,1170459,1170996,1171136,1171297,1171379,1171611,1171711,1172916,1173402,1173468,1173488,1175113,1176178,1176550,1176719,1176729,1176733,1177100,1177161,1177487,1177531,1177757,1177859,1177864,1177905,1179169,1179856,1179861,1180757,1182189,1182205,1182214,1183081,1183098,1183175,1183554,1186508,1186896,1187140,1187505,1188282,1188286,1188300,1188436,1188487,1189028,1189355,1189360,1189546,1189613,1189901,1189932,1189982,1190077,1190127,1190620,1190708,1195575,1195656,1195731,1195754,1196113,1196129,1196171,1197329,1198903,1199396,1200731,1204114,1204117,1204122,1204124,1204129,1204131,1204177,1204366,1204370,1204376,1204388,1204544,1204707,1204709,1204825,1205146,12
 
05260,1205626,1205697,1206178,1206786,1206830,1207585,1207694,1208140,1208153,1208313,1210208,1210657,1210719,1210746,1211206,1211249,1211769,1212021,1212062,1212073,1212084,1212299,1212606,1213040,1213143,1213537,1213586,1213592-1213593,1213808,1213813,1213954,1213985,1214027,1214033,1214046,1214102-1214103,1214128,1215364,1215366,1220315,1220510,1221106,1221348,1225114,1225192,1225456,1225489,1225591,1226211,1226239,1226350,1227091,1227165,1227423,1227887,1227964,1229347,1229877,1229897,1230398,1231569,1231572,1231627,1231640,1233584,1233605,1234555,1235135,1235137,1235956,1236456,1238700,1238779,1238969,1239752,1240020,1240653,1240897,1240928,1241007,1241519,1242087,1242891,1243065,1243104,1243654,1243690,1244766,1245751,1245762,1292419,1292626,1293419,1293487,1295061,1295227,1295929,1296556,1297328,1298044,1298066,1298696,1298700,1298820,1299045,1299139,1299144,1299434,1299963,1300392,1301127,1301287,1301295,1301308,1301312,1301661,1301665,1301820,1301871,1302624,1302683,1302704
 
-1302705,1303318,1303474,1303628,1304063,1304099,1304112,1304118,1305230,1305603,1305628,1305632,1306549,1306582,1306665,1307100,1307173,1307553,1307888,1307890,1308014,1308174,1308180,1308205,1308226,1308437,1308614,1308617,1309103,1309114,1309218,1309625,1309629,1309641,1310135,1310138,1310185,1310522,1310649,1311380,1311394,1311556,1311774,1312029,1312061,1312068,1324892,1325963,1326762,1326848,1327309,1327365,1327762,1327768,1327776,1327788,1327790,1328541,1329319,1329462,1330064,1330500,1330506,1330535,1330613,1331061,1331114,1331138,1331570,1331598,1331626,1332527,1332531,1332876,1333557,1333587,1333679,1334156,1334216,1335304,1335309,1335788,1336480,1336495,1336815,1336909,1336943,1336972,1336976,1337017,1338767,1338784,1338802,1338830,1339413,1339706,1339712,1340750,1341141,1341676,1341916,1341961,1342112,1342512,1342520,1342534,1343913,1343944,1344386,1344419,1344423,1344840,1344874,1344908,1344970,1344972,1345563,1346106,1346192,1347117,1347867,1347891,1348207,1348287,1348
 
945,1348998,1349004,1349088,1349117,1349124,1349456,1349459,1349466,1349616,1349628,1349643,1350384,1350825,1351445,1351818,1353800,1353807,1354144,1354316,1355089,1356086,1356971,1357442,1358659,1358794,1358822,1361005,1361008,1361021,1361440,1361446,1361449,1361454,1361459,1361561,1361565,1361813,1362119,1362177,1362976,1363457,1363459,1363466,1363576,1364865,1365839,1367841,1370495,1371555,1372707,1373193,1373253,1373664,1373683,1373928,1374040,1374122,1374127,1374696,1375336,1375383,1375450,1375829,1376121,1376689,1376698,1376928,1377934,1377936,1379172,1379278,1379646,1379743,1380003,1380934,1380939,1381472,1382409,1382836,1383031,1383753,1383759,1384081,1384092,1387255,1387278,1387838,1388331,1390466,1393777,1393830,1393884,1393890,1395385,1395387,1395700,1395821,1396725,1398288,1398293,1398612,1398874,1399010,1399443,1399861,1399866,1400345,1400578,1400986,1402265,1402270,1402599,1402608,1405237,1406382,1407182,1407345,1408477,1409071,1409088,1409905,1409995,1410812,1412237,1
 
414874,1415480,1415799,1416064,1416691,1417130,1419649,1422276,1428739,1429653,1430462,1430468,1430534,1430585,1430595,1430682,1430688,1430917,1431179,1431726,1431753,1431867,1432221,1438808,1440245,1441935,1442824,1443297,1443309,1445006,1445965,1448708,1459573,1459576,1461040,1465121,1465434,1476395,1476399,1477849,1480838,1480840,1482658,1482661,1483150,1487093,1487643,1487647,1487655,1487698,1487942,1488630,1492062,1492941,1494854,1494858,1498202,1498962,1503720,1505362,1505610,1507259,1509070,1509075,1509565,1514156,1523400,1523875,1525828,1531125,1532468,1532857,1532860,1532932,1533917,1534426,1538156,1551812,1555190,1559701,1561885,1562659,1563328,1563362,1564885,1565435,1565840,1567497,1567720,1567767,1567835,1569950,1570070,1570429,1572284,1572488,1573031,1573433-1573434,1573883,1573887,1574246,1574259,1574787,1574796,1574998,1575021,1575100,1575109,1575452,1575611,1575797,1576047,1576194,1576533,1576979,1576989,1577350,1577426,1577798,1578994,1579004-1579005
+/hadoop/core/branches/branch-0.19/hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot:713112
+/hadoop/hdfs/branches/HDFS-1052/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot:987665-1095512
+/hadoop/hdfs/branches/HDFS-265/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot:796829-820463
+/hadoop/hdfs/branches/branch-0.21/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot:820487

Modified: 
hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshot.java
URL: 
http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshot.java?rev=1579008&r1=1579007&r2=1579008&view=diff
==============================================================================
--- 
hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshot.java
 (original)
+++ 
hadoop/common/branches/branch-2.4/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshot.java
 Tue Mar 18 18:37:59 2014
@@ -337,12 +337,11 @@ public class TestSnapshot {
       hdfs.createSnapshot(dir, name1);
       fail("Exception expected when an illegal name is given");
     } catch (RemoteException e) {
-      String errorMsg = "\"" + HdfsConstants.DOT_SNAPSHOT_DIR
-          + "\" is a reserved name.";
+      String errorMsg = "Invalid path name Invalid snapshot name: " + name1; 
       GenericTestUtils.assertExceptionContains(errorMsg, e);
     }
     
-    String errorMsg = "Snapshot name cannot contain \"" + Path.SEPARATOR + 
"\"";
+    
     final String[] badNames = new String[] { "foo" + Path.SEPARATOR,
         Path.SEPARATOR + "foo", Path.SEPARATOR, "foo" + Path.SEPARATOR + "bar" 
};
     for (String badName : badNames) {
@@ -350,6 +349,7 @@ public class TestSnapshot {
         hdfs.createSnapshot(dir, badName);
         fail("Exception expected when an illegal name is given");
       } catch (RemoteException e) {
+    String errorMsg = "Invalid path name Invalid snapshot name: " + badName ;
         GenericTestUtils.assertExceptionContains(errorMsg, e);
       }
     }


Reply via email to