This is an automated email from the ASF dual-hosted git repository. cpoerschke pushed a commit to branch branch_9_0 in repository https://gitbox.apache.org/repos/asf/solr.git
commit d23c5a3193d9183d1b16d63800e3b18d26b56e50 Author: Christine Poerschke <[email protected]> AuthorDate: Mon Feb 14 11:09:53 2022 +0000 SOLR-15983: change UpdateLog.RecoveryInfo.errors to AtomicInteger (#609) (cherry picked from commit fe6606583189ea9196d9345521f3f5f76752be3c) (cherry picked from commit 7d911d81421ca91e7e7e6d6da1f9043712426c4a) --- .../src/java/org/apache/solr/update/UpdateLog.java | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/solr/core/src/java/org/apache/solr/update/UpdateLog.java b/solr/core/src/java/org/apache/solr/update/UpdateLog.java index ea8bf27..f4c4cc0 100644 --- a/solr/core/src/java/org/apache/solr/update/UpdateLog.java +++ b/solr/core/src/java/org/apache/solr/update/UpdateLog.java @@ -169,7 +169,7 @@ public class UpdateLog implements PluginInfoInitialized, SolrMetricProducer { public int adds; public int deletes; public int deleteByQuery; - public int errors; + public AtomicInteger errors = new AtomicInteger(0); public boolean failed; @@ -453,7 +453,7 @@ public class UpdateLog implements PluginInfoInitialized, SolrMetricProducer { return 0; } else if (state == State.APPLYING_BUFFERED) { // numRecords counts header as a record - return tlog.numRecords() - 1 - recoveryInfo.adds - recoveryInfo.deleteByQuery - recoveryInfo.deletes - recoveryInfo.errors; + return tlog.numRecords() - 1 - recoveryInfo.adds - recoveryInfo.deleteByQuery - recoveryInfo.deletes - recoveryInfo.errors.get(); } else { return 0; } @@ -1776,11 +1776,11 @@ public class UpdateLog implements PluginInfoInitialized, SolrMetricProducer { SolrException.log(log, e); recoveryInfo.failed = true; } else { - recoveryInfo.errors++; + recoveryInfo.errors.incrementAndGet(); SolrException.log(log, e); } } catch (Exception e) { - recoveryInfo.errors++; + recoveryInfo.errors.incrementAndGet(); SolrException.log(log, e); } finally { // change the state while updates are still blocked to prevent races @@ -1955,11 +1955,11 @@ public class UpdateLog implements PluginInfoInitialized, SolrMetricProducer { // XXX should not happen? } } catch (ClassCastException cl) { - recoveryInfo.errors++; + recoveryInfo.errors.incrementAndGet(); loglog.warn("REPLAY_ERR: Unexpected log entry or corrupt log. Entry={}", o, cl); // would be caused by a corrupt transaction log } catch (Exception ex) { - recoveryInfo.errors++; + recoveryInfo.errors.incrementAndGet(); loglog.warn("REPLAY_ERR: Exception replaying log", ex); // something wrong with the request? } @@ -1978,7 +1978,7 @@ public class UpdateLog implements PluginInfoInitialized, SolrMetricProducer { if (debug) log.debug("commit {}", cmd); uhandler.commit(cmd); // this should cause a commit to be added to the incomplete log and avoid it being replayed again after a restart. } catch (IOException ex) { - recoveryInfo.errors++; + recoveryInfo.errors.incrementAndGet(); loglog.error("Replay exception: final commit.", ex); } @@ -1991,7 +1991,7 @@ public class UpdateLog implements PluginInfoInitialized, SolrMetricProducer { try { proc.finish(); } catch (IOException ex) { - recoveryInfo.errors++; + recoveryInfo.errors.incrementAndGet(); loglog.error("Replay exception: finish()", ex); } finally { IOUtils.closeQuietly(proc); @@ -2052,7 +2052,7 @@ public class UpdateLog implements PluginInfoInitialized, SolrMetricProducer { proc.processDelete((DeleteUpdateCommand) cmd); } } catch (IOException e) { - recoveryInfo.errors++; + recoveryInfo.errors.incrementAndGet(); loglog.warn("REPLAY_ERR: IOException reading log", e); // could be caused by an incomplete flush if recovering from log } catch (SolrException e) { @@ -2060,8 +2060,8 @@ public class UpdateLog implements PluginInfoInitialized, SolrMetricProducer { exceptionHolder.compareAndSet(null, e); return; } - recoveryInfo.errors++; - loglog.warn("REPLAY_ERR: IOException reading log", e); + recoveryInfo.errors.incrementAndGet(); + loglog.warn("REPLAY_ERR: SolrException reading log", e); } finally { pendingTasks.decrementAndGet(); } @@ -2075,15 +2075,15 @@ public class UpdateLog implements PluginInfoInitialized, SolrMetricProducer { proc.processDelete((DeleteUpdateCommand) cmd); } } catch (IOException e) { - recoveryInfo.errors++; + recoveryInfo.errors.incrementAndGet(); loglog.warn("REPLAY_ERR: IOException replaying log", e); // could be caused by an incomplete flush if recovering from log } catch (SolrException e) { if (e.code() == ErrorCode.SERVICE_UNAVAILABLE.code) { throw e; } - recoveryInfo.errors++; - loglog.warn("REPLAY_ERR: IOException replaying log", e); + recoveryInfo.errors.incrementAndGet(); + loglog.warn("REPLAY_ERR: SolrException replaying log", e); } } }
