public abstract class BlobStoreRepository extends AbstractLifecycleComponent<Repository> implements Repository, BlobStoreIndexShardRepository.RateLimiterListener
BlobStore
implementation. The blobStore should be initialized in the derived
class before doStart()
is called.
BlobStoreRepository maintains the following structure in the blob store
STORE_ROOT
|- index - list of all snapshot name as JSON array
|- snapshot-20131010 - JSON serialized BlobStoreSnapshot for snapshot "20131010"
|- metadata-20131010 - JSON serialized MetaData for snapshot "20131010" (includes only global metadata)
|- snapshot-20131011 - JSON serialized BlobStoreSnapshot for snapshot "20131011"
|- metadata-20131011 - JSON serialized MetaData for snapshot "20131011"
.....
|- indices/ - data for all indices
|- foo/ - data for index "foo"
| |- snapshot-20131010 - JSON Serialized IndexMetaData for index "foo"
| |- 0/ - data for shard "0" of index "foo"
| | |- __1 \
| | |- __2 |
| | |- __3 |- files from different segments see snapshot-* for their mappings to real segment files
| | |- __4 |
| | |- __5 /
| | .....
| | |- snapshot-20131010 - JSON serialized BlobStoreIndexShardSnapshot for snapshot "20131010"
| | |- snapshot-20131011 - JSON serialized BlobStoreIndexShardSnapshot for snapshot "20131011"
| |
| |- 1/ - data for shard "1" of index "foo"
| | |- __1
| | .....
| |
| |-2/
| ......
|
|- bar/ - data for index bar
......
Modifier and Type | Field and Description |
---|---|
protected String |
repositoryName |
lifecycle
componentSettings, logger, settings
Modifier | Constructor and Description |
---|---|
protected |
BlobStoreRepository(String repositoryName,
RepositorySettings repositorySettings,
IndexShardRepository indexShardRepository)
Constructs new BlobStoreRepository
|
Modifier and Type | Method and Description |
---|---|
protected abstract BlobPath |
basePath()
Returns base path of the repository
|
protected abstract BlobStore |
blobStore()
Returns initialized and ready to use BlobStore
This method is first called in the
doStart() method. |
protected ByteSizeValue |
chunkSize()
Returns data file chunk size.
|
void |
deleteSnapshot(SnapshotId snapshotId)
Deletes snapshot
|
protected void |
doClose() |
protected void |
doStart() |
protected void |
doStop() |
void |
endVerification(String seed)
Called at the end of repository verification process.
|
Snapshot |
finalizeSnapshot(SnapshotId snapshotId,
String failure,
int totalShards,
com.google.common.collect.ImmutableList<SnapshotShardFailure> shardFailures)
Finalizes snapshotting process
This method is called on master after all shards are snapshotted.
|
void |
initializeSnapshot(SnapshotId snapshotId,
com.google.common.collect.ImmutableList<String> indices,
MetaData metaData)
Starts snapshotting process
|
protected boolean |
isCompress()
Returns true if metadata and snapshot files should be compressed
|
void |
onRestorePause(long nanos) |
void |
onSnapshotPause(long nanos) |
Snapshot |
readSnapshot(SnapshotId snapshotId)
Reads snapshot description from repository.
|
protected com.google.common.collect.ImmutableList<SnapshotId> |
readSnapshotList()
Reads snapshot index file
This file can be used by read-only repositories that are unable to list files in the repository
|
MetaData |
readSnapshotMetaData(SnapshotId snapshotId,
com.google.common.collect.ImmutableList<String> indices)
Returns global metadata associate with the snapshot.
|
long |
restoreThrottleTimeInNanos()
Returns restore throttle time in nanoseconds
|
com.google.common.collect.ImmutableList<SnapshotId> |
snapshots()
Returns the list of snapshots currently stored in the repository
|
long |
snapshotThrottleTimeInNanos()
Returns snapshot throttle time in nanoseconds
|
String |
startVerification()
Verifies repository on the master node and returns the verification token.
|
static String |
testBlobPrefix(String seed) |
protected void |
writeSnapshotList(com.google.common.collect.ImmutableList<SnapshotId> snapshots)
Writes snapshot index file
This file can be used by read-only repositories that are unable to list files in the repository
|
addLifecycleListener, close, lifecycleState, removeLifecycleListener, start, stop
nodeName
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addLifecycleListener, lifecycleState, removeLifecycleListener, start, stop
close
protected final String repositoryName
protected BlobStoreRepository(String repositoryName, RepositorySettings repositorySettings, IndexShardRepository indexShardRepository)
repositoryName
- repository namerepositorySettings
- repository settingsindexShardRepository
- an instance of IndexShardRepositoryprotected void doStart() throws ElasticsearchException
doStart
in class AbstractLifecycleComponent<Repository>
ElasticsearchException
protected void doStop() throws ElasticsearchException
doStop
in class AbstractLifecycleComponent<Repository>
ElasticsearchException
protected void doClose() throws ElasticsearchException
doClose
in class AbstractLifecycleComponent<Repository>
ElasticsearchException
protected abstract BlobStore blobStore()
doStart()
method.protected abstract BlobPath basePath()
protected boolean isCompress()
protected ByteSizeValue chunkSize()
public void initializeSnapshot(SnapshotId snapshotId, com.google.common.collect.ImmutableList<String> indices, MetaData metaData)
initializeSnapshot
in interface Repository
snapshotId
- snapshot idindices
- list of indices to be snapshottedmetaData
- cluster metadatapublic void deleteSnapshot(SnapshotId snapshotId)
deleteSnapshot
in interface Repository
snapshotId
- snapshot idpublic Snapshot finalizeSnapshot(SnapshotId snapshotId, String failure, int totalShards, com.google.common.collect.ImmutableList<SnapshotShardFailure> shardFailures)
finalizeSnapshot
in interface Repository
snapshotId
- snapshot idfailure
- global failure reason or nulltotalShards
- total number of shardsshardFailures
- list of shard failurespublic com.google.common.collect.ImmutableList<SnapshotId> snapshots()
snapshots
in interface Repository
public MetaData readSnapshotMetaData(SnapshotId snapshotId, com.google.common.collect.ImmutableList<String> indices)
readSnapshotMetaData
in interface Repository
snapshotId
- snapshot IDindices
- list of indicespublic Snapshot readSnapshot(SnapshotId snapshotId)
readSnapshot
in interface Repository
snapshotId
- snapshot IDprotected void writeSnapshotList(com.google.common.collect.ImmutableList<SnapshotId> snapshots) throws IOException
snapshots
- list of snapshot idsIOException
- I/O errorsprotected com.google.common.collect.ImmutableList<SnapshotId> readSnapshotList() throws IOException
IOException
- I/O errorspublic void onRestorePause(long nanos)
onRestorePause
in interface BlobStoreIndexShardRepository.RateLimiterListener
public void onSnapshotPause(long nanos)
onSnapshotPause
in interface BlobStoreIndexShardRepository.RateLimiterListener
public long snapshotThrottleTimeInNanos()
Repository
snapshotThrottleTimeInNanos
in interface Repository
public long restoreThrottleTimeInNanos()
Repository
restoreThrottleTimeInNanos
in interface Repository
public String startVerification()
Repository
startVerification
in interface Repository
public void endVerification(String seed)
Repository
endVerification
in interface Repository
seed
- verification request generated by Repository.startVerification()
commandCopyright © 2009–2015. All rights reserved.