Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

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

Mark Robert Miller66ab2d013f2f
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 7099162f22b..27b2617c935 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -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
----------------------
diff --git a/solr/core/src/java/org/apache/solr/update/HdfsUpdateLog.java b/solr/core/src/java/org/apache/solr/update/HdfsUpdateLog.java
index 746ecf2a511..6a0b6bdea5a 100644
--- a/solr/core/src/java/org/apache/solr/update/HdfsUpdateLog.java
+++ b/solr/core/src/java/org/apache/solr/update/HdfsUpdateLog.java
@@ -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;
}