public static class SolrArtifactIndexAdmin.LocalSolrCoreAdmin extends Object
| Modifier and Type | Field and Description |
|---|---|
protected Path |
configDirPath
The path to the core's configuration set.
|
static String |
CONFIGOVERLAY_FILE |
static String |
CONFIGOVERLAY_USERPROPS_KEY |
protected Path |
dataDir
The path to the core's data directory.
|
protected Path |
indexDir
The path to the core's Lucene index.
|
protected Path |
instanceDir
Base path of the Solr core.
|
protected int |
lockssConfigSetVersion
An integer representing the version of the LOCKSS Solr configuration set installed in this core.
|
static String |
REINDEX_LOCK_FILE |
protected Path |
sharedConfigSetBaseDir
The path to the shared configuration set base directory.
|
protected String |
sharedConfigSetName
The name of a shared configuration set used by the core.
|
protected String |
solrCoreName
The name of the Solr core.
|
protected Path |
solrHome
The base path to the Solr home directory containing the core.
|
static String |
UPGRADE_LOCK_FILE |
| Constructor and Description |
|---|
LocalSolrCoreAdmin(String name,
Path solrHome,
Path instanceDir,
Path configDirPath,
Path dataDir,
Path indexDir,
String sharedConfigSetName,
Path sharedConfigSetBaseDir,
int version)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
addSuffix(Path targetPath,
String suffix)
Adds a suffix extension to a directory or file.
|
void |
applySchemaUpdates()
Deprecated.
|
boolean |
coreUsesCommonConfigSet()
Returns a boolean indicating whether this Solr core uses a common configuration set.
|
void |
create()
Creates a new Solr core using the parameters of this
LocalSolrCoreAdmin. |
static void |
createCore(Path solrHome,
String solrCoreName)
Creates a new Solr core under the provided Solr home base directory with the latest LOCKSS configuration set
version.
|
static void |
createCore(Path solrHome,
String solrCoreName,
int lockssConfigSetVersion)
Creates a new Solr core under the provided Solr home base directory with a specified version of the LOCKSS
configuration set version.
|
boolean |
equals(Object o) |
static SolrArtifactIndexAdmin.LocalSolrCoreAdmin |
fromSolrCore(org.apache.solr.core.SolrCore core)
Takes an an open
SolrCore and extracts the configuration parameters to instantiate a new
LocalSolrCoreAdmin instance. |
static SolrArtifactIndexAdmin.LocalSolrCoreAdmin |
fromSolrHomeAndCoreName(Path solrHome,
String coreName)
Returns a
LocalCoreUpdater for a Solr core under a Solr home directory. |
String |
getCoreName() |
static int |
getLatestFileNameSuffix(Path targetPath)
Checks for siblings of the target path having the same name but numeric suffix and returns the maximum suffix.
|
int |
getLockssConfigSetVersion()
Determines the version of the LOCKSS Solr configuration set in this core by reading its configuration overlay
JSON file directly and returning the value of the "lockss-configset-version" key from userProps.
|
static int |
getLockssConfigSetVersionFromField(Path solrHome,
String coreName)
Deprecated.
|
static int |
getLockssConfigSetVersionFromOverlay(Path configDir)
Determines the version of the LOCKSS Solr configuration set installed at a path by reading the configuration
overlay JSON file and returning the value of the "lockss-configset-version" key from userProps.
|
static int |
getLockssConfigSetVersionFromSolrCore(org.apache.solr.core.SolrCore core)
Determines the version of a LOCKSS configuration set installed in this Solr core by looking up the value of the
"lockss-configset-version" key in user properties of its Solr configuration.
|
org.apache.lucene.index.SegmentInfos |
getSegmentInfos()
Returns a
SegmentInfos containing segment information for all segments in this Lucene index. |
int |
hashCode() |
static boolean |
hasSolrField(org.apache.solr.schema.IndexSchema schema,
String fieldName,
String expectedType)
Returns a
boolean indicating whether a field by the given field name and type exists in a
IndexSchema. |
void |
installLockssConfigSetVersion(int version)
Installs the specified version of the LOCKSS configuration set into this Solr core by reading the configuration
set's file list resource and copying the resources named within it to disk.
|
boolean |
isCoreExists()
Returns a
boolean indicating whether the Solr core exists on disk under the Solr home base directory. |
boolean |
isLockssConfigSetUpdateAvailable()
Returns a
boolean indicating whether a new LOCKSS configuration set is available for this core. |
boolean |
isLuceneIndexUpgradeAvailable()
Returns a
boolean indicating whether an upgrade is available for the Lucene index (and its segments) in
this core. |
boolean |
isReindexInProgress()
Returns a
boolean indicating whether a reindex is in progress. |
boolean |
isUpdateAvailable()
Convenience method.
|
boolean |
isUpdateInProgress()
Returns a
boolean indicating whether an update is in progress for this core. |
void |
reindexLatest() |
void |
retireConfigSet()
Retires the core's current configuration set by renaming it with a suffix containing a timestamp.
|
static void |
retirePath(Path targetPath)
Moves an existing directory or file out of the way by renaming it with a suffix containing a timestamp.
|
void |
update()
Performs all steps necessary to bring the underlying Solr core up-to-date.
|
void |
updateConfigSet()
Updates the configuration set of the LOCKSS repository Solr core iteratively to the latest version, and performs
any post-update Solr document reindexing.
|
void |
updateLuceneIndex()
Performs an upgrade of the Solr core's Lucene index if necessary.
|
public static final String CONFIGOVERLAY_FILE
public static final String CONFIGOVERLAY_USERPROPS_KEY
protected String solrCoreName
core.properties of
the core, but the name can be specified in the properties file by setting the name field.protected Path solrHome
It should contain a solr.xml configuration file for the Solr server (or node, if running as part of a
Solr Cloud cluster). The path can also be used to instantiate an EmbeddedSolrServer or
.
protected Path instanceDir
protected Path configDirPath
The core's configuration set is in the conf/ directory under the Solr core's instance directory. If the
name of a shared configuration set is provided (by setting the configSet property in
core.properties) then this points to the path of the configuration set in the shared configuration set
base directory.
protected Path dataDir
By default, this is the data/ directory under the Solr core's instance directory, unless specified by
setting the dataDir property in core.properties.
protected Path indexDir
By default, this is the index/ directory under the core's data directory.
protected String sharedConfigSetName
protected Path sharedConfigSetBaseDir
By default, this is the configsets/ directory under the Solr home directory, unless configured in
solr.xml.
protected int lockssConfigSetVersion
public static final String UPGRADE_LOCK_FILE
public static final String REINDEX_LOCK_FILE
public LocalSolrCoreAdmin(String name, Path solrHome, Path instanceDir, Path configDirPath, Path dataDir, Path indexDir, String sharedConfigSetName, Path sharedConfigSetBaseDir, int version)
name - A String containing the name of the Solr core.solrHome - A Path to the Solr home base directory that contains the core.instanceDir - A Path to the Solr core instance directory.configDirPath - A Path to the Solr core's configuration set directory.dataDir - A Path to the Solr core's data directory.indexDir - A Path to the Solr core's Lucene index directory.sharedConfigSetName - A String containing the name of the shared configuration set used by the core.sharedConfigSetBaseDir - A Path to the shared configuration set base directory.version - An int containing the version of the LOCKSS configuration set installed in the core.public void create()
throws IOException,
org.apache.solr.client.solrj.SolrServerException
LocalSolrCoreAdmin.IOExceptionorg.apache.solr.client.solrj.SolrServerExceptionpublic static void createCore(Path solrHome, String solrCoreName) throws IOException, org.apache.solr.client.solrj.SolrServerException
solrHome - A Path containing the path to a Solr home base directory.solrCoreName - A String containing the name of the Solr core to create.IOExceptionorg.apache.solr.client.solrj.SolrServerExceptionpublic static void createCore(Path solrHome, String solrCoreName, int lockssConfigSetVersion) throws IOException, org.apache.solr.client.solrj.SolrServerException
solrHome - A Path containing the path to a Solr home base directory.solrCoreName - A String containing the name of the Solr core to create.lockssConfigSetVersion - An int containing the version of the LOCKSS configuration set to install.IOExceptionorg.apache.solr.client.solrj.SolrServerExceptionpublic void update()
throws IOException,
SolrResponseErrorException,
org.apache.solr.client.solrj.SolrServerException
IOExceptionSolrResponseErrorExceptionorg.apache.solr.client.solrj.SolrServerExceptionpublic boolean isUpdateAvailable()
throws IOException
boolean indicating whether this Solr core has an update available for its
Lucene index and segments, or its LOCKSS configuration set.boolean indicating whether this Solr core has an update available for its Lucene index and
segments, or its LOCKSS configuration set.IOExceptionpublic boolean isCoreExists()
boolean indicating whether the Solr core exists on disk under the Solr home base directory.
Uses a CoreContainer to discover Solr cores under the Solr home path.boolean indicating whether the Solr core exists under the Solr home base directory.public boolean isLuceneIndexUpgradeAvailable()
throws IOException
boolean indicating whether an upgrade is available for the Lucene index (and its segments) in
this core. Determined by comparing its oldest segment version with the target version.boolean indicating whether the oldest segment in the Lucene index is below the target version.IOException - Thrown if an error occurred while reading the core's Lucene segments.public boolean isLockssConfigSetUpdateAvailable()
throws IOException
boolean indicating whether a new LOCKSS configuration set is available for this core.
Determined by comparing the current LOCKSS configuration set version with the latest version.
See getLockssConfigSetVersion() for details.boolean indicating whether a new LOCKSS configuration set is available for this core.IOException - Thrown if an error occurs while attempting to read the Solr Configuration Overlay file.public boolean isUpdateInProgress()
throws IOException
boolean indicating whether an update is in progress for this core. Determined by whether we're
able to acquire the update lock at a given instance.boolean indicating whether an update is in progress.IOException - Thrown if there were I/O problems with the lock file.public boolean isReindexInProgress()
throws IOException
boolean indicating whether a reindex is in progress. Determined by whether the reindex lockfile
is present in this core.
This *not* thread-safe!
boolean indicating whether a reindex is in progress.IOException@Deprecated public void applySchemaUpdates()
public void updateLuceneIndex()
throws IOException
IOExceptionpublic org.apache.lucene.index.SegmentInfos getSegmentInfos()
throws IOException
SegmentInfos containing segment information for all segments in this Lucene index.SegmentInfos containing segment information for all segments in this Lucene index.IOExceptionpublic void updateConfigSet()
throws IOException,
SolrResponseErrorException,
org.apache.solr.client.solrj.SolrServerException
IOExceptionSolrResponseErrorExceptionorg.apache.solr.client.solrj.SolrServerExceptionpublic int getLockssConfigSetVersion()
throws IOException
Returns 0 if the configuration overlay file could not be found, or if the LOCKSS configuration set version key does not exist in the overlay.
int containing the version of the configuration set.IOExceptionpublic static int getLockssConfigSetVersionFromOverlay(Path configDir) throws IOException
Returns 0 if the configuration overlay file could not be found at the path, or if the LOCKSS configuration set version key does not exist in the overlay.
configDir - A Path containing the path to a configuration set.int containing the version of the configuration set.FileNotFoundException - If configuration overlay file does not exist.IOException@Deprecated public static int getLockssConfigSetVersionFromField(Path solrHome, String coreName)
Depreciated. This is an "alpha1" technique. The LOCKSS configuration set version is now recorded in the configuration overlay as a userProps property.
solrHome - coreName - IOExceptionpublic static boolean hasSolrField(org.apache.solr.schema.IndexSchema schema,
String fieldName,
String expectedType)
boolean indicating whether a field by the given field name and type exists in a
IndexSchema.public static int getLockssConfigSetVersionFromSolrCore(org.apache.solr.core.SolrCore core)
Returns 0 if the configuration overlay file could not be found, or the LOCKSS configuration set version key does not exist in the overlay.
int containing the version of the configuration set.IOExceptionpublic void retireConfigSet()
throws IOException
IOExceptionpublic static void retirePath(Path targetPath) throws IOException
targetPath - IOExceptionpublic static void addSuffix(Path targetPath, String suffix) throws IOException
targetPath - A Path to the directory or file.suffix - A String containing the suffix to add.IOExceptionpublic static int getLatestFileNameSuffix(Path targetPath)
targetPath - A Path containing the path to evaluate for maximum sibling suffix.int indicating the maximum sibling suffix, or 0 indicating the path has no stepped siblings,
or -1 if the target path does not exist.public void installLockssConfigSetVersion(int version)
throws IOException
version - IOExceptionpublic boolean coreUsesCommonConfigSet()
boolean indicating whether this Solr core uses a common configuration set.public static SolrArtifactIndexAdmin.LocalSolrCoreAdmin fromSolrHomeAndCoreName(Path solrHome, String coreName) throws IOException
LocalCoreUpdater for a Solr core under a Solr home directory.
Returns null if the Solr core could not be found under the provided path.
solrHome - A Path to a Solr home directory.coreName - A String containing the name of the Solr core.LocalCoreUpdater instance or null if the core could not be found.IOExceptionpublic static SolrArtifactIndexAdmin.LocalSolrCoreAdmin fromSolrCore(org.apache.solr.core.SolrCore core)
SolrCore and extracts the configuration parameters to instantiate a new
LocalSolrCoreAdmin instance.core - An instance of SolrCore.LocalSolrCoreAdmin wrapping the given SolrCore.public String getCoreName()
public void reindexLatest()
throws IOException,
SolrResponseErrorException,
org.apache.solr.client.solrj.SolrServerException
IOExceptionSolrResponseErrorExceptionorg.apache.solr.client.solrj.SolrServerExceptionCopyright © 2000–2020 LOCKSS Program. All rights reserved.