Class DefaultLuceneIndexSnapshotManager
- java.lang.Object
-
- com.atlassian.confluence.internal.index.lucene.snapshot.DefaultLuceneIndexSnapshotManager
-
- All Implemented Interfaces:
LuceneIndexSnapshotManager
public class DefaultLuceneIndexSnapshotManager extends Object implements LuceneIndexSnapshotManager
Manage all Lucene index snapshots. In DC, all index snapshots are stored undershared-home/index-snapshots
. There is a limit of how many snapshots are retained at any time for an index. The default is 3. Exceeded snapshots are regularly purged byLuceneIndexSnapshotCleaner
.- Since:
- 7.6.0
-
-
Constructor Summary
Constructors Constructor Description DefaultLuceneIndexSnapshotManager(com.atlassian.plugin.PluginAccessor pluginAccessor, BootstrapManager bootstrapManager, com.atlassian.dc.filestore.api.compat.FilesystemPath sharedHome, JournalStateStore journalStateStore)
DefaultLuceneIndexSnapshotManager(com.atlassian.plugin.PluginAccessor pluginAccessor, BootstrapManager bootstrapManager, com.atlassian.dc.filestore.api.compat.FilesystemPath sharedHome, JournalStateStore journalStateStore, Function<Path,Optional<Long>> indexVersionReader)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LuceneIndexSnapshot
create(JournalIdentifier journalIdentifier)
Create a new Lucene index snapshot for given journal (index)void
delete(LuceneIndexSnapshot snapshot)
Delete an index snapshot from file system.Optional<LuceneIndexSnapshot>
find(JournalIdentifier journalIdentifier, long journalEntryId)
Find a specific index snapshot corresponding to a journal entry ID.Optional<LuceneIndexSnapshot>
find(JournalIdentifier journalIdentifier, long journalEntryId, long timeoutMs)
Find a specific index snapshot corresponding to a journal entry ID.List<LuceneIndexSnapshot>
findForJournal(JournalIdentifier journalIdentifier)
Optional<Path>
getFile(LuceneIndexSnapshot snapshot)
Obtain location of an index snapshot.void
restore(LuceneIndexSnapshot snapshot)
Restore a Lucene snapshot for given journal (index) to the current node
-
-
-
Constructor Detail
-
DefaultLuceneIndexSnapshotManager
public DefaultLuceneIndexSnapshotManager(com.atlassian.plugin.PluginAccessor pluginAccessor, BootstrapManager bootstrapManager, com.atlassian.dc.filestore.api.compat.FilesystemPath sharedHome, JournalStateStore journalStateStore)
-
DefaultLuceneIndexSnapshotManager
public DefaultLuceneIndexSnapshotManager(com.atlassian.plugin.PluginAccessor pluginAccessor, BootstrapManager bootstrapManager, com.atlassian.dc.filestore.api.compat.FilesystemPath sharedHome, JournalStateStore journalStateStore, Function<Path,Optional<Long>> indexVersionReader)
-
-
Method Detail
-
create
public LuceneIndexSnapshot create(JournalIdentifier journalIdentifier)
Description copied from interface:LuceneIndexSnapshotManager
Create a new Lucene index snapshot for given journal (index)- Specified by:
create
in interfaceLuceneIndexSnapshotManager
- Parameters:
journalIdentifier
- Identifier of a journal of which a snapshot will be created- Returns:
- newly created snapshot, its content can be accessed by
LuceneIndexSnapshotManager.getFile(LuceneIndexSnapshot)
-
restore
public void restore(LuceneIndexSnapshot snapshot)
Description copied from interface:LuceneIndexSnapshotManager
Restore a Lucene snapshot for given journal (index) to the current node- Specified by:
restore
in interfaceLuceneIndexSnapshotManager
- Parameters:
snapshot
- snapshot to restore
-
findForJournal
public List<LuceneIndexSnapshot> findForJournal(JournalIdentifier journalIdentifier)
- Specified by:
findForJournal
in interfaceLuceneIndexSnapshotManager
- Returns:
- all snapshots created for given journal (index) in chronological order (desc)
-
find
public Optional<LuceneIndexSnapshot> find(JournalIdentifier journalIdentifier, long journalEntryId)
Description copied from interface:LuceneIndexSnapshotManager
Find a specific index snapshot corresponding to a journal entry ID. This method returns immediately. Note: In certain network filesystem it may take a while after a snapshot file is created by a node until it is visible to other nodes. If you want to find a newly created snapshot and wait until it becomes visible, useLuceneIndexSnapshotManager.find(JournalIdentifier, long, long)
- Specified by:
find
in interfaceLuceneIndexSnapshotManager
- Parameters:
journalIdentifier
- Identifier of a journal of which a snapshot will be createdjournalEntryId
- place in journal when snapshot was created
-
find
public Optional<LuceneIndexSnapshot> find(JournalIdentifier journalIdentifier, long journalEntryId, long timeoutMs) throws InterruptedException
Description copied from interface:LuceneIndexSnapshotManager
Find a specific index snapshot corresponding to a journal entry ID. If it cannot be found immediately then this method will wait until it becomes visible or certain time has passed.- Specified by:
find
in interfaceLuceneIndexSnapshotManager
- Parameters:
journalIdentifier
- Identifier of a journal of which a snapshot will be createdjournalEntryId
- place in journal when snapshot was createdtimeoutMs
- max time to wait until the snapshot file is available- Returns:
- Location of the zipped snapshot in file system if found within
waitTimeMs
or empty - Throws:
InterruptedException
-
delete
public void delete(LuceneIndexSnapshot snapshot) throws IOException
Description copied from interface:LuceneIndexSnapshotManager
Delete an index snapshot from file system. Do nothing if the snapshot doesn't exist- Specified by:
delete
in interfaceLuceneIndexSnapshotManager
- Parameters:
snapshot
- The snapshot to be deleted- Throws:
IOException
- If there is error deleting the snapshot file
-
getFile
public Optional<Path> getFile(LuceneIndexSnapshot snapshot)
Description copied from interface:LuceneIndexSnapshotManager
Obtain location of an index snapshot.- Specified by:
getFile
in interfaceLuceneIndexSnapshotManager
- Parameters:
snapshot
- Index snapshot to be accessed- Returns:
- Location of the zipped snapshot in file system
-
-