mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-19 11:07:43 +00:00
Compensate for core.properties sticking around
This commit is contained in:
parent
8742715496
commit
f8a1937618
@ -119,15 +119,6 @@ public class KeywordSearch {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void propertyChange(PropertyChangeEvent evt) {
|
public void propertyChange(PropertyChangeEvent evt) {
|
||||||
/*
|
|
||||||
* TODO (AUT-2081): There is a Solr core unloading bug, fixed in
|
|
||||||
* Solr 5.4, that results in the co-existence of a core.properties
|
|
||||||
* file and a core.properties.unloaded file in the core instance
|
|
||||||
* directory when a core is closed/unloaded. When this happens,
|
|
||||||
* subsequent core open/load attempts will fail. The workaround for
|
|
||||||
* single-user cases is to close and reopen Autopsy so that a new
|
|
||||||
* server instance gets spun up.
|
|
||||||
*/
|
|
||||||
if (evt.getPropertyName().equals(Case.Events.CURRENT_CASE.toString())) {
|
if (evt.getPropertyName().equals(Case.Events.CURRENT_CASE.toString())) {
|
||||||
if (null != evt.getOldValue()) {
|
if (null != evt.getOldValue()) {
|
||||||
/*
|
/*
|
||||||
|
@ -173,6 +173,8 @@ public class Server {
|
|||||||
private int currentSolrStopPort = 0;
|
private int currentSolrStopPort = 0;
|
||||||
private static final boolean DEBUG = false;//(Version.getBuildType() == Version.Type.DEVELOPMENT);
|
private static final boolean DEBUG = false;//(Version.getBuildType() == Version.Type.DEVELOPMENT);
|
||||||
private UNCPathUtilities uncPathUtilities = null;
|
private UNCPathUtilities uncPathUtilities = null;
|
||||||
|
private static final String SOLR = "solr";
|
||||||
|
private static final String CORE_PROPERTIES = "core.properties";
|
||||||
|
|
||||||
public enum CORE_EVT_STATES {
|
public enum CORE_EVT_STATES {
|
||||||
|
|
||||||
@ -635,15 +637,6 @@ public class Server {
|
|||||||
currentCoreLock.writeLock().lock();
|
currentCoreLock.writeLock().lock();
|
||||||
try {
|
try {
|
||||||
if (null != currentCore) {
|
if (null != currentCore) {
|
||||||
/*
|
|
||||||
* TODO (AUT-2081): There is a Solr core unloading bug, fixed in
|
|
||||||
* Solr 5.4, that will result in the co-existence of a
|
|
||||||
* core.properties file and a core.properties.unloaded file in
|
|
||||||
* the core instance directory when the following code executes.
|
|
||||||
* When this happens, subsequent open/load attempts will fail.
|
|
||||||
* The workaround for single-user cases is to close and reopen
|
|
||||||
* Autopsy so that a new server instance gets spun up.
|
|
||||||
*/
|
|
||||||
currentCore.close();
|
currentCore.close();
|
||||||
currentCore = null;
|
currentCore = null;
|
||||||
serverAction.putValue(CORE_EVT, CORE_EVT_STATES.STOPPED);
|
serverAction.putValue(CORE_EVT, CORE_EVT_STATES.STOPPED);
|
||||||
@ -1097,15 +1090,21 @@ public class Server {
|
|||||||
* The core either does not exist or it is not loaded. Make a
|
* The core either does not exist or it is not loaded. Make a
|
||||||
* request that will cause the core to be created if it does not
|
* request that will cause the core to be created if it does not
|
||||||
* exist or loaded if it already exists.
|
* exist or loaded if it already exists.
|
||||||
*
|
|
||||||
* TODO (AUT-2081): There is a Solr core unloading bug, fixed in
|
|
||||||
* Solr 5.4, that results in the co-existence of a
|
|
||||||
* core.properties file and a core.properties.unloaded file in
|
|
||||||
* the core instance directory when a core is unloaded. When
|
|
||||||
* this happens, this code will fail. The workaround for
|
|
||||||
* single-user cases is to close and reopen Autopsy so that a
|
|
||||||
* new server instance gets spun up.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// In single user mode, if there is a core.properties file already,
|
||||||
|
// we've hit a solr bug. Compensate by deleting it.
|
||||||
|
if (caseType == CaseType.SINGLE_USER_CASE) {
|
||||||
|
Path corePropertiesFile = Paths.get(solrFolder.toString(), SOLR, coreName, CORE_PROPERTIES);
|
||||||
|
if (corePropertiesFile.toFile().exists()) {
|
||||||
|
try {
|
||||||
|
corePropertiesFile.toFile().delete();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
logger.log(Level.INFO, "Could not delete pre-existing core.properties prior to opening the core."); //NON-NLS
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CoreAdminRequest.Create createCoreRequest = new CoreAdminRequest.Create();
|
CoreAdminRequest.Create createCoreRequest = new CoreAdminRequest.Create();
|
||||||
createCoreRequest.setDataDir(dataDir.getAbsolutePath());
|
createCoreRequest.setDataDir(dataDir.getAbsolutePath());
|
||||||
createCoreRequest.setCoreName(coreName);
|
createCoreRequest.setCoreName(coreName);
|
||||||
@ -1208,6 +1207,15 @@ public class Server {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the name of the core
|
||||||
|
*
|
||||||
|
* @return the String name of the core
|
||||||
|
*/
|
||||||
|
String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
private QueryResponse query(SolrQuery sq) throws SolrServerException {
|
private QueryResponse query(SolrQuery sq) throws SolrServerException {
|
||||||
return solrCore.query(sq);
|
return solrCore.query(sq);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user