dsmiley commented on code in PR #2548:
URL: https://github.com/apache/solr/pull/2548#discussion_r1664881486
##########
solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java:
##########
@@ -652,35 +631,35 @@ private long doWaitForDependentUpdates(
AddUpdateCommand cmd,
long versionOnUpdate,
boolean isReplayOrPeersync,
- VersionBucket bucket,
+ Condition condition,
TimeOut waitTimeout) {
- long lastFoundVersion;
- try {
- Long lookedUpVersion = vinfo.lookupVersion(cmd.getIndexedId());
- lastFoundVersion = lookedUpVersion == null ? 0L : lookedUpVersion;
+ Long lookedUpVersion = vinfo.lookupVersion(cmd.getIndexedId());
+ long lastFoundVersion = lookedUpVersion == null ? 0L : lookedUpVersion;
- if (Math.abs(lastFoundVersion) < cmd.prevVersion) {
- if (log.isDebugEnabled()) {
- log.debug(
- "Re-ordered inplace update. version={}, prevVersion={},
lastVersion={}, replayOrPeerSync={}, id={}",
- (cmd.getVersion() == 0 ? versionOnUpdate : cmd.getVersion()),
- cmd.prevVersion,
- lastFoundVersion,
- isReplayOrPeersync,
- cmd.getPrintableId());
- }
+ if (Math.abs(lastFoundVersion) < cmd.prevVersion) {
+ if (log.isDebugEnabled()) {
+ log.debug(
+ "Re-ordered inplace update. version={}, prevVersion={},
lastVersion={}, replayOrPeerSync={}, id={}",
+ (cmd.getVersion() == 0 ? versionOnUpdate : cmd.getVersion()),
+ cmd.prevVersion,
+ lastFoundVersion,
+ isReplayOrPeersync,
+ cmd.getPrintableId());
}
+ }
- while (Math.abs(lastFoundVersion) < cmd.prevVersion &&
!waitTimeout.hasTimedOut()) {
- long timeLeftInNanos = waitTimeout.timeLeft(TimeUnit.NANOSECONDS);
- if (timeLeftInNanos > 0) { // 0 means: wait forever until notified,
but we don't want that.
- bucket.awaitNanos(timeLeftInNanos);
+ while (Math.abs(lastFoundVersion) < cmd.prevVersion &&
!waitTimeout.hasTimedOut()) {
+ long timeLeftInNanos = waitTimeout.timeLeft(TimeUnit.NANOSECONDS);
+ if (timeLeftInNanos > 0) { // 0 means: wait forever until notified, but
we don't want that.
+ try {
+ condition.await(timeLeftInNanos, TimeUnit.NANOSECONDS);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
Review Comment:
Good catch.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]