SOLR-8094: HdfsUpdateLog should not replay buffered documents as a replacement to dropping them.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1706681 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2015-10-04 13:54:11 +00:00
parent c4c5e5833c
commit 66ab2d013f
2 changed files with 22 additions and 8 deletions

View File

@ -225,6 +225,9 @@ Bug Fixes
* SOLR-8085: Fix a variety of issues that can result in replicas getting out of sync. (yonik, Mark Miller)
* SOLR-8094: HdfsUpdateLog should not replay buffered documents as a replacement to dropping them.
(Mark Miller)
Optimizations
----------------------

View File

@ -23,8 +23,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicLong;
import org.apache.hadoop.conf.Configuration;
@ -68,13 +66,26 @@ public class HdfsUpdateLog extends UpdateLog {
// allows for it
@Override
public boolean dropBufferedUpdates() {
Future<RecoveryInfo> future = applyBufferedUpdates();
if (future != null) {
try {
future.get();
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
versionInfo.blockUpdates();
try {
if (state != State.BUFFERING) return false;
if (log.isInfoEnabled()) {
log.info("Dropping buffered updates " + this);
}
// since we blocked updates, this synchronization shouldn't strictly be
// necessary.
synchronized (this) {
if (tlog != null) {
// tlog.rollback(recoveryInfo.positionOfStart);
}
}
state = State.ACTIVE;
operationFlags &= ~FLAG_GAP;
} finally {
versionInfo.unblockUpdates();
}
return true;
}