Github user dsmiley commented on a diff in the pull request:

    https://github.com/apache/lucene-solr/pull/370#discussion_r186196579
  
    --- Diff: solr/core/src/java/org/apache/solr/handler/IndexFetcher.java ---
    @@ -1549,6 +1549,8 @@ public ReplicationHandlerException(String message) {
           this.file = file;
           this.fileName = (String) fileDetails.get(NAME);
           this.size = (Long) fileDetails.get(SIZE);
    +      //Max buf of 1 MB, but we should save memory if the file size is 
smaller
    +      buf = this.size < 1048576 ? new byte[(int) this.size] : new 
byte[1024 * 1024];
    --- End diff --
    
    I observe 1048576 is 1024*1024.
    Lets define a constant DEFAULT_BUF_SIZE = 1024 * 1024  (or perhaps call 
MAX_BUF_SIZE?) and then use this constant twice here.  And you can simply use 
`Math.min(this.size(), DEFAULT_BUF_SIZE)`.  No need for any comment; it's plain 
enough (IMO).


---

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

Reply via email to