Skip to content

Apache Lucene open-source search software

SOLR-4033: Consistently use the solrconfig.xml lockType everywhere.

Mark Robert Miller82d0ed529a36
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 2a8558e9a9a..42e33f9a105 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -72,7 +72,9 @@ New Features
Additional Work:
- SOLR-4032: Files larger than an internal buffer size fail to replicate.
(Mark Miller, Markus Jelsma)
-
+ - SOLR-4033: Consistently use the solrconfig.xml lockType everywhere.
+ (Mark Miller, Markus Jelsma)
+
* SOLR-1972: Add extra statistics to RequestHandlers - 5 & 15-minute reqs/sec
rolling averages; median, 75th, 95th, 99th, 99.9th percentile request times
(Alan Woodward, Shawn Heisey, Adrien Grand)
diff --git a/solr/core/src/java/org/apache/solr/core/SolrCore.java b/solr/core/src/java/org/apache/solr/core/SolrCore.java
index 6fdf82b3dda..28e60ee9f03 100644
--- a/solr/core/src/java/org/apache/solr/core/SolrCore.java
+++ b/solr/core/src/java/org/apache/solr/core/SolrCore.java
@@ -235,7 +235,7 @@ public final class SolrCore implements SolrInfoMBean {
Properties p = new Properties();
Directory dir = null;
try {
- dir = getDirectoryFactory().get(getDataDir(), null);
+ dir = getDirectoryFactory().get(getDataDir(), getSolrConfig().indexConfig.lockType);
if (dir.fileExists("index.properties")){
final IndexInput input = dir.openInput("index.properties", IOContext.DEFAULT);
diff --git a/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java b/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java
index cfd45db3ace..1ecb13632e1 100644
--- a/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java
@@ -361,7 +361,7 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw
// use a set to workaround possible Lucene bug which returns same file
// name multiple times
Collection<String> files = new HashSet<String>(commit.getFileNames());
- dir = core.getDirectoryFactory().get(core.getNewIndexDir(), null);
+ dir = core.getDirectoryFactory().get(core.getNewIndexDir(), core.getSolrConfig().indexConfig.lockType);
try {
for (String fileName : files) {
@@ -467,7 +467,7 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw
Directory dir;
long size = 0;
try {
- dir = core.getDirectoryFactory().get(core.getNewIndexDir(), null);
+ dir = core.getDirectoryFactory().get(core.getNewIndexDir(), core.getSolrConfig().indexConfig.lockType);
try {
size = DirectoryFactory.sizeOfDirectory(dir);
} finally {
diff --git a/solr/core/src/java/org/apache/solr/handler/SnapPuller.java b/solr/core/src/java/org/apache/solr/handler/SnapPuller.java
index aa8c87d1a56..c45d306c89a 100644
--- a/solr/core/src/java/org/apache/solr/handler/SnapPuller.java
+++ b/solr/core/src/java/org/apache/solr/handler/SnapPuller.java
@@ -371,10 +371,10 @@ public class SnapPuller {
String tmpIdxDirName = "index." + new SimpleDateFormat(SnapShooter.DATE_FMT, Locale.ROOT).format(new Date());
tmpIndex = createTempindexDir(core, tmpIdxDirName);
- tmpIndexDir = core.getDirectoryFactory().get(tmpIndex, null);
+ tmpIndexDir = core.getDirectoryFactory().get(tmpIndex, core.getSolrConfig().indexConfig.lockType);
// make sure it's the newest known index dir...
- indexDir = core.getDirectoryFactory().get(core.getNewIndexDir(), null);
+ indexDir = core.getDirectoryFactory().get(core.getNewIndexDir(), core.getSolrConfig().indexConfig.lockType);
Directory oldDirectory = null;
try {
@@ -709,7 +709,7 @@ public class SnapPuller {
String indexDir = solrCore.getIndexDir();
// it's okay to use null for lock factory since we know this dir will exist
- Directory dir = solrCore.getDirectoryFactory().get(indexDir, null);
+ Directory dir = solrCore.getDirectoryFactory().get(indexDir, solrCore.getSolrConfig().indexConfig.lockType);
try {
for (Map<String,Object> file : filesToDownload) {
if (!dir.fileExists((String) file.get(NAME)) || downloadCompleteIndex) {
@@ -832,7 +832,7 @@ public class SnapPuller {
Properties p = new Properties();
Directory dir = null;
try {
- dir = solrCore.getDirectoryFactory().get(solrCore.getDataDir(), null);
+ dir = solrCore.getDirectoryFactory().get(solrCore.getDataDir(), solrCore.getSolrConfig().indexConfig.lockType);
if (dir.fileExists("index.properties")){
final IndexInput input = dir.openInput("index.properties", IOContext.DEFAULT);
diff --git a/solr/core/src/java/org/apache/solr/handler/SnapShooter.java b/solr/core/src/java/org/apache/solr/handler/SnapShooter.java
index 9039aeaa34e..0e50f3726ae 100644
--- a/solr/core/src/java/org/apache/solr/handler/SnapShooter.java
+++ b/solr/core/src/java/org/apache/solr/handler/SnapShooter.java
@@ -101,7 +101,7 @@ public class SnapShooter {
Collection<String> files = indexCommit.getFileNames();
FileCopier fileCopier = new FileCopier();
- Directory dir = solrCore.getDirectoryFactory().get(solrCore.getIndexDir(), null);
+ Directory dir = solrCore.getDirectoryFactory().get(solrCore.getIndexDir(), solrCore.getSolrConfig().indexConfig.lockType);
try {
fileCopier.copyFiles(dir, files, snapShotDir);
} finally {
diff --git a/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java
index 545b66c35df..3bd07e708ae 100644
--- a/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java
@@ -613,7 +613,7 @@ public class CoreAdminHandler extends RequestHandlerBase {
public void postClose(SolrCore core) {
Directory dir = null;
try {
- dir = core.getDirectoryFactory().get(core.getIndexDir(), null);
+ dir = core.getDirectoryFactory().get(core.getIndexDir(), core.getSolrConfig().indexConfig.lockType);
core.getDirectoryFactory().remove(dir);
core.getDirectoryFactory().doneWithDirectory(dir);
} catch (IOException e) {
@@ -1015,7 +1015,7 @@ public class CoreAdminHandler extends RequestHandlerBase {
Directory dir;
long size = 0;
try {
- dir = core.getDirectoryFactory().get(core.getIndexDir(), null);
+ dir = core.getDirectoryFactory().get(core.getIndexDir(), core.getSolrConfig().indexConfig.lockType);
try {
size = DirectoryFactory.sizeOfDirectory(dir);
} finally {