|
@@ -162,8 +162,6 @@ public abstract class BlobStoreRepository extends AbstractLifecycleComponent imp
|
|
|
|
|
|
protected final RepositoryMetaData metadata;
|
|
|
|
|
|
- protected final NamedXContentRegistry namedXContentRegistry;
|
|
|
-
|
|
|
private static final int BUFFER_SIZE = 4096;
|
|
|
|
|
|
private static final String SNAPSHOT_PREFIX = "snap-";
|
|
@@ -213,11 +211,11 @@ public abstract class BlobStoreRepository extends AbstractLifecycleComponent imp
|
|
|
|
|
|
private final CounterMetric restoreRateLimitingTimeInNanos = new CounterMetric();
|
|
|
|
|
|
- private ChecksumBlobStoreFormat<MetaData> globalMetaDataFormat;
|
|
|
+ private final ChecksumBlobStoreFormat<MetaData> globalMetaDataFormat;
|
|
|
|
|
|
- private ChecksumBlobStoreFormat<IndexMetaData> indexMetaDataFormat;
|
|
|
+ private final ChecksumBlobStoreFormat<IndexMetaData> indexMetaDataFormat;
|
|
|
|
|
|
- private ChecksumBlobStoreFormat<SnapshotInfo> snapshotFormat;
|
|
|
+ private final ChecksumBlobStoreFormat<SnapshotInfo> snapshotFormat;
|
|
|
|
|
|
private final boolean readOnly;
|
|
|
|
|
@@ -240,17 +238,21 @@ public abstract class BlobStoreRepository extends AbstractLifecycleComponent imp
|
|
|
NamedXContentRegistry namedXContentRegistry) {
|
|
|
this.settings = settings;
|
|
|
this.metadata = metadata;
|
|
|
- this.namedXContentRegistry = namedXContentRegistry;
|
|
|
this.compress = COMPRESS_SETTING.get(metadata.settings());
|
|
|
snapshotRateLimiter = getRateLimiter(metadata.settings(), "max_snapshot_bytes_per_sec", new ByteSizeValue(40, ByteSizeUnit.MB));
|
|
|
restoreRateLimiter = getRateLimiter(metadata.settings(), "max_restore_bytes_per_sec", new ByteSizeValue(40, ByteSizeUnit.MB));
|
|
|
readOnly = metadata.settings().getAsBoolean("readonly", false);
|
|
|
|
|
|
-
|
|
|
indexShardSnapshotFormat = new ChecksumBlobStoreFormat<>(SNAPSHOT_CODEC, SNAPSHOT_NAME_FORMAT,
|
|
|
BlobStoreIndexShardSnapshot::fromXContent, namedXContentRegistry, compress);
|
|
|
indexShardSnapshotsFormat = new ChecksumBlobStoreFormat<>(SNAPSHOT_INDEX_CODEC, SNAPSHOT_INDEX_NAME_FORMAT,
|
|
|
BlobStoreIndexShardSnapshots::fromXContent, namedXContentRegistry, compress);
|
|
|
+ globalMetaDataFormat = new ChecksumBlobStoreFormat<>(METADATA_CODEC, METADATA_NAME_FORMAT,
|
|
|
+ MetaData::fromXContent, namedXContentRegistry, compress);
|
|
|
+ indexMetaDataFormat = new ChecksumBlobStoreFormat<>(INDEX_METADATA_CODEC, METADATA_NAME_FORMAT,
|
|
|
+ IndexMetaData::fromXContent, namedXContentRegistry, compress);
|
|
|
+ snapshotFormat = new ChecksumBlobStoreFormat<>(SNAPSHOT_CODEC, SNAPSHOT_NAME_FORMAT,
|
|
|
+ SnapshotInfo::fromXContentInternal, namedXContentRegistry, compress);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -259,12 +261,6 @@ public abstract class BlobStoreRepository extends AbstractLifecycleComponent imp
|
|
|
if (chunkSize != null && chunkSize.getBytes() <= 0) {
|
|
|
throw new IllegalArgumentException("the chunk size cannot be negative: [" + chunkSize + "]");
|
|
|
}
|
|
|
- globalMetaDataFormat = new ChecksumBlobStoreFormat<>(METADATA_CODEC, METADATA_NAME_FORMAT,
|
|
|
- MetaData::fromXContent, namedXContentRegistry, compress);
|
|
|
- indexMetaDataFormat = new ChecksumBlobStoreFormat<>(INDEX_METADATA_CODEC, METADATA_NAME_FORMAT,
|
|
|
- IndexMetaData::fromXContent, namedXContentRegistry, compress);
|
|
|
- snapshotFormat = new ChecksumBlobStoreFormat<>(SNAPSHOT_CODEC, SNAPSHOT_NAME_FORMAT,
|
|
|
- SnapshotInfo::fromXContentInternal, namedXContentRegistry, compress);
|
|
|
}
|
|
|
|
|
|
@Override
|