You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "nick-boss-tech (via GitHub)" <gi...@apache.org> on 2026/09/23 15:47:42 UTC

[PR] SOLR-18135: Preserve merge exception; stop merge timer only once [solr]

nick-boss-tech opened a new pull request, #4939:
URL: https://github.com/apache/solr/pull/4939

   ## Summary
   
   Failed merges could double-stop the OTEL merge timer. With assertions enabled, the second stop could replace the original merge exception with an `AssertionError` and prevent failed-merge metrics from being recorded correctly.
   
   This change makes `updateMergeMetrics` the sole owner of merge-timer completion. Success metrics are recorded only after `super.merge(...)` returns, so a metrics failure after a successful Lucene merge is not classified as a failed merge.
   
   ## Tests
   
   - `:solr:core:test --tests org.apache.solr.update.SolrIndexMetricsTest`
   
   JIRA: SOLR-18135
   
   ## AI assistance
   
   OpenAI Codex assisted with research, implementation, and preparation of this contribution. The contributor reviewed the resulting diff and remains responsible for the final contribution.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18135: Preserve merge exception; stop merge timer only once [solr]

Posted by "dsmiley (via GitHub)" <gi...@apache.org>.
dsmiley commented on code in PR #4939:
URL: https://github.com/apache/solr/pull/4939#discussion_r4085688990


##########
changelog/unreleased/SOLR-18135.yml:
##########
@@ -0,0 +1,7 @@
+title: Preserve the original merge exception instead of double-stopping the merge timer.

Review Comment:
   use words someone else might understand.  LIke:  Fixed double-stop of merge timer when segment merging failed.  Was a blocking issue when assertions are enabled.
   
   Thus it's apparent to basically any user it doesn't matter to them as nobody enables assertions in prod.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18135: Preserve merge exception; stop merge timer only once [solr]

Posted by "nick-boss-tech (via GitHub)" <gi...@apache.org>.
nick-boss-tech commented on code in PR #4939:
URL: https://github.com/apache/solr/pull/4939#discussion_r4085411880


##########
solr/core/src/test-files/solr/collection1/conf/solrconfig-indexmetrics-failingmerge.xml:
##########


Review Comment:
   Agreed. The follow-up commit 4b54796 reuses the existing solrconfig-indexmetrics.xml and sets the merge policy and scheduler only for this test. The focused SolrIndexMetricsTest suite passed locally.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18135: Preserve merge exception; stop merge timer only once [solr]

Posted by "nick-boss-tech (via GitHub)" <gi...@apache.org>.
nick-boss-tech commented on code in PR #4939:
URL: https://github.com/apache/solr/pull/4939#discussion_r4085411880


##########
solr/core/src/test-files/solr/collection1/conf/solrconfig-indexmetrics-failingmerge.xml:
##########


Review Comment:
   Agreed. The test now reuses the existing solrconfig-indexmetrics.xml and sets the merge policy and scheduler only for this test. The focused SolrIndexMetricsTest suite passed locally.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18135: Preserve merge exception; stop merge timer only once [solr]

Posted by "nick-boss-tech (via GitHub)" <gi...@apache.org>.
nick-boss-tech commented on code in PR #4939:
URL: https://github.com/apache/solr/pull/4939#discussion_r4085828251


##########
changelog/unreleased/SOLR-18135.yml:
##########
@@ -0,0 +1,7 @@
+title: Preserve the original merge exception instead of double-stopping the merge timer.

Review Comment:
   Agreed. I simplified the changelog title to "Fix merge timer double-stop when segment merging fails." I also removed the dedicated regression test and its test-only merge policy so the PR stays focused on the production fix.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18135: Preserve merge exception; stop merge timer only once [solr]

Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on PR #4939:
URL: https://github.com/apache/solr/pull/4939#issuecomment-5814972974

   never mind, i see @dsmiley comment...  and for a moment I thought github was broken!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18135: Preserve merge exception; stop merge timer only once [solr]

Posted by "nick-boss-tech (via GitHub)" <gi...@apache.org>.
nick-boss-tech commented on code in PR #4939:
URL: https://github.com/apache/solr/pull/4939#discussion_r4085345015


##########
solr/core/src/java/org/apache/solr/update/SolrIndexWriter.java:
##########
@@ -229,16 +217,14 @@ protected void merge(MergePolicy.OneMerge merge) throws IOException {
         updateMergeMetrics(totalNumDocs, deletedDocs, segmentsCount, false, false, null);
     try {
       super.merge(merge);
-      updateMergeMetrics(totalNumDocs, deletedDocs, segmentsCount, true, false, timer);
     } catch (Throwable t) {
-      if (timer != null) {
-        timer.stop();
-      }
+      // SOLR-18135: updateMergeMetrics is the only stop().

Review Comment:
   Good point. Removed the ticket-specific source comment in 4b54796.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18135: Preserve merge exception; stop merge timer only once [solr]

Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on PR #4939:
URL: https://github.com/apache/solr/pull/4939#issuecomment-5814965459

   Is it just me, or did the test go away, and we just have two files, changelog and the fix?   Did we decide the test really wasn't needed?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18135: Preserve merge exception; stop merge timer only once [solr]

Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh merged PR #4939:
URL: https://github.com/apache/solr/pull/4939


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18135: Preserve merge exception; stop merge timer only once [solr]

Posted by "nick-boss-tech (via GitHub)" <gi...@apache.org>.
nick-boss-tech commented on code in PR #4939:
URL: https://github.com/apache/solr/pull/4939#discussion_r4088702720


##########
changelog/unreleased/SOLR-18135.yml:
##########
@@ -0,0 +1,7 @@
+title: Preserve the original merge exception instead of double-stopping the merge timer.

Review Comment:
   I updated the title to be more descriptive like you recommended. It passes Spotless after removing the test.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18135: Preserve merge exception; stop merge timer only once [solr]

Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on code in PR #4939:
URL: https://github.com/apache/solr/pull/4939#discussion_r4084828141


##########
solr/core/src/java/org/apache/solr/update/SolrIndexWriter.java:
##########
@@ -229,16 +217,14 @@ protected void merge(MergePolicy.OneMerge merge) throws IOException {
         updateMergeMetrics(totalNumDocs, deletedDocs, segmentsCount, false, false, null);
     try {
       super.merge(merge);
-      updateMergeMetrics(totalNumDocs, deletedDocs, segmentsCount, true, false, timer);
     } catch (Throwable t) {
-      if (timer != null) {
-        timer.stop();
-      }
+      // SOLR-18135: updateMergeMetrics is the only stop().

Review Comment:
   no need for this ticket...   once this is merged, no one will care about SOLR-18135!



##########
solr/core/src/test-files/solr/collection1/conf/solrconfig-indexmetrics-failingmerge.xml:
##########


Review Comment:
   DO we KNOW that we need to add a new solrconfig to support the tests, and non of the existing ones can do it?



##########
solr/core/src/test-files/solr/collection1/conf/solrconfig-indexmetrics-failingmerge.xml:
##########


Review Comment:
   I know we have a bunch of system properties that let you change test behaviors..



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org