Solr
  1. Solr
  2. SOLR-4417

Look into reopening the IndexWriter on core reload.

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.1
    • Fix Version/s: 4.2, 6.0
    • Component/s: None
    • Labels:
      None

      Description

      This is largely for SOLR-3843, but other smaller reasons as well.

      I thought things had gotten to the point where this would be easy - but it's not so easy because of our real time get support over core reloads it looks.

      That needs to use the old writer - it opens the first searcher after the reload with the old writer - if we then reopen the writer we close that - and a further reopen of the searcher ends up failing due to a closed writer.

      1. SOLR-4417.patch
        1.0 kB
        Mark Miller
      2. SOLR-4417.patch
        0.9 kB
        Mark Miller

        Issue Links

          Activity

          Hide
          Mark Miller added a comment -

          The first approach I test is pretty simple - after starting the new core in a reload, kick of an indexwriter reopen.

          The test that will fail is AnalysisAfterCoreReloadTest.

          if you change SolrCore around around line 749 from:

                // use the (old) writer to open the first searcher
                RefCounted<IndexWriter> iwRef = null;
                if (prev != null) {
                  iwRef = prev.getUpdateHandler().getSolrCoreState().getIndexWriter(null);
                  if (iwRef != null) {
                    final IndexWriter iw = iwRef.get();
                    newReaderCreator = new Callable<DirectoryReader>() {
                      @Override
                      public DirectoryReader call() throws Exception {
                        return DirectoryReader.open(iw, true);
                      }
                    };
                  }
                }
          

          to

                // use the (old) writer to open the first searcher
                if (prev != null) {
                    newReaderCreator = new Callable<DirectoryReader>() {
                      @Override
                      public DirectoryReader call() throws Exception {
                        return DirectoryReader.open(null, true);
                    };
                  }
                }
          

          The test will pass, but TestReload#testGetRealtimeReload will fail.

          Show
          Mark Miller added a comment - The first approach I test is pretty simple - after starting the new core in a reload, kick of an indexwriter reopen. The test that will fail is AnalysisAfterCoreReloadTest. if you change SolrCore around around line 749 from: // use the (old) writer to open the first searcher RefCounted<IndexWriter> iwRef = null ; if (prev != null ) { iwRef = prev.getUpdateHandler().getSolrCoreState().getIndexWriter( null ); if (iwRef != null ) { final IndexWriter iw = iwRef.get(); newReaderCreator = new Callable<DirectoryReader>() { @Override public DirectoryReader call() throws Exception { return DirectoryReader.open(iw, true ); } }; } } to // use the (old) writer to open the first searcher if (prev != null ) { newReaderCreator = new Callable<DirectoryReader>() { @Override public DirectoryReader call() throws Exception { return DirectoryReader.open( null , true ); }; } } The test will pass, but TestReload#testGetRealtimeReload will fail.
          Hide
          Mark Miller added a comment -

          New patch, somewhat works around the issue by reopening a new searcher with the new writer right away.

          Show
          Mark Miller added a comment - New patch, somewhat works around the issue by reopening a new searcher with the new writer right away.
          Hide
          Mark Miller added a comment -

          Let's see how this bakes.

          Show
          Mark Miller added a comment - Let's see how this bakes.
          Hide
          Commit Tag Bot added a comment -

          [trunk commit] Mark Robert Miller
          http://svn.apache.org/viewvc?view=revision&revision=1447084

          SOLR-4417: Reopen the IndexWriter on SolrCore reload.

          Show
          Commit Tag Bot added a comment - [trunk commit] Mark Robert Miller http://svn.apache.org/viewvc?view=revision&revision=1447084 SOLR-4417 : Reopen the IndexWriter on SolrCore reload.
          Hide
          Commit Tag Bot added a comment -

          [branch_4x commit] Mark Robert Miller
          http://svn.apache.org/viewvc?view=revision&revision=1447085

          SOLR-4417: Reopen the IndexWriter on SolrCore reload.

          Show
          Commit Tag Bot added a comment - [branch_4x commit] Mark Robert Miller http://svn.apache.org/viewvc?view=revision&revision=1447085 SOLR-4417 : Reopen the IndexWriter on SolrCore reload.
          Hide
          Uwe Schindler added a comment -

          Closed after release.

          Show
          Uwe Schindler added a comment - Closed after release.

            People

            • Assignee:
              Mark Miller
              Reporter:
              Mark Miller
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development