You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by da...@apache.org on 2018/08/06 04:15:47 UTC
[14/48] lucene-solr:jira/http2: SOLR-12412: Leak transaction log on
tragic event
SOLR-12412: Leak transaction log on tragic event
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/eada799f
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/eada799f
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/eada799f
Branch: refs/heads/jira/http2
Commit: eada799f576a2a1cb6dd16179a34ef283cdb4101
Parents: c9e3c45
Author: Cao Manh Dat <da...@apache.org>
Authored: Wed Aug 1 07:13:41 2018 +0700
Committer: Cao Manh Dat <da...@apache.org>
Committed: Wed Aug 1 07:13:41 2018 +0700
----------------------------------------------------------------------
solr/core/src/java/org/apache/solr/update/UpdateLog.java | 6 ++++++
.../org/apache/solr/cloud/LeaderTragicEventTest.java | 11 +++++------
2 files changed, 11 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/eada799f/solr/core/src/java/org/apache/solr/update/UpdateLog.java
----------------------------------------------------------------------
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 46d8435..1abf23c 100644
--- a/solr/core/src/java/org/apache/solr/update/UpdateLog.java
+++ b/solr/core/src/java/org/apache/solr/update/UpdateLog.java
@@ -188,6 +188,7 @@ public class UpdateLog implements PluginInfoInitialized, SolrMetricProducer {
protected TransactionLog bufferTlog;
protected TransactionLog tlog;
protected TransactionLog prevTlog;
+ protected TransactionLog prevTlogOnPrecommit;
protected final Deque<TransactionLog> logs = new LinkedList<>(); // list of recent logs, newest first
protected LinkedList<TransactionLog> newestLogsOnStartup = new LinkedList<>();
protected int numOldRecords; // number of records in the recent logs
@@ -810,6 +811,11 @@ public class UpdateLog implements PluginInfoInitialized, SolrMetricProducer {
// since document additions can happen concurrently with commit, create
// a new transaction log first so that we know the old one is definitely
// in the index.
+ if (prevTlog != null) {
+ // postCommit for prevTlog is not called, may be the index is corrupted
+ // if we override prevTlog value, the correspond tlog will be leaked, close it first
+ postCommit(cmd);
+ }
prevTlog = tlog;
tlog = null;
id++;
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/eada799f/solr/core/src/test/org/apache/solr/cloud/LeaderTragicEventTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/LeaderTragicEventTest.java b/solr/core/src/test/org/apache/solr/cloud/LeaderTragicEventTest.java
index e432493..83bd3c3 100644
--- a/solr/core/src/test/org/apache/solr/cloud/LeaderTragicEventTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/LeaderTragicEventTest.java
@@ -38,6 +38,7 @@ import org.apache.solr.common.cloud.ClusterStateUtil;
import org.apache.solr.common.cloud.DocCollection;
import org.apache.solr.common.cloud.Replica;
import org.apache.solr.common.cloud.Slice;
+import org.apache.solr.common.util.ObjectReleaseTracker;
import org.apache.solr.core.CoreContainer;
import org.apache.solr.core.DirectoryFactory;
import org.apache.solr.core.MockDirectoryFactory;
@@ -181,15 +182,13 @@ public class LeaderTragicEventTest extends SolrCloudTestCase {
Replica oldLeader = corruptLeader(collection, new ArrayList<>());
- //TODO better way to test this
- Thread.sleep(5000);
- Replica leader = getCollectionState(collection).getSlice("shard1").getLeader();
- assertEquals(leader.getName(), oldLeader.getName());
-
if (otherReplicaJetty != null) {
- // won't be able to do anything here, since this replica can't recovery from the leader
otherReplicaJetty.start();
}
+ //TODO better way to test this
+ Thread.sleep(2000);
+ Replica leader = getCollectionState(collection).getSlice("shard1").getLeader();
+ assertEquals(leader.getName(), oldLeader.getName());
} finally {
CollectionAdminRequest.deleteCollection(collection).process(cluster.getSolrClient());
}