steveloughran commented on pull request #2069:
URL: https://github.com/apache/hadoop/pull/2069#issuecomment-687247574


   OK, despite my force push losing @jimmy-zuber-amzn 's comments, I agree with 
the points about thread safety. In my head I'd imagined that we'd build that 
implementation map once and then iterate over it, but I can see benefits in 
supporting dynamic addition of new values to both the snapshot and the dynamic 
ones.
   
   Snapshot: add an entry to the map
   Dynamic: add new atomic long etc entries to the appropriate map
   
   this would let us create a minimal snapshot then pass it around, and as it 
was passed around it would collect values, *without you needing to define up 
front all stats to collect*.  This work here needs to be lined up for that with
   iterators of maps being resilient to new values being added.
   
   For the dynamic stuff -> ConcurrentHashMap.
   For Snapshot, it's trickier as they need to be java serializable, so that 
Spark & can can forward them around. There I will have to do one of 
   
   *mark the maps all as transient, and then in read/write data actually save 
then restore the data as treemaps (or just arrays of entries)
   * Make accessors to the iterators synchronized and do a snapshot of the 
iterator. I think that will actually be the easiest approach...I just need to 
make sure the operations to update the maps are also synchronized


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to