@@ -1453,30 +1453,18 @@ private static void setSharedCacheUploadPolicies(Configuration conf,
14531453 String confParam = areFiles ?
14541454 MRJobConfig .CACHE_FILES_SHARED_CACHE_UPLOAD_POLICIES :
14551455 MRJobConfig .CACHE_ARCHIVES_SHARED_CACHE_UPLOAD_POLICIES ;
1456- conf .set (confParam , populateSharedCacheUploadPolicies (policies ));
1457- }
1458-
1459- private static String populateSharedCacheUploadPolicies (
1460- Map <String , Boolean > policies ) {
1461- // If policies are an empty map or null, we will set EMPTY_STRING.
1462- // In other words, cleaning up existing policies. This is useful when we
1463- // try to clean up shared cache upload policies for non-application
1464- // master tasks. See YARN-10398 for details.
1456+ // If no policy is provided, we will reset the config by setting an empty
1457+ // string value. In other words, cleaning up existing policies. This is
1458+ // useful when we try to clean up shared cache upload policies for
1459+ // non-application master tasks. See MAPREDUCE-7294 for details.
14651460 if (policies == null || policies .size () == 0 ) {
1466- return "" ;
1461+ conf .set (confParam , "" );
1462+ return ;
14671463 }
14681464 StringBuilder sb = new StringBuilder ();
1469- Iterator <Map .Entry <String , Boolean >> it = policies .entrySet ().iterator ();
1470- Map .Entry <String , Boolean > e ;
1471- if (it .hasNext ()) {
1472- e = it .next ();
1473- sb .append (e .getKey () + DELIM + e .getValue ());
1474- }
1475- while (it .hasNext ()) {
1476- e = it .next ();
1477- sb .append ("," + e .getKey () + DELIM + e .getValue ());
1478- }
1479- return sb .toString ();
1465+ policies .forEach ((k ,v ) -> sb .append (k ).append (DELIM ).append (v ).append ("," ));
1466+ sb .deleteCharAt (sb .length () - 1 );
1467+ conf .set (confParam , sb .toString ());
14801468 }
14811469
14821470 /**
0 commit comments