@@ -316,32 +316,40 @@ private void checkAndDeallocateAppUser(String appUser, LocalUserInfo localUserIn
316
316
String localUser = appUserToLocalUser .remove (appUser ).localUser ;
317
317
allocated .set (localUserInfo .localUserIndex , false );
318
318
if (delService != null ) {
319
- // check if node manager usercache/<appUser>/appcache folder exists
319
+ // check and delete these node manager folders, which will cause permission issues later:
320
+ // usercache/<appUser>/appcache
321
+ // usercache/<appUser>/filecche
320
322
for (String localDir : nmLocalDirs ) {
321
323
Path usersDir = new Path (localDir , ContainerLocalizer .USERCACHE );
322
324
Path userDir = new Path (usersDir , appUser );
323
325
Path userAppCacheDir = new Path (userDir , ContainerLocalizer .APPCACHE );
324
- FileStatus status ;
325
- try {
326
- status = lfs .getFileStatus (userAppCacheDir );
327
- }
328
- catch (FileNotFoundException fs ) {
329
- status = null ;
330
- }
331
- catch (IOException ie ) {
332
- String msg = "Could not get file status for local dir " + userDir ;
333
- LOG .warn (msg , ie );
334
- throw new YarnRuntimeException (msg , ie );
335
- }
336
- if (status != null ) {
337
- FileDeletionTask delTask = new FileDeletionTask (delService , localUser ,
338
- userAppCacheDir , null );
339
- delService .delete (delTask );
326
+ Path userFileCacheDir = new Path (userDir , ContainerLocalizer .FILECACHE );
327
+ ArrayList <Path > toDelete = new ArrayList <Path >();
328
+ toDelete .add (userAppCacheDir );
329
+ toDelete .add (userFileCacheDir );
330
+
331
+ for (Path dir : toDelete ) {
332
+ FileStatus status = null ;
333
+ try {
334
+ status = lfs .getFileStatus (userAppCacheDir );
335
+ }
336
+ catch (FileNotFoundException fs ) {
337
+ }
338
+ catch (IOException ie ) {
339
+ String msg = "Could not get file status for local dir " + dir ;
340
+ LOG .warn (msg , ie );
341
+ throw new YarnRuntimeException (msg , ie );
342
+ }
343
+ if (status != null ) {
344
+ FileDeletionTask delTask = new FileDeletionTask (delService , localUser ,
345
+ dir , null );
346
+ delService .delete (delTask );
347
+ }
340
348
}
341
349
}
342
350
}
343
351
LOG .info ("Deallocated local user index " + localUserInfo .localUserIndex +
344
352
" for appUser " + appUser );
345
353
}
346
354
}
347
- }
355
+ }
0 commit comments