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

DocumentWriterFlushControl missing explicit sync on write

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • None
    • 9.0
    • core/index
    • None

    Description

      checkoutAndBlock is not synchronized, but has a non-atomic write to numPending. Meanwhile, all of the other writes to numPending are in sync methods.

      In this case it turns out to be ok because all of the code paths calling this method are already sync:

      synchronized doAfterDocument -> checkout -> checkoutAndBlock
      checkoutLargestNonPendingWriter -> synchronized(this) -> checkout -> checkoutAndBlock

      If we make synchronized checkoutAndBlock that protects us against future changes, shouldn't cause any performance impact since the code paths will already be going through a sync block, and will make an IntelliJ warning go away.

      Attachments

        Issue Links

          Activity

            People

              mdrob Mike Drob
              mdrob Mike Drob
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h