[ 
https://issues.apache.org/jira/browse/YARN-8680?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16603616#comment-16603616
 ] 

Jason Lowe commented on YARN-8680:
----------------------------------

Thanks for updating the patch!

seekPastPrefix needs to handle DBException and translate it into IOException.

seekPastPrefix is calling peekNext without knowing if there is a valid next to 
peek.  The code needs to call hasNext before calling peekNext, and currently 
the code does this in reverse order.

Nit: In loadUserLocalizedResources I think it would be more readable to flip 
the {{if}} statement within the while loop so we break when the keyPrefix does 
not match.  This matches the style used elsewhere and removes the need to 
indent the majority of the code in the while loop an extra level.

loadUserLocalizedResources computes key.substring(0, appIdEndPos+1) in two 
consecutive lines.  This should be cached in a local variable to increase 
performance and reduce unnecessary garbage.

bq. This is a bit complex, as LocalTrackerState is present in 
RecoveredLocalizationState and RecoveredUserResources and the way these class 
objects are initialized the LocalTrackerState of respective class object is 
assigned/initialized later than they are created/intialized.

It should be straightforward to remove the default constructor and replace it 
with a constructor that takes the two iterators as arguments, copying those 
parameters to the corresponding final private fields.  The default constructor 
invocations in NMStateStoreService can be replaced with 
LocalResourceTrackerState(null, null) since that's effectively what it's doing 
in the default constructor.  Everywhere else that's calling the setter methods 
does so immediately after calling the LocalResourceTrackerState default 
constructor, so those can be replaced with the new parameterized constructor, 
removing the need for setter methods on LocalResourceTrackerState.


> YARN NM: Implement Iterable Abstraction for LocalResourceTrackerstate
> ---------------------------------------------------------------------
>
>                 Key: YARN-8680
>                 URL: https://issues.apache.org/jira/browse/YARN-8680
>             Project: Hadoop YARN
>          Issue Type: Improvement
>          Components: yarn
>            Reporter: Pradeep Ambati
>            Assignee: Pradeep Ambati
>            Priority: Critical
>         Attachments: YARN-8680.00.patch, YARN-8680.01.patch, 
> YARN-8680.02.patch
>
>
> Similar to YARN-8242, implement iterable abstraction for 
> LocalResourceTrackerState to load completed and in progress resources when 
> needed rather than loading them all at a time for a respective state.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to