risdenk commented on a change in pull request #471: SOLR-8335 HdfsLockFactory
should eventually release index after crash.
URL: https://github.com/apache/lucene-solr/pull/471#discussion_r263850196
##########
File path:
solr/core/src/test/org/apache/solr/store/hdfs/HdfsLockFactoryTest.java
##########
@@ -17,46 +17,173 @@
package org.apache.solr.store.hdfs;
import java.io.IOException;
+import java.lang.invoke.MethodHandles;
+import java.net.ConnectException;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Delayed;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.Consumer;
+import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hdfs.DistributedFileSystem;
import org.apache.hadoop.hdfs.MiniDFSCluster;
+import org.apache.hadoop.hdfs.server.namenode.NameNode;
import org.apache.lucene.store.Lock;
+import org.apache.lucene.store.LockLostException;
import org.apache.lucene.store.LockObtainFailedException;
+import org.apache.lucene.util.TestRuleRestoreSystemProperties;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.cloud.hdfs.HdfsTestUtil;
import org.apache.solr.util.BadHdfsThreadsFilter;
+import org.junit.After;
import org.junit.AfterClass;
+import org.junit.Before;
import org.junit.BeforeClass;
+import org.junit.Rule;
import org.junit.Test;
+import org.mockito.internal.util.reflection.FieldSetter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static java.util.Arrays.asList;
+import static
org.apache.solr.store.hdfs.HdfsLockFactory.DEFAULT_LOCK_HOLD_TIMEOUT;
+import static org.apache.solr.store.hdfs.HdfsLockFactory.DEFAULT_UPDATE_DELAY;
+import static org.apache.solr.store.hdfs.HdfsLockFactory.LOCK_HOLD_TIMEOUT_KEY;
+import static org.mockito.BDDMockito.given;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyLong;
+import static org.mockito.Mockito.mock;
-import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
@ThreadLeakFilters(defaultFilters = true, filters = {
BadHdfsThreadsFilter.class // hdfs currently leaks thread(s)
})
public class HdfsLockFactoryTest extends SolrTestCaseJ4 {
-
+ private static final Logger log =
LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+
private static MiniDFSCluster dfsCluster;
+ private static NameNode nameNode;
+ private static Configuration nameNodeConf;
+ private long waitTime = 0;
+ private List<ScheduledTaskStub> allTasks = new LinkedList<>();
+ private HdfsDirectory dir;
+ private Path lockPath;
+ private HdfsLockFactory.HdfsLock lock = null;
+ private HdfsLockFactory.HdfsLock lock2 = null;
+ private Exception latestException = null;
+ private List<HdfsLockFactory.HdfsLock> allLocks = new LinkedList<>();
+ private static MiniDFSCluster.DataNodeProperties dataNodeProperties;
+
+ @Rule
+ public TestRuleRestoreSystemProperties p = new
TestRuleRestoreSystemProperties(LOCK_HOLD_TIMEOUT_KEY);
Review comment:
Is this necessary?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]