Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-5393

remove codec byte[] cloning in BinaryDocValues api

    XMLWordPrintableJSON

Details

    • Task
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • None
    • None
    • None
    • None
    • New

    Description

      I can attack this (at least in trunk/5.0, we can discuss if/when it should happen for 4.x).

      See the mailing list for more discussion. this was done intentionally, to prevent lots of reuse bugs.

      The issue is very simple, lots of old fieldcache-type logic has it because things used to be immutable Strings or because they rely on things being in a large array:

      byte[] b1 = get(doc1);
      byte[] b2 = get(doc2);
      // some code that expects b1 to be unchanged.
      

      Currently each get() internally is cloning the bytes, for safety. but this is really bad for code like faceting (which is going to decompress integers and never needs to save bytes), and its even stupid for things like fieldcomparator (where in general its doing comparisons, and only rarely needs to save a copy of the bytes for later).

      I can address it with lots of tests (i added a lot in general anyway since the time of adding this TODO, but more would make me feel safer).

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              rcmuir Robert Muir
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: