Change log level to warn for optimistic locking failure error (#2957)

#### What type of PR is this?

/kind improvement
#### What this PR does / why we need it:

/kind api-change

#### Which issue(s) this PR fixes:
Fixes #2591

#### Special notes for your reviewer:

#### Does this PR introduce a user-facing change?
```release-note
NONE
```
pull/2962/merge
will 2022-12-16 15:09:49 +08:00 committed by GitHub
parent c90f19211f
commit 64550d235f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 3 deletions

View File

@ -11,6 +11,7 @@ import java.util.function.Supplier;
import java.util.stream.IntStream;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.concurrent.BasicThreadFactory;
import org.springframework.dao.OptimisticLockingFailureException;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.StopWatch;
@ -167,9 +168,14 @@ public class DefaultController<R> implements Controller {
log.trace(watch.toString());
}
} catch (Throwable t) {
if (t instanceof OptimisticLockingFailureException) {
log.warn("Optimistic locking failure when reconciling request: {}/{}",
this.name, entry.getEntry());
} else {
log.error("Reconciler in " + this.name
+ " aborted with an error, re-enqueuing...",
t);
}
result = new Reconciler.Result(true, null);
} finally {
queue.done(entry.getEntry());