This is an automated email from the ASF dual-hosted git repository.
cpoerschke pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/main by this push:
new fe66065 SOLR-15983: change UpdateLog.RecoveryInfo.errors to
AtomicInteger (#609)
fe66065 is described below
commit fe6606583189ea9196d9345521f3f5f76752be3c
Author: Christine Poerschke <[email protected]>
AuthorDate: Mon Feb 14 11:09:53 2022 +0000
SOLR-15983: change UpdateLog.RecoveryInfo.errors to AtomicInteger (#609)
---
.../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 8d0d8e0..99155ae 100644
--- a/solr/core/src/java/org/apache/solr/update/UpdateLog.java
+++ b/solr/core/src/java/org/apache/solr/update/UpdateLog.java
@@ -176,7 +176,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;
@@ -460,7 +460,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;
}
@@ -1790,11 +1790,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
@@ -1969,11 +1969,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?
}
@@ -1992,7 +1992,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);
}
@@ -2005,7 +2005,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);
@@ -2066,7 +2066,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) {
@@ -2074,8 +2074,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();
}
@@ -2089,15 +2089,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);
}
}
}