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

Improve the data structure used in ReaderAndLiveDocs to hold the updates

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 4.6, 6.0
    • core/index
    • None
    • New, Patch Available

    Description

      Currently ReaderAndLiveDocs holds the updates in two structures:

      Map<String,Map<Integer,Long>>
      Holds a mapping from each field, to all docs that were updated and their values. This structure is updated when applyDeletes is called, and needs to satisfy several requirements:

      1. Un-ordered writes: if a field "f" is updated by two terms, termA and termB, in that order, and termA affects doc=100 and termB doc=2, then the updates are applied in that order, meaning we cannot rely on updates coming in order.
      2. Same document may be updated multiple times, either by same term (e.g. several calls to IW.updateNDV) or by different terms. Last update wins.
      3. Sequential read: when writing the updates to the Directory (fieldsConsumer), we iterate on the docs in-order and for each one check if it's updated and if not, pull its value from the current DV.
      4. A single update may affect several million documents, therefore need to be efficient w.r.t. memory consumption.

      Map<Integer,Map<String,Long>>
      Holds a mapping from a document, to all the fields that it was updated in and the updated value for each field. This is used by IW.commitMergedDeletes to apply the updates that came in while the segment was merging. The requirements this structure needs to satisfy are:

      1. Access in doc order: this is how commitMergedDeletes works.
      2. One-pass: we visit a document once (currently) and so if we can, it's better if we know all the fields in which it was updated. The updates are applied to the merged ReaderAndLiveDocs (where they are stored in the first structure mentioned above).

      Comments with proposals will follow next.

      Attachments

        1. LUCENE-5248.patch
          75 kB
          Shai Erera
        2. LUCENE-5248.patch
          70 kB
          Shai Erera
        3. LUCENE-5248.patch
          68 kB
          Shai Erera
        4. LUCENE-5248.patch
          6 kB
          Shai Erera
        5. LUCENE-5248.patch
          4 kB
          Shai Erera

        Activity

          People

            shaie Shai Erera
            shaie Shai Erera
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: