Class DefaultLuceneIndexSnapshotManager
java.lang.Object
com.atlassian.confluence.internal.index.lucene.snapshot.DefaultLuceneIndexSnapshotManager
- All Implemented Interfaces:
LuceneIndexSnapshotManager
Manage all Lucene index snapshots. In DC, all index snapshots are stored under
shared-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 by LuceneIndexSnapshotCleaner
.- Since:
- 7.6.0
-
Constructor Summary
ConstructorDescriptionDefaultLuceneIndexSnapshotManager
(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
Modifier and TypeMethodDescriptioncreate
(JournalIdentifier journalIdentifier) Create a new Lucene index snapshot for given journal (index)void
delete
(LuceneIndexSnapshot snapshot) Delete an index snapshot from file system.find
(JournalIdentifier journalIdentifier, long journalEntryId) Find a specific index snapshot corresponding to a journal entry ID.find
(JournalIdentifier journalIdentifier, long journalEntryId, long timeoutMs) Find a specific index snapshot corresponding to a journal entry ID.findForJournal
(JournalIdentifier journalIdentifier) 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 Details
-
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 Details
-
create
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
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
- Specified by:
findForJournal
in interfaceLuceneIndexSnapshotManager
- Returns:
- all snapshots created for given journal (index) in chronological order (desc)
-
find
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
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
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
-