mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 10:17:41 +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()) {
|
||||||
/*
|
/*
|
||||||
|
@ -79,76 +79,76 @@ public class Server {
|
|||||||
public static enum Schema {
|
public static enum Schema {
|
||||||
|
|
||||||
ID {
|
ID {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "id"; //NON-NLS
|
return "id"; //NON-NLS
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
IMAGE_ID {
|
IMAGE_ID {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "image_id"; //NON-NLS
|
return "image_id"; //NON-NLS
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// This is not stored or index . it is copied to Text and Content_Ws
|
// This is not stored or index . it is copied to Text and Content_Ws
|
||||||
CONTENT {
|
CONTENT {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "content"; //NON-NLS
|
return "content"; //NON-NLS
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
TEXT {
|
TEXT {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "text"; //NON-NLS
|
return "text"; //NON-NLS
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
CONTENT_WS {
|
CONTENT_WS {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "content_ws"; //NON-NLS
|
return "content_ws"; //NON-NLS
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
FILE_NAME {
|
FILE_NAME {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "file_name"; //NON-NLS
|
return "file_name"; //NON-NLS
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// note that we no longer index this field
|
// note that we no longer index this field
|
||||||
CTIME {
|
CTIME {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ctime"; //NON-NLS
|
return "ctime"; //NON-NLS
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// note that we no longer index this field
|
// note that we no longer index this field
|
||||||
ATIME {
|
ATIME {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "atime"; //NON-NLS
|
return "atime"; //NON-NLS
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// note that we no longer index this field
|
// note that we no longer index this field
|
||||||
MTIME {
|
MTIME {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "mtime"; //NON-NLS
|
return "mtime"; //NON-NLS
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// note that we no longer index this field
|
// note that we no longer index this field
|
||||||
CRTIME {
|
CRTIME {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "crtime"; //NON-NLS
|
return "crtime"; //NON-NLS
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
NUM_CHUNKS {
|
NUM_CHUNKS {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "num_chunks"; //NON-NLS
|
return "num_chunks"; //NON-NLS
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
public static final String HL_ANALYZE_CHARS_UNLIMITED = "500000"; //max 1MB in a chunk. use -1 for unlimited, but -1 option may not be supported (not documented)
|
public static final String HL_ANALYZE_CHARS_UNLIMITED = "500000"; //max 1MB in a chunk. use -1 for unlimited, but -1 option may not be supported (not documented)
|
||||||
@ -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