@@ -956,7 +956,15 @@ private void handleApplicationAttemptStateOp(
956956 zkAcl , fencingNodePath );
957957 break ;
958958 case REMOVE :
959- zkManager .safeDelete (path , zkAcl , fencingNodePath );
959+ try {
960+ zkManager .safeDelete (path , zkAcl , fencingNodePath );
961+ } catch (KeeperException .NoNodeException nne ) {
962+ if (!exists (path )){
963+ LOG .info ("Node " + path + " doesn't exist to delete" );
964+ } else {
965+ throw nne ;
966+ }
967+ }
960968 break ;
961969 default :
962970 break ;
@@ -1031,14 +1039,25 @@ private void removeApp(String removeAppId, boolean safeRemove,
10311039 LOG .debug ("Removing info for app: {} at: {} and its attempts." ,
10321040 removeAppId , appIdRemovePath );
10331041
1034- if (attempts != null ) {
1035- for (ApplicationAttemptId attemptId : attempts ) {
1036- String attemptRemovePath =
1037- getNodePath (appIdRemovePath , attemptId .toString ());
1038- zkManager .safeDelete (attemptRemovePath , zkAcl , fencingNodePath );
1042+ String path = appIdRemovePath ;
1043+ try {
1044+ if (attempts != null ) {
1045+ for (ApplicationAttemptId attemptId : attempts ) {
1046+ String attemptRemovePath =
1047+ getNodePath (appIdRemovePath , attemptId .toString ());
1048+ path = attemptRemovePath ;
1049+ zkManager .safeDelete (attemptRemovePath , zkAcl , fencingNodePath );
1050+ }
1051+ path = appIdRemovePath ;
1052+ }
1053+ zkManager .safeDelete (appIdRemovePath , zkAcl , fencingNodePath );
1054+ } catch (KeeperException .NoNodeException nne ){
1055+ if (!exists (path )){
1056+ LOG .info ("Node " + path + " doesn't exist to delete" );
1057+ } else {
1058+ throw nne ;
10391059 }
10401060 }
1041- zkManager .safeDelete (appIdRemovePath , zkAcl , fencingNodePath );
10421061 } else {
10431062 CuratorFramework curatorFramework = zkManager .getCurator ();
10441063 curatorFramework .delete ().deletingChildrenIfNeeded ().
@@ -1098,8 +1117,15 @@ protected synchronized void removeRMDelegationTokenState(
10981117
10991118 LOG .debug ("Removing RMDelegationToken_{}" ,
11001119 rmDTIdentifier .getSequenceNumber ());
1101-
1102- zkManager .safeDelete (nodeRemovePath , zkAcl , fencingNodePath );
1120+ try {
1121+ zkManager .safeDelete (nodeRemovePath , zkAcl , fencingNodePath );
1122+ } catch (KeeperException .NoNodeException nne ){
1123+ if (!exists (nodeRemovePath )){
1124+ LOG .info ("Node " + nodeRemovePath + " doesn't exist to delete" );
1125+ } else {
1126+ throw nne ;
1127+ }
1128+ }
11031129
11041130 // Check if we should remove the parent app node as well.
11051131 checkRemoveParentZnode (nodeRemovePath , splitIndex );
@@ -1159,8 +1185,15 @@ protected synchronized void removeRMDTMasterKeyState(
11591185 + delegationKey .getKeyId ());
11601186
11611187 LOG .debug ("Removing RMDelegationKey_{}" , delegationKey .getKeyId ());
1162-
1163- zkManager .safeDelete (nodeRemovePath , zkAcl , fencingNodePath );
1188+ try {
1189+ zkManager .safeDelete (nodeRemovePath , zkAcl , fencingNodePath );
1190+ } catch (KeeperException .NoNodeException nne ){
1191+ if (!exists (nodeRemovePath )){
1192+ LOG .info ("Node " + nodeRemovePath + " doesn't exist to delete" );
1193+ } else {
1194+ throw nne ;
1195+ }
1196+ }
11641197 }
11651198
11661199 @ Override
@@ -1200,12 +1233,22 @@ protected synchronized void removeReservationState(String planName,
12001233 LOG .debug ("Removing reservationallocation {} for plan {}" ,
12011234 reservationIdName , planName );
12021235
1203- zkManager .safeDelete (reservationPath , zkAcl , fencingNodePath );
1236+ String path = reservationPath ;
1237+ try {
1238+ zkManager .safeDelete (reservationPath , zkAcl , fencingNodePath );
12041239
1205- List <String > reservationNodes = getChildren (planNodePath );
1240+ List <String > reservationNodes = getChildren (planNodePath );
12061241
1207- if (reservationNodes .isEmpty ()) {
1208- zkManager .safeDelete (planNodePath , zkAcl , fencingNodePath );
1242+ if (reservationNodes .isEmpty ()) {
1243+ path = planNodePath ;
1244+ zkManager .safeDelete (planNodePath , zkAcl , fencingNodePath );
1245+ }
1246+ } catch (KeeperException .NoNodeException nne ){
1247+ if (!exists (path )){
1248+ LOG .info ("Node " + path + " doesn't exist to delete" );
1249+ } else {
1250+ throw nne ;
1251+ }
12091252 }
12101253 }
12111254
0 commit comments