public void cleanupSessionTempBlocks ( long sessionId , List < Long > tempBlockIds ) { Set < Long > sessionTempBlocks = mSessionIdToTempBlockIdsMap . get ( sessionId ) ; // The session's temporary blocks have already been removed. if ( sessionTempBlocks == null ) { return ; } for ( Long tempBlockId : tempBlockIds ) { if ( ! mBlockIdToTempBlockMap . containsKey ( tempBlockId ) ) { // This temp block does not exist in this dir, this is expected for some blocks since the // input list is across all dirs continue ; } sessionTempBlocks . remove ( tempBlockId ) ; TempBlockMeta tempBlockMeta = mBlockIdToTempBlockMap . remove ( tempBlockId ) ; if ( tempBlockMeta != null ) { reclaimSpace ( tempBlockMeta . getBlockSize ( ) , false ) ; } else { LOG . error ( "Cannot find blockId {} when cleanup sessionId {}" , tempBlockId , sessionId ) ; } } if ( sessionTempBlocks . isEmpty ( ) ) { mSessionIdToTempBlockIdsMap . remove ( sessionId ) ; } else { // This may happen if the client comes back during clean up and creates more blocks or some // temporary blocks failed to be deleted LOG . warn ( "Blocks still owned by session {} after cleanup." , sessionId ) ; } }
Cleans up the temp block metadata for each block id passed in .