public class SolrSnapshotManager extends Object
Modifier and Type | Field and Description |
---|---|
static String |
CREATION_DATE |
static String |
FILE_LIST |
static String |
GENERATION_NUM |
static String |
INDEX_DIR_PATH |
static String |
LEADER |
static String |
SHARD_ID |
static String |
SNAPSHOT_REPLICAS |
static String |
SNAPSHOT_STATUS |
static String |
SNAPSHOTS_INFO |
Constructor and Description |
---|
SolrSnapshotManager() |
Modifier and Type | Method and Description |
---|---|
static void |
cleanupCollectionLevelSnapshots(SolrZkClient zkClient,
String collectionName)
This method deletes all snapshots for the specified collection in Zookeeper.
|
static void |
createCollectionLevelSnapshot(SolrZkClient zkClient,
String collectionName,
CollectionSnapshotMetaData meta)
This method creates an entry for the named snapshot for the specified collection in Zookeeper.
|
static void |
deleteCollectionLevelSnapshot(SolrZkClient zkClient,
String collectionName,
String commitName)
This method deletes an entry for the named snapshot for the specified collection in Zookeeper.
|
static void |
deleteNonSnapshotIndexFiles(SolrCore core,
Directory dir,
Collection<SolrSnapshotMetaDataManager.SnapshotMetaData> snapshots)
This method deletes index files not associated with the specified
snapshots . |
static void |
deleteSnapshotIndexFiles(SolrCore core,
Directory dir,
long gen)
This method deletes index files of the IndexCommit for the specified generation number.
|
static Optional<CollectionSnapshotMetaData> |
getCollectionLevelSnapshot(SolrZkClient zkClient,
String collectionName,
String commitName)
This method returns the CollectionSnapshotMetaData for the named snapshot for the specified collection in Zookeeper.
|
static Collection<CollectionSnapshotMetaData> |
listSnapshots(SolrZkClient zkClient,
String collectionName)
This method returns the CollectionSnapshotMetaData for each named snapshot for the specified collection in Zookeeper.
|
static boolean |
snapshotExists(SolrZkClient zkClient,
String collectionName,
String commitName)
This method returns if a named snapshot exists for the specified collection.
|
static void |
updateCollectionLevelSnapshot(SolrZkClient zkClient,
String collectionName,
CollectionSnapshotMetaData meta)
This method updates an entry for the named snapshot for the specified collection in Zookeeper.
|
public static final String INDEX_DIR_PATH
public static final String GENERATION_NUM
public static final String SNAPSHOT_STATUS
public static final String CREATION_DATE
public static final String SNAPSHOT_REPLICAS
public static final String SNAPSHOTS_INFO
public static final String LEADER
public static final String SHARD_ID
public static final String FILE_LIST
public static boolean snapshotExists(SolrZkClient zkClient, String collectionName, String commitName) throws org.apache.zookeeper.KeeperException, InterruptedException
zkClient
- Zookeeper clientcollectionName
- The name of the collectioncommitName
- The name of the snapshotorg.apache.zookeeper.KeeperException
- In case of Zookeeper errorInterruptedException
- In case of thread interruption.public static void createCollectionLevelSnapshot(SolrZkClient zkClient, String collectionName, CollectionSnapshotMetaData meta) throws org.apache.zookeeper.KeeperException, InterruptedException
zkClient
- Zookeeper clientcollectionName
- The name of the collectionmeta
- The CollectionSnapshotMetaData corresponding to named snapshotorg.apache.zookeeper.KeeperException
- In case of Zookeeper errorInterruptedException
- In case of thread interruption.public static void updateCollectionLevelSnapshot(SolrZkClient zkClient, String collectionName, CollectionSnapshotMetaData meta) throws org.apache.zookeeper.KeeperException, InterruptedException
zkClient
- Zookeeper clientcollectionName
- The name of the collectionmeta
- The CollectionSnapshotMetaData corresponding to named snapshotorg.apache.zookeeper.KeeperException
- In case of Zookeeper errorInterruptedException
- In case of thread interruption.public static void deleteCollectionLevelSnapshot(SolrZkClient zkClient, String collectionName, String commitName) throws InterruptedException, org.apache.zookeeper.KeeperException
zkClient
- Zookeeper clientcollectionName
- The name of the collectioncommitName
- The name of the snapshotInterruptedException
- In case of thread interruption.org.apache.zookeeper.KeeperException
- In case of Zookeeper errorpublic static void cleanupCollectionLevelSnapshots(SolrZkClient zkClient, String collectionName) throws InterruptedException, org.apache.zookeeper.KeeperException
zkClient
- Zookeeper clientcollectionName
- The name of the collectionInterruptedException
- In case of thread interruption.org.apache.zookeeper.KeeperException
- In case of Zookeeper errorpublic static Optional<CollectionSnapshotMetaData> getCollectionLevelSnapshot(SolrZkClient zkClient, String collectionName, String commitName) throws InterruptedException, org.apache.zookeeper.KeeperException
zkClient
- Zookeeper clientcollectionName
- The name of the collectioncommitName
- The name of the snapshotInterruptedException
- In case of thread interruption.org.apache.zookeeper.KeeperException
- In case of Zookeeper errorpublic static Collection<CollectionSnapshotMetaData> listSnapshots(SolrZkClient zkClient, String collectionName) throws InterruptedException, org.apache.zookeeper.KeeperException
zkClient
- Zookeeper clientcollectionName
- The name of the collectionInterruptedException
- In case of thread interruption.org.apache.zookeeper.KeeperException
- In case of Zookeeper errorpublic static void deleteSnapshotIndexFiles(SolrCore core, Directory dir, long gen) throws IOException
core
- The Solr coredir
- The index directory storing the snapshot.gen
- The generation number of the IndexCommit to be deleted.IOException
- in case of I/O errors.public static void deleteNonSnapshotIndexFiles(SolrCore core, Directory dir, Collection<SolrSnapshotMetaDataManager.SnapshotMetaData> snapshots) throws IOException
snapshots
.core
- The Solr coredir
- The index directory storing the snapshot.snapshots
- The snapshots to be preserved.IOException
- in case of I/O errors.Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.