Skip to content

Commit

Permalink
[Backport 2.x] [Remote Store] Add support to reload repository metada…
Browse files Browse the repository at this point in the history
…ta inplace (opensearch-project#9569) (opensearch-project#10390)

* [Remote Store] Add support to reload repository metadata inplace (opensearch-project#9569)

---------

Signed-off-by: Bhumika Saini <[email protected]>

* Empty commit to retrigger build

Signed-off-by: Bhumika Saini <[email protected]>

* Empty commit to retrigger build

Signed-off-by: Bhumika Saini <[email protected]>

---------

Signed-off-by: Bhumika Saini <[email protected]>
Signed-off-by: Gaurav Bafna <[email protected]>
Co-authored-by: Gaurav Bafna <[email protected]>
  • Loading branch information
Bhumika Saini and gbbafna authored Oct 5, 2023
1 parent 92a261b commit 217ec16
Show file tree
Hide file tree
Showing 23 changed files with 545 additions and 183 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Pass parent filter to inner query in nested query ([#10246](https://github.com/opensearch-project/OpenSearch/pull/10246))
- Disable concurrent segment search when terminate_after is used ([#10200](https://github.com/opensearch-project/OpenSearch/pull/10200))
- Enable remote segment upload backpressure by default ([#10356](https://github.com/opensearch-project/OpenSearch/pull/10356))
- [Remote Store] Add support to reload repository metadata inplace ([#9569](https://github.com/opensearch-project/OpenSearch/pull/9569))
- [Metrics Framework] Add Metrics framework. ([#10241](https://github.com/opensearch-project/OpenSearch/pull/10241))

### Deprecated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public URLRepository(
ClusterService clusterService,
RecoverySettings recoverySettings
) {
super(metadata, false, namedXContentRegistry, clusterService, recoverySettings);
super(metadata, namedXContentRegistry, clusterService, recoverySettings);

if (URL_SETTING.exists(metadata.settings()) == false && REPOSITORIES_URL_SETTING.exists(environment.settings()) == false) {
throw new RepositoryException(metadata.name(), "missing url");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,7 @@ public AzureRepository(
final ClusterService clusterService,
final RecoverySettings recoverySettings
) {
super(
metadata,
COMPRESS_SETTING.get(metadata.settings()),
namedXContentRegistry,
clusterService,
recoverySettings,
buildLocation(metadata)
);
super(metadata, namedXContentRegistry, clusterService, recoverySettings, buildLocation(metadata));
this.chunkSize = Repository.CHUNK_SIZE_SETTING.get(metadata.settings());
this.storageService = storageService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,7 @@ class GoogleCloudStorageRepository extends MeteredBlobStoreRepository {
final ClusterService clusterService,
final RecoverySettings recoverySettings
) {
super(
metadata,
getSetting(COMPRESS_SETTING, metadata),
namedXContentRegistry,
clusterService,
recoverySettings,
buildLocation(metadata)
);
super(metadata, namedXContentRegistry, clusterService, recoverySettings, buildLocation(metadata));
this.storageService = storageService;

String basePath = BASE_PATH.get(metadata.settings());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public HdfsRepository(
final ClusterService clusterService,
final RecoverySettings recoverySettings
) {
super(metadata, COMPRESS_SETTING.get(metadata.settings()), namedXContentRegistry, clusterService, recoverySettings);
super(metadata, namedXContentRegistry, clusterService, recoverySettings);

this.environment = environment;
this.chunkSize = metadata.settings().getAsBytesSize("chunk_size", null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@
import java.util.Locale;
import java.util.Map;

import static org.opensearch.repositories.s3.S3Repository.BUCKET_SETTING;
import static org.opensearch.repositories.s3.S3Repository.BUFFER_SIZE_SETTING;
import static org.opensearch.repositories.s3.S3Repository.CANNED_ACL_SETTING;
import static org.opensearch.repositories.s3.S3Repository.SERVER_SIDE_ENCRYPTION_SETTING;
import static org.opensearch.repositories.s3.S3Repository.STORAGE_CLASS_SETTING;

class S3BlobStore implements BlobStore {

private static final Logger logger = LogManager.getLogger(S3BlobStore.class);
Expand All @@ -58,17 +64,17 @@ class S3BlobStore implements BlobStore {

private final S3AsyncService s3AsyncService;

private final String bucket;
private volatile String bucket;

private final ByteSizeValue bufferSize;
private volatile ByteSizeValue bufferSize;

private final boolean serverSideEncryption;
private volatile boolean serverSideEncryption;

private final ObjectCannedACL cannedACL;
private volatile ObjectCannedACL cannedACL;

private final StorageClass storageClass;
private volatile StorageClass storageClass;

private final RepositoryMetadata repositoryMetadata;
private volatile RepositoryMetadata repositoryMetadata;

private final StatsMetricPublisher statsMetricPublisher = new StatsMetricPublisher();

Expand Down Expand Up @@ -105,8 +111,14 @@ class S3BlobStore implements BlobStore {
this.priorityExecutorBuilder = priorityExecutorBuilder;
}

public boolean isMultipartUploadEnabled() {
return multipartUploadEnabled;
@Override
public void reload(RepositoryMetadata repositoryMetadata) {
this.repositoryMetadata = repositoryMetadata;
this.bucket = BUCKET_SETTING.get(repositoryMetadata.settings());
this.serverSideEncryption = SERVER_SIDE_ENCRYPTION_SETTING.get(repositoryMetadata.settings());
this.bufferSize = BUFFER_SIZE_SETTING.get(repositoryMetadata.settings());
this.cannedACL = initCannedACL(CANNED_ACL_SETTING.get(repositoryMetadata.settings()));
this.storageClass = initStorageClass(STORAGE_CLASS_SETTING.get(repositoryMetadata.settings()));
}

@Override
Expand Down
Loading

0 comments on commit 217ec16

Please sign in to comment.